Stubbing a non-static non-void method to return something

In this post under Mockito, I will show with example how to stub a non-static non-void method of a mock object to return a hardcoded value. For our example, we will use the below classes IndianCash package package6; public class IndianCash { public double getCash() { return 10; } } IndiaToUSACashConverter package package6; public class…… Continue reading Stubbing a non-static non-void method to return something

Junit @TempDir method level scope

In this post under JUnit, I will show with example how applying “@TempDir” to a non-static field creates a temporary directory having method level scope. When “@TempDir” is applied to a non-static field, for every test method present in the test class, JUnit will creates different temporary directory and attaches its reference to non-static field…… Continue reading Junit @TempDir method level scope