XGroupService extends XGroupServiceBase<XXGroup, VXGroup> { public VXGroup readResourceWithOutLogin(Long id) { XXGroup resource = getDao().getById(id); if (resource == null) { throw restErrorUtil.createRESTException(getResourceName() + " not found", MessageEnums.DATA_NOT_FOUND, id, null, "preRead: " + id + " not found."); } VXGroup view = populateViewBean(resource); if(view!=null){ view.setGroupSource(resource.getGroupSource()); } return view; } 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 test3ReadResourceWithOutLogin() { XXGroup resource = createXXGroup(); Mockito.when(entityDao.getById(resource.getId())).thenReturn(resource); Mockito.when(daoManager.getXXPortalUser()).thenReturn(xXPortalUserDao); Mockito.when(xXPortalUserDao.getById(resource.getAddedByUserId())).thenReturn(tUser); XGroupService.readResourceWithOutLogin(resource.getId()); }