In my springboot project, I am testing some POJOs using Mockito
.
I simply mock instance & stub function:
public class MyCarTest {
@Mock
Car car;
@Mock
Manufacture manufacture;
@Test
public void testGetManufacture() {
// NullInsteadOfMockException
doReturn(manufacture).when(car).getManufacture();
}
}
if I run the test, I get error:
org.mockito.exceptions.misusing.NullInsteadOfMockException:
Argument passed to when() is null!
Where am I wrong?