I have a unit test method (testMethodToTest) which internally calls helperMethod .So I try to mock using Mockito.when
I have tried anyList() as well, but still same issue.
@Test
public void testMethodToTest() throws Exception {
List<Long> workqueues = new ArrayList<>();
workqueues.add(10000L);
List<String> tasks=new ArrayList<>();
tasks.add("Task_1v9et4t");
Mockito.when(service.helperMethod(workqueues)).thenReturn(tasks);
Map<String, Object> result = service.methodToTest(workqueues) );
}
I keep getting Null Pointer Exception in Mockito.when() line.
Aucun commentaire:
Enregistrer un commentaire