I have the following method to test in my Java service class:
public void findPersonToDelete(String id){ //repository method then called personRepository.findPersonAndDelete(id); } The issue is that the personRepository calls other code which throws a Null Pointer.
I tried to use the following line to stop the personRepository from calling other methods:
Mockito.doNothing().when(personRepository).findPersonAndDelete(id); However the error is still persisting? How can I fix this?
idis, it will execute the method normally.anyInt()rather than a specific value. FurtherPersonRepositoryneeds to be amockor aspy.