 »
JUnit: Naming Individual Test Cases in a Parameterized Test
A couple of years ago I wrote about JUnit Parameterized Tests. One of the things I didn’t like about them was that JUnit named the invidividual test cases using numbers, so if they failed you had no idea which test parameters caused the failure. The following Eclipse screenshot will show you what I mean: ...Read More »
War Games, Pair Testing and Other Fun Ways to Find Bugs
I .. »
JUnit and EasyMock cooperation
Developers ...Read More »
Testing Expected Exceptions with JUnit Rules
This post shows how to test for expected exceptions using JUnit. Let’s start with the following class that we wish to test: public class Person { private final String name; private final int age; /** * Creates a person with the specified name and age. * * @param name the name ...Read More »
Don’t rely on unit tests alone
When ...Read More »
Hamcrest Containing Matchers
The Hamcrest 1.3 Javadoc documentation for the Matchers class adds more documentation for several of that class’s methods than were available in Hamcrest 1.2. For example, the four overloaded contains methods have more descriptive Javadoc documentation as shown in the two comparison screen snapshots shown next. Although one can figure out how the ...Read More »