9/29/09

Testing Exceptions in JUnit 4.7

Testing Exceptions in JUnit 4.7: "JUnit 4.7 introduced a few features that make it a little easier to work with exceptions. JUnit 4 introduced the expected parameter, which makes a test succeed if and only if a certain exception is thrown. For example, in the following code sample, we are testing a UserManager class. When the login() function is called, it should throw an UnknownUserException when no user is found."



(Via Javalobby Front Page.)

No comments: