coverage testing jacoco and mokito

20 views
Skip to first unread message

Marcos Lozina

unread,
May 3, 2016, 12:37:53 PM5/3/16
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