I have a problem mocking the test, everything goes correct till this point of the code/test which i get a NullPointerException
, this is the main code where launches the null pointer.
ResponseSrvAddDto responseSrvAdd = kjidR048.executeAddDocuments(requestAdd);
String returnCode = responseSrvAdd.getReturnCode();
if (returnCode != null && "00".equals(returnCode)){
ERROR! java.lang.NullPointerException
I have this in the test
ResponseSrvAddDto responseSrvAdd = mock(ResponseSrvAddDto.class);
Mockito.when(kjidR048.executeAddDocuments(requestAdd)).thenReturn(responseSrvAdd); (this goes correct)
String code = "00";
Mockito.when(responseSrvAdd.getReturnCode()).thenReturn(code);
(but this looks like ignores the mock)
I don't know why having the mock in the responseSrvAdd.getReturnCode()
launches a null pointer but i have this already mocked.