So I started writing tests for our Java-Spring-project.
What I use is JUnit and Mockito. It\'s said, that when I use the when()...thenReturn() option I can mock ser
I had the same problem and my issue was simply that I had not annotated the class properly using @RunWith. In your example, make sure that you have:
@RunWith(MockitoJUnitRunner.class) public class Test { ...
Once I did that, the NullPointerExceptions disappeared.