Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
JUnit 4.x is based on annotations, a concept introduced in JDK 1.5 along with static imports and some other features. This section lists those changes to the JUnit API.
If you remember, with JUnit 3.x we used to override the setUp() and tearDown() methods when we extended the junit.framework.TestCase class. These methods (or fixtures, as they’re called) are executed right before/after each of the tests gets executed. Their purpose is to execute some common logic before or after each of the tests. As we already mentioned (several times, at least), in JUnit 4.x you no longer extend the junit.framework.TestCase class. So how can we execute some common logic before/after each of the tests?