initMocks
initMocks is a method commonly found in unit testing frameworks, particularly those related to the Java ecosystem like Mockito. Its primary purpose is to initialize mock objects within a test class. When a test class uses annotations like `@Mock` to declare mock objects, initMocks is responsible for creating and injecting these mock objects before the test method is executed.
This initialization process ensures that any fields annotated as mocks are properly instantiated and ready for
In Mockito, initMocks is often called from a `@Before` method in JUnit or a similar setup method