### Question:
VolumeManagementDAO extends DefaultDAOBase<Integer, VolumeManagement> { public List<VolumeManagement> getVolumesByVirtualDatacenter(final VirtualDatacenter vdc) { Criteria criteria = createCriteria(sameVirtualDatacenter(vdc)); return getResultList(criteria); } VolumeManagementDAO();  VolumeManagementDAO(final EntityManager entityManager); List<VolumeManagement> getVolumesByPool(final StoragePool sp); List<VolumeManagement> getVolumesByVirtualDatacenter(final VirtualDatacenter vdc); VolumeManagement getVolumeByVirtualDatacenter(final VirtualDatacenter vdc,
        final Integer volumeId); List<VolumeManagement> getStatefulCandidates(final VirtualDatacenter vdc); List<VolumeManagement> getVolumesFromEnterprise(final Integer idEnterprise); @SuppressWarnings("unchecked") List<VolumeManagement> getVolumesByPool(final StoragePool sp, final FilterOptions filters); @SuppressWarnings("unchecked") List<VolumeManagement> getVolumesByVirtualDatacenter(final VirtualDatacenter vdc,
        final FilterOptions filters); List<VolumeManagement> getVolumesByEnterprise(final Integer id,
        final FilterOptions filters); @SuppressWarnings("unchecked") List<VolumeManagement> getAvailableVolumes(final VirtualDatacenter vdc,
        final FilterOptions filters); VolumeManagement getVolumeFromImage(final Integer idImage); @Deprecated // use vm.getVolumes List<VolumeManagement> getVolumesByVirtualMachine(final VirtualMachine vm); List<VolumeManagement> getVolumesByVirtualMachine(final VirtualMachine vm,
        final FilterOptions filters); List<VolumeManagement> getAttachedVolumes(final VirtualDatacenter vdc); List<VolumeManagement> getDetachedVolumes(final VirtualDatacenter vdc); List<VolumeManagement> getVolumesByVirtualAppliance(final VirtualAppliance vapp);  }### Answer:
@Test public void testGetVolumesByVirtualDatacenter() { VolumeManagement volume = eg().createUniqueInstance(); List<Object> entitiesToPersist = new ArrayList<Object>(); eg().addAuxiliaryEntitiesToPersist(volume, entitiesToPersist); persistAll(ds(), entitiesToPersist, volume); VolumeManagementDAO dao = createDaoForRollbackTransaction(); List<VolumeManagement> results = dao.getVolumesByVirtualDatacenter(volume.getVirtualDatacenter()); assertSize(results, 1); assertAllEntityPropertiesEqual(results.iterator().next(), volume); }