XGroupService extends XGroupServiceBase<XXGroup, VXGroup> { public VXGroup getGroupByGroupName(String groupName) { XXGroup xxGroup = daoManager.getXXGroup().findByGroupName(groupName); if (xxGroup == null) { throw restErrorUtil.createRESTException( groupName + " is Not Found", MessageEnums.DATA_NOT_FOUND); } return super.populateViewBean(xxGroup); } XGroupService(); VXGroup getGroupByGroupName(String groupName); VXGroup createXGroupWithOutLogin(VXGroup vxGroup); VXGroup readResourceWithOutLogin(Long id); List<XXTrxLog> getTransactionLog(VXGroup vResource, String action); List<XXTrxLog> getTransactionLog(VXGroup vObj, XXGroup mObj, String action); @Override VXGroup populateViewBean(XXGroup xGroup); Map<Long, XXGroup> getXXGroupIdXXGroupMap();  }
@Test public void test1GetGroupByGroupName() { Mockito.when(daoManager.getXXGroup()).thenReturn(xXGroupDao); XXGroup xxGroup = createXXGroup(); Mockito.when(xXGroupDao.findByGroupName(xxGroup.getName())).thenReturn(xxGroup); Mockito.when(daoManager.getXXPortalUser()).thenReturn(xXPortalUserDao); Mockito.when(xXPortalUserDao.getById(xxGroup.getAddedByUserId())).thenReturn(tUser); XGroupService.getGroupByGroupName(xxGroup.getName()); }