Created
December 10, 2013 15:09
-
-
Save lhohan/7892113 to your computer and use it in GitHub Desktop.
From http://stackoverflow.com/questions/1052282/how-to-set-an-expected-exception-using-scala-and-junit-4
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def shouldThrow[E<:Throwable](f: =>Unit) { try { f fail("should have thrown an Exception") } catch { case e:E => () case e => throw e } } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment