In this post under Junit 5, I will show how to disable a test method or all test methods of a class. Junit 5 added a new annotation named “Disabled” to disable a test method or all the test methods of a class. When applied at a particular method, that particular method is disabled. When…… Continue reading Disabling the tests
Month: August 2022
assertTrue and assertFalse with Supplier Interface
In this post under JUnit 5, I will introduce you to a new overloaded version of “assertTrue” and “assertFalse” methods. In the earlier versions, we used to stored the result of a comparison in local variable of type boolean and when calling assertTrue or assertFalse, we used to pass that local variable as an argument…… Continue reading assertTrue and assertFalse with Supplier Interface
Comparing two arrays for equality
In this post under Java, I will show with example how to check whether two arrays are equal or not. The class Arrays under java.util package has “equals” static method which takes two arrays as arguments and compare their contents to check whether they are same. Below is the code showing an example Main 1…… Continue reading Comparing two arrays for equality
BeforeEach and AfterEach annotations
In this post under JUnit, I will show with example the purpose of BeforeEach and AfterEach annotations. As you know when writing unit test cases, before calling the test method and asserting the output, we should first setup the data on which the test method has to be executed. We can place the code that’s…… Continue reading BeforeEach and AfterEach annotations