### Question:
RackDAO extends DefaultDAOBase<Integer, Rack> { public List<Rack> findRacksWithHAEnabled(final Datacenter datacenter) { Criteria criteria = createCriteria(sameDatacenter(datacenter)); criteria.add(Restrictions.eq(Rack.HAENABLED_PROPERTY, true)); criteria.addOrder(Order.asc(Rack.NAME_PROPERTY)); List<Rack> result = getResultList(criteria); return result; } RackDAO();  RackDAO(final EntityManager entityManager); List<Rack> findRacks(final Datacenter datacenter); List<Rack> findRacks(final Datacenter datacenter, final String filter); List<Rack> findRacksWithHAEnabled(final Datacenter datacenter); boolean existsAnyWithDatacenterAndName(final Datacenter datacenter, final String name); boolean existsAnyOtherWithDatacenterAndName(final Rack rack, final String name); List<Integer> getRackIdByMinVLANCount(final int idDatacenter); Long getNumberOfDeployedVlanNetworks(final Integer rackId); Rack findByIds(final Integer datacenterId, final Integer rackId); List<Rack> findAllNotManagedRacksByDatacenter(final Integer datacenterId); List<Rack> findAllNotManagedRacksByDatacenter(final Integer datacenterId,
        final String filter); @SuppressWarnings("unchecked") List<Integer> findUsedVrdpPorts(final Rack rack); Integer getEmptyOffMachines(final Integer rackId); Integer getEmptyOnMachines(final Integer rackId); List<Machine> getRandomMachinesToStartFromRack(final Integer rackId,
        final Integer howMany); List<Machine> getRandomMachinesToShutDownFromRack(final Integer rackId,
        final Integer howMany); List<Machine> getAllMachinesToShutDownFromRack(final Integer rackId);  }### Answer:
@Test public void test_findRacksWithHAEnabled() throws IllegalAccessException, InvocationTargetException, NoSuchMethodException { Datacenter datacenter = datacenterGenerator.createUniqueInstance(); Rack rack1 = datacenter.createRack("Rack_1", 2, 4094, 2, 10); Rack rack2 = datacenter.createRack("Rack_2", 2, 4094, 2, 10); Rack rack3 = datacenter.createRack("Rack_3", 2, 4094, 2, 10); rack1.setHaEnabled(true); rack2.setHaEnabled(false); rack3.setHaEnabled(true); ds().persistAll(datacenter, rack1, rack2, rack3); RackDAO dao = createDaoForRollbackTransaction(); List<Rack> result = dao.findRacksWithHAEnabled(reload(dao, datacenter)); Assert.assertEquals(result.size(), 2); }