dimanche 10 novembre 2019

Junit Test case Failure: Using PowerMockRunner Class

Exception:- java.lang.RuntimeException: Invoking the beforeTestMethod method on PowerMock test listener org.powermock.api.extension.listener.AnnotationEnabler@4738a206 failed.

Caused by:- java.lang.IllegalArgumentException: Comparison method violates its general contract!

PowerMock Version:- Using 1.6.2

Code Snippet:-

import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.MockitoAnnotations;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.core.Is.is;
import static org.mockito.Matchers.any;
import static org.mockito.Matchers.eq;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
import static org.powermock.api.mockito.PowerMockito.mockStatic;
@RunWith(PowerMockRunner.class)
@PrepareForTest({x.class,y.class})
public class xyzControllerTest {
}
@Test
    public void getModelShouldReturnValidModelWhenInjected() {
}

Aucun commentaire:

Enregistrer un commentaire