Category: Database

Unit testing helps us to cover different scenarios and it is a way to ensure the applications behave as expected under certain circumstances. Most of the time it is easy to test your classes and methods, but sometimes you need to mock certain services or methods to isolate your target.

There are some cases that we also want to mock static methods of a particular utility class, so how can we accomplish that?

In this way, we can isolate the getAnimal method and validate if that method is calling getGermanShepherd.

Related Articles