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
For me the reason I was getting NPE is that I was using Mockito.any() when mocking primitives. I found that by switching to using the correct variant from mockito gets rid of the errors.
For example, to mock a function that takes a primitive long as parameter, instead of using any(), you should be more specific and replace that with any(Long.class) or Mockito.anyLong().
Hope that helps someone.