XGroupUserService extends
		XGroupUserServiceBase<XXGroupUser, VXGroupUser> { public VXGroupUser createXGroupUserWithOutLogin(VXGroupUser vxGroupUser) { boolean groupUserMappingExists = true; XXGroupUser xxGroupUser = daoManager.getXXGroupUser().findByGroupNameAndUserId(vxGroupUser.getName(), vxGroupUser.getUserId()); if (xxGroupUser == null) { xxGroupUser = new XXGroupUser(); groupUserMappingExists = false; } XXGroup xGroup = daoManager.getXXGroup().findByGroupName(vxGroupUser.getName()); vxGroupUser.setParentGroupId(xGroup.getId()); xxGroupUser = mapViewToEntityBean(vxGroupUser, xxGroupUser, 0); XXPortalUser xXPortalUser = daoManager.getXXPortalUser().getById(createdByUserId); if (xXPortalUser != null) { xxGroupUser.setAddedByUserId(createdByUserId); xxGroupUser.setUpdatedByUserId(createdByUserId); } if (groupUserMappingExists) { xxGroupUser = getDao().update(xxGroupUser); } else { xxGroupUser = getDao().create(xxGroupUser); } vxGroupUser = postCreate(xxGroupUser); return vxGroupUser; } XGroupUserService(); VXGroupUser createXGroupUserWithOutLogin(VXGroupUser vxGroupUser); VXGroupUser readResourceWithOutLogin(Long id); List<XXTrxLog> getTransactionLog(VXGroupUser vXGroupUser, String action); List<XXTrxLog> getTransactionLog(VXGroupUser vObj, XXGroupUser mObj, String action);  }
@Test public void test1CreateXGroupUserWithOutLogin() { XXGroupUser resource = createXXGroupUser(); Mockito.when(daoManager.getXXGroupUser()).thenReturn(xXGroupUserDao); Mockito.when(xXGroupUserDao.findByGroupNameAndUserId(resource.getName(), resource.getId())) .thenReturn(resource); Mockito.when(daoManager.getXXGroup()).thenReturn(xXGroupDao); XXGroup xGroup = createXXGroup(); VXGroupUser vxGroupUser = createVXGroupUser(); Mockito.when(xXGroupDao.findByGroupName(vxGroupUser.getName())).thenReturn(xGroup); Mockito.when(daoManager.getXXPortalUser()).thenReturn(xXPortalUserDao); Mockito.when(xXPortalUserDao.getById(vxGroupUser.getId())).thenReturn(tUser); Mockito.when(entityDao.update(resource)).thenReturn(resource); xGroupUserService.createXGroupUserWithOutLogin(vxGroupUser); }