List/Grid Tag Archives: JUnit

Fault Injection with Byteman and JUnit
The time when our applications lived in isolation have passed long-long ago. Nowadays applications are a very complicated beasts talking to each other using myriads of APIs and protocols, ...

Running JUnit Tests Repeatedly Without Loops
Recently I came across a problem where I had to write tests for a method that calculates randomly distributed values within a certain range of possibilities 1. More precisely if you ...

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 ...

JUnit and EasyMock cooperation
Developers always need to take care about code which they produced. They should be ensured that code works properly after a new feature was implemented or some bug was fixed. That’s ...

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 ...

Don’t rely on unit tests alone
When you are building a complex system, barely testing components in isolation is not enough. It’s crucial, but not enough. Imagine a car factory that manufactures and imports ...

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 ...

JUnit test method ordering
Junit until version 4.10 uses the order of test methods in a test class as returned by the reflection API as the order of test method execution - Class.getMethods(). To quote the Javadoc ...

Using Builder Pattern in JUnit tests
This is not intended to be a heavily technical post. The goal of this post is to give you some guidelines to make your JUnit testing life more easy, to enable you to write complex scenarios ...

Working Efficiently with JUnit in Eclipse
Recently I was dragged into a discussion1 with some test infected2 fellows about how we use JUnit within the Eclipse IDE. Surprisingly the conversation brought up some ‘tips and tricks’ ...


