How to Solve Mockito mockedStatic NotAMockException Error

Error Message:

org.mockito.exceptions.misusing.NotAMockException: Argument passed to Mockito.mockingDetails() should be a mock, but is an instance of class java.lang.Class!
    at org.mockito.internal.runners.StrictRunner.run(StrictRunner.java:52)
    at org.mockito.junit.MockitoJUnitRunner.run(MockitoJUnitRunner.java:163)
    at org.mockito.runners.MockitoJUnitRunner.run(MockitoJUnitRunner.java:53)

 

Solution:
Delete @RunWith(MockitoJUnitRunner.class)
and add

    @Before
    public void before(){
        log.info("start--------{}",this.getClass().getName());
         MockitoAnnotations.openMocks(this);
    }

Read More: