I want to test that my code which returns twitter.Future throws an IllegalArgumentException when a requirement isn't fulfilled.
I'm using scala test with an implicit conversion from twitter.Future to FutureConcept (similar to how ScalaFutures trait works but for twitter Futures)
But I can't find how it should be done!
I've tried the following:
whenReady(methodThrowingExceptionFromFuture) {...handling}
This throws the exception as a TestFailedException before reaching handling part so it doesn't intercept the exception as needed. So I tried intercept:
intercept[IllegalArgumentException] { future.futureValue }
But same here. I think FutureConcept wraps the exception as a TestFailedException so I was thinking of unpacking the real exception, but surely there must be some other way of dealing with negative test cases together with scala futures?