I see Option support there, but what about custom class classes?
I kind of want to do this:
result match { case SuccessCase(values) => { values.foo should be ("bar") } case FailureCase => // should fail test, but how to say this in ScalaTest? }
You can use fail () to specifically reject testing, as in the case of FailureCase => fail ("err msg"), but I'm not sure I understand what you are after. Perhaps you can show more code or develop to clarify the question?
DesiredCase this work if you want you to do this DesiredCase ?
DesiredCase
result match { case DesiredCase(values) => { values.foo should be ("bar") } case _ => { fail("Not DesiredCase") } }
Bill Venners also suggested writing special matches if you often write such tests:
https://groups.google.com/forum/?fromgroups#!msg/scalatest-users/4MemQiqLzao/_DsBTQWaqfwJ