Automate unit test using @InjectMocks to inject mock dependencies
Preconditions (3)
Step 1: Create a mock instance of the repository interface using @Mock
Step 2: Create an instance of the service class using @InjectMocks to inject the mock repository
Step 3: Stub the repository method to return a fixed value
Step 4: Call the service method that uses the repository
Step 5: Verify the service method returns the expected value based on the stubbed repository
✅ Expected Result: The service method returns the expected value from the mocked repository without null pointer exceptions