In Java/Junit, I need to test for null with some object. There are a variety of ways I can test a condition but I have been using assertTrue for most of my tests. When I c
To get 100% code coverage on boolean methods, do the following
Class RecordService{
public boolean doesRecordExist(String id){
return id!=null;
}
}
//Method inside your mock
@Test
public boolean testDoesRecordExist(){
RecordService recordService = mock(RecordService.class);
when(recordService.doesRecordExists()).thenReturn(
anyString()).thenReturn(null);
}