79191076

Date: 2024-11-15 04:20:42
Score: 1
Natty:
Report link

Please pay attention to the following points:

  1. Are you using @org.mockito.InjectMocks?

  2. JUnit version:

    2.1) If it’s JUnit 4, configure the test class as follows:

    @org.junit.Before
    public void setUp() {
        org.mockito.MockitoAnnotations.openMocks(this);
    }
    

    2.2) If it’s JUnit 5:

    @org.junit.BeforeEach
    void setUp() {
        MockitoAnnotations.openMocks(this);
    }
    
  3. In my case, I am not using @ExtendWith(MockitoExtension.class) in the class.

Reasons:
  • Has code block (-0.5):
  • Contains question mark (0.5):
  • Low reputation (1):
Posted by: Ha Van Hanh