In my previous article I have written down the sample code for Junit 4 testing using annotations. In this tutorial I would like to write about expected exception testing and Rules which is introduced from JUnit 4.7. JUnit 4 introduced the expected parameter, which makes a test succeed if and only if a certain exception is thrown. In …
JUnit 4.0
JUnit 4 Annotation Example
This tutorial explains the basic usage of JUnit 4 annotations. JUnit is the most popular Unit testing framework most widely used by the Java developers. After the release of Java 5.0 annotations, JUnit 4 has updated to support the annotation programming for the testing methods. Also it introduced @BeforeClass and @AfterClass methods which has to …
Unit Testing with JUnit 4 Annotations
JUnit 4.0 introduces a completely different API to the older versions. JUnit 4.0 uses Java 5.0 annotations to describe tests instead of using inheritence. It introduces more flexible initialization and cleanup, timeouts, and parameterized test cases. This post describes the new features in JUnit 4.0, and in the end, I show a basic example that …