ResourcePoolService implements IResourcePoolService { @Override public List<VcCluster> getVcResourcePoolByName(String name) { logger.info("get resource pool by name " + name); List<VcResourcePoolEntity> rps = new ArrayList<VcResourcePoolEntity>(); VcResourcePoolEntity rp = rpDao.findByName(name); if (rp != null) { rps.add(rp); } else { logger.info("got null resource pool entity for name:" + name); } List<VcCluster> result = convertToVcCluster(rps); return result; }  IResourcePoolDAO getRpDao(); @Autowired void setRpDao(IResourcePoolDAO rpDao); IClusterDAO getClusterDao(); @Autowired void setClusterDao(IClusterDAO clusterDao); IResourceService getResService(); @Autowired void setResService(IResourceService resSvc); @Override List<VcCluster> getAllVcResourcePool(); @Override synchronized void addResourcePool(String rpName,
         String vcClusterName, String vcResourcePool); @Override List<VcCluster> getVcResourcePoolByName(String name); @Override List<VcCluster> getVcResourcePoolByNameList(String[] names); @Override Set<String> getAllRPNames(); @Override @Transactional List<ResourcePoolRead> getAllResourcePoolForRest(); @Override @Transactional ResourcePoolRead getResourcePoolForRest(final String rpName); @Override @Transactional synchronized void deleteResourcePool(final String rpName); @Override boolean isDeployedUnderCluster(final String clusterName,
         final String vcRPName); synchronized List<String> addAutoResourcePools(
         List<VcCluster> vcClusters, boolean ignoreDuplicate); @Override synchronized void updateResourcePool(String rpName,
         String vcClusterName, String vcResourcePool);  }
@Test(groups = { "res-mgmt" }) public void testGetVcResourcePoolByName() { new Expectations() { { VcResourcePoolEntity rpEntity = new VcResourcePoolEntity(); rpEntity.setName("defaultRP"); rpEntity.setVcCluster("cluster-ws"); rpEntity.setVcResourcePool("jarred"); rpDao.findByName(anyString); returns(rpEntity); } }; rpSvc.setRpDao(rpDao); List<VcCluster> clusters = rpSvc.getVcResourcePoolByName("defaultRP"); Assert.assertNotNull(clusters); Assert.assertEquals(clusters.size(), 1); }