These are chat archives for etorreborre/specs2

24th
Jun 2016
Edmondo Porcu
@edmondo1984
Jun 24 2016 14:24
Hello, I have a problem when testing either/xor whatever error thing
I'd like my test to fail if the result of my call is Left(e) with that exception, however if I return a result type of Failure, this fails without stacktrace
Eric Torreborre
@etorreborre
Jun 24 2016 14:28
I think that you need to pattern match
a must beLike {
  case Right(_) => Success()
  case Left(e) => Error(e) 
}
Edmondo Porcu
@edmondo1984
Jun 24 2016 14:31
Error(e) throws an exception?
I was using Failure
that's why
syncResult match {
  case Xor.Left(e) => Failure(s"An exception has occurred", s"${e.getMessage}", e.getStackTrace.toList)
  case Xor.Right(x) => (x.s2xStatus.s2xDescription must beEqualTo("OK")) and (client.xmlLoadCount must beEqualTo(1))
}
that failrue wouldn't be pretty printed very nice
Eric Torreborre
@etorreborre
Jun 24 2016 14:33
with Failure you only get stacktraces by passing failtrace in the console
Edmondo Porcu
@edmondo1984
Jun 24 2016 14:35
can I set that as a standard in my specification?
these are genuine test failures, not errors
but not having stacktrace makes it difficult to debug them
Eric Torreborre
@etorreborre
Jun 24 2016 15:06
You can add this argument to the test arguments in sbt and this will be done by default
Edmondo Porcu
@edmondo1984
Jun 24 2016 17:37
tnx