JUnit expected exception test
Expected exception test is used for the methods which can throw an exception. We have to specify expected exception in @Test(expected = expectedException.class) action. If expected exception or any of its subclass exception is thrown by the method then JUnit will pass this unit test. Example: DivisionTestCase.java import com.w3schools.business.*; import static org.junit.Assert.*; import org.junit.Test; … Read more