Program: 124346
Project: 124346
Buggy source:
/** 
 * This test method updates a saved staffMemberEntity. It demonstrates the approach when there is a method call in the method under test. To solve this you need to override the   {@code @Inject} of the tested method by using theappropriate setter  {@code setStaffMemberDao()}.
 */
@Test public void testSaveStaffMember(){
  StaffMemberEto staffMemberEto=Mockito.mock(StaffMemberEto.class);
  StaffMemberDao staffMemberDao=Mockito.mock(StaffMemberDao.class);
  StaffMemberEntity staffMemberEntity=Mockito.mock(StaffMemberEntity.class);
  long id=1L;
  Mockito.when(staffMemberEto.getId()).thenReturn(id);
  Mockito.when(staffMemberDao.find(id)).thenReturn(staffMemberEntity);
  Mockito.when(staffMemberEto.getName()).thenReturn("String_Node_Str");
  Mockito.when(staffMemberEntity.getName()).thenReturn("String_Node_Str");
  Mockito.when(this.beanMapper.map(staffMemberEto,StaffMemberEntity.class)).thenReturn(staffMemberEntity);
  Mockito.when(staffMemberDao.save(staffMemberEntity)).thenReturn(staffMemberEntity);
  Mockito.when(this.beanMapper.map(staffMemberEntity,StaffMemberEto.class)).thenReturn(staffMemberEto);
  this.staffmanagementImpl.setStaffMemberDao(staffMemberDao);
  StaffMemberEto resultEto=this.staffmanagementImpl.saveStaffMember(staffMemberEto);
  Mockito.verify(staffMemberEto).getId();
  Mockito.verify(staffMemberDao).find(id);
  Mockito.verify(staffMemberEto,Mockito.atLeastOnce()).getName();
  Mockito.verify(staffMemberEntity,Mockito.atLeastOnce()).getName();
  Mockito.verify(this.beanMapper).map(staffMemberEto,StaffMemberEntity.class);
  Mockito.verify(staffMemberDao).save(staffMemberEntity);
  Mockito.verify(this.beanMapper).map(staffMemberEntity,StaffMemberEto.class);
  assertThat(resultEto.getId()).isEqualTo(staffMemberEto.getId());
}

Fixed version (ground truth):
/** 
 * This test method updates a saved staffMemberEntity. It demonstrates the approach when there is a method call in the method under test. To solve this in the given case you need to override the   {@code @Inject} of the tested method byusing the appropriate setter  {@code setStaffMemberDao()}.
 */
@Test public void testSaveStaffMember(){
  StaffMemberEto staffMemberEto=Mockito.mock(StaffMemberEto.class);
  StaffMemberDao staffMemberDao=Mockito.mock(StaffMemberDao.class);
  StaffMemberEntity staffMemberEntity=Mockito.mock(StaffMemberEntity.class);
  long id=1L;
  Mockito.when(staffMemberEto.getId()).thenReturn(id);
  Mockito.when(staffMemberDao.find(id)).thenReturn(staffMemberEntity);
  Mockito.when(staffMemberEto.getName()).thenReturn("String_Node_Str");
  Mockito.when(staffMemberEntity.getName()).thenReturn("String_Node_Str");
  Mockito.when(this.beanMapper.map(staffMemberEto,StaffMemberEntity.class)).thenReturn(staffMemberEntity);
  Mockito.when(staffMemberDao.save(staffMemberEntity)).thenReturn(staffMemberEntity);
  Mockito.when(this.beanMapper.map(staffMemberEntity,StaffMemberEto.class)).thenReturn(staffMemberEto);
  this.staffmanagementImpl.setStaffMemberDao(staffMemberDao);
  StaffMemberEto resultEto=this.staffmanagementImpl.saveStaffMember(staffMemberEto);
  Mockito.verify(staffMemberEto).getId();
  Mockito.verify(staffMemberDao).find(id);
  Mockito.verify(staffMemberEto,Mockito.atLeastOnce()).getName();
  Mockito.verify(staffMemberEntity,Mockito.atLeastOnce()).getName();
  Mockito.verify(this.beanMapper).map(staffMemberEto,StaffMemberEntity.class);
  Mockito.verify(staffMemberDao).save(staffMemberEntity);
  Mockito.verify(this.beanMapper).map(staffMemberEntity,StaffMemberEto.class);
  assertThat(resultEto.getId()).isEqualTo(staffMemberEto.getId());
}