Test for Exception in JUnit 5 and JUnit 4
In this tutorial you will learn how to write a JUnit Test that validates if method under the test throws correct exception. This tutorial will have examples for JUnit 5 and JUnit 4 as well. Let’s begin with JUnit 5 version first. JUnit 5. “assertThrows()” Assertion To test for exception in JUnit 5 we use…
Read More Test for Exception in JUnit 5 and JUnit 4