Groups
Groups
Sign in
Groups
Groups
JaCoCo and EclEmma Users
Conversations
About
Send feedback
Help
coverage testing jacoco and mokito
20 views
Skip to first unread message
Marcos Lozina
unread,
May 3, 2016, 12:37:53 PM
5/3/16
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to JaCoCo and EclEmma Users
Hello everyone,I have a question with the coverage tests and the use of Mokito object
In my
test
class
@Test
public
String
savePessoaWithErro(){
when(result.hasErrors()).thenReturn(true);
String returnSavePessoa= appController.savePessoa(any(Pessoa.class), result, model);
/* when appController.savePessoa(any(Pessoa.class), result, model) , and result.hasErrors()=true, appController return pessoaadd */
AssertJUnit.assertEquals(returnSavePessoa,"pessoaadd");
return anyString();
}
In my controller class
@RequestMapping(value = { "/newpessoa" }, method = RequestMethod.POST)
public String savePessoa(@Valid Pessoa pessoa, BindingResult result, ModelMap model) {
if (result.hasErrors()) {
return PESSOAADD;
}
model.addAttribute(SUCCESS, pessoaService.save(pessoa));
return "pessoaRegistrationsuccess";
}
But jacoco,mark this as not covered and do not understand the reason.
someone would know the reason?
I appreciate your help and time
Thank you
Reply all
Reply to author
Forward
This conversation is locked
You cannot reply and perform actions on locked conversations.
0 new messages