I am using mockito core4.4.0
and JUnit5
and have test:
@ExtendWith(MockitoExtension.class)
@MockitoSettings(strictness = Strictness.LENIENT)
class ElasticSearchLoggerTest {
private CloseableHttpClient client;
private CloseableHttpResponse response;
@BeforeEach
public void setUp() {
response = Mockito.mock(CloseableHttpResponse.class);
client = Mockito.mock(CloseableHttpClient.class);
}
....
}
However, this mocking results in NPE, i tried to use @Mock
annotation instead of Mocking with Mockito.mock()
but the result is the same.
Why is this null?