Created
June 1, 2012 08:30
-
-
Save rschumm/2850334 to your computer and use it in GitHub Desktop.
JUnit excepted Exception
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
@Rule | |
public ExpectedException thrown = ExpectedException.none(); | |
//Test, der eine Exception mit der Massage "bla" erwartet. | |
@Test | |
public void testNothingFoundServer() throws Exception { | |
thrown.expectMessage("bla"); | |
thrown.expect(FakeUnmarshallNothingFoundException.class); | |
codeDerKnallt(); | |
} | |
nein, die Idee war, die erwartete Exception eben auch auf die Message zu prüfen, nicht nur deren Auftreten.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Or simpler: