Java, Unit Testing, Legacy Code, Programming, Technology.
use the Mockito extension provided by the mockito-inline dependency to achieve this. Here’s how you can use Mockito to mock a static method: Add the mockito-inline dependency to your pom.xml: <dependency> <groupId>org.mockito</groupId> <artifactId>mockito-inline</artifactId>