### Question:
RasdManagementDAO extends DefaultDAOBase<Integer, RasdManagement> { public List<RasdManagement> findByVirtualMachine(final VirtualMachine virtualMachine) { return getResultList(createCriteria(sameVirtualMachine(virtualMachine))); } RasdManagementDAO();  RasdManagementDAO(final EntityManager entityManager); @SuppressWarnings("unchecked") List<RasdManagement> findByVirtualDatacenterAndResourceType(
        final VirtualDatacenter virtualDatacenter, final String resourceType); List<RasdManagement> findByVirtualMachine(final VirtualMachine virtualMachine); List<RasdManagement> findDisksAndVolumesByVirtualMachine(
        final VirtualMachine virtualMachine); void enableTemporalOnlyFilter(); void restoreDefaultFilters();  }### Answer:
@Test public void testFindByVirtualMachine() { RasdManagement rasdManagement = eg().createUniqueInstance(); VirtualMachine vm = vmGenerator.createUniqueInstance(); rasdManagement.setVirtualMachine(vm); List<Object> entitiesToPersist = new ArrayList<Object>(); eg().addAuxiliaryEntitiesToPersist(rasdManagement, entitiesToPersist); persistAll(ds(), entitiesToPersist, rasdManagement); RasdManagementDAO dao = createDaoForRollbackTransaction(); Collection<RasdManagement> results = dao.findByVirtualMachine(vm); assertEquals(results.size(), 1); eg().assertAllPropertiesEqual(results.iterator().next(), rasdManagement); }