Skip to content
Advertisement

mock instance is null after @Mock annotation

I try to run this test:

JavaScript

but I get NullPointerException for:

Mockito.when(routingClientMock.

what am i missing?

Advertisement

Answer

When you want to use the @Mock annotation you should use the MockitoJUnitRunner

JavaScript

See also this tutorial.

Advertisement