I have similar to below code in my application.
public String someMethod(final Object obj) {
final ValidationResponse validationResponse = new ValidationResponse();
String responseMessage = validatorService.validate(obj, validationResponse);
if(validationResponse.isValid()) {
//Positive flow
}
else {
//Negative flow
}
return responseMessage;
}
I am writing JUnit test cases to generate Mutation's report. As the object validationResponse is used which is a local object created in the flow. Mockito is unable to get & return desired value for isValid. Due to this I am unable to cover the test cases for the Positive flow.
How this could be achieved? Any lead is very much appreciated.