AppManagerService implements IAppManagerService { @Override @Transactional(readOnly = true) public List<AppManagerRead> getAllAppManagerReads() { List<AppManagerEntity> entities = appManagerDAO.findAllSortByName(); List<AppManagerRead> reads = new ArrayList<AppManagerRead>(); for (AppManagerEntity entity : entities) { reads.add(toAppManagerRead(entity)); } return reads; }  IAppManagerDAO getAppManagerDAO(); @Autowired void setAppManagerDAO(IAppManagerDAO appManagerDAO); IClusterDAO getClusterDao(); @Autowired void setClusterDao(IClusterDAO clusterDao); @Override @Transactional synchronized void addAppManager(AppManagerAdd appManagerAdd); @Override @Transactional(readOnly = true) AppManagerEntity findAppManagerByName(String name); @Override @Transactional(readOnly = true) AppManagerRead getAppManagerRead(String name); @Override @Transactional(readOnly = true) List<AppManagerRead> getAllAppManagerReads(); @Override @Transactional(readOnly = true) List<AppManagerEntity> findAll(); @Override @Transactional void deleteAppManager(String name); @Override @Transactional void modifyAppManager(AppManagerAdd appManagerAdd);  }
@Test(groups = { "res-mgmt" }) public void testGetAllAppManagerReads() { new NonStrictExpectations() { { appManagerDAO.findAllSortByName(); result = appMgrList; } }; appMgrSvc.setAppManagerDAO(appManagerDAO); List<AppManagerRead> appMgrReads = appMgrSvc.getAllAppManagerReads(); Assert.notNull(appMgrReads); }