### Question:
MachineDAO extends DefaultDAOBase<Integer, Machine> { public List<Machine> findRackMachines(final Rack rack) { return findRackMachines(rack, null); } MachineDAO();  MachineDAO(final EntityManager entityManager); List<Machine> findMachines(final Datacenter datacenter); List<Machine> findRackMachines(final Rack rack); List<Machine> findRackMachines(final Rack rack, final String filter); List<Machine> findMachinesWithHAInProgress(); List<Machine> findRackEnabledForHAMachines(final Rack rack); List<Machine> findRackEnabledForHAMachinesInUcs(final UcsRack rack); boolean existsAnyWithDatacenterAndName(final Datacenter datacenter, final String name); boolean existsAnyOtherWithDatacenterAndName(final Machine machine, final String name); int deleteRackMachines(final Rack rack); List<Machine> findCandidateMachines(final Integer idRack,
        final Integer idVirtualDatacenter, final Long hdRequiredOnDatastore,
        final Enterprise enterprise); List<Machine> findCandidateMachines(final Integer idRack,
        final Integer idVirtualDatacenter, final Enterprise enterprise, final String datastoreUuid,
        final Integer originalHypervisorId); List<Machine> findReservedMachines(final Enterprise enterprise); Machine findReservedMachine(final Enterprise enterprise, final Integer machineId); void reserveMachine(final Machine machine, final Enterprise enterprise); void releaseMachine(final Machine machine); Machine findByIds(final Integer datacenterId, final Integer rackId,
        final Integer machineId); Machine findByIp(final Datacenter datacenter, final String ip); Set<Integer> findAllIds(); List<Integer> findAllIdsInDatacenters(final Datacenter... datacenters); Long getTotalUsedCores(); Long getTotalUsedCoresExceptMachine(final Machine machine);  }### Answer:
@Test public void test_findRackMachines() { DatacenterGenerator datacenterGenerator = new DatacenterGenerator(getSeed()); MachineGenerator machineGenerator = new MachineGenerator(getSeed()); Datacenter datacenter1 = datacenterGenerator.createUniqueInstance(); Datacenter datacenter2 = datacenterGenerator.createUniqueInstance(); Rack rack1_1 = datacenter1.createRack("Rack1_1", 2, 4094, 2, 10); Rack rack2_1 = datacenter2.createRack("Rack2_1", 2, 4094, 2, 10); Rack rack2_2 = datacenter2.createRack("Rack2_2", 2, 4094, 2, 10); Machine machine1_1 = machineGenerator.createMachine(datacenter1); Machine machine2_2 = machineGenerator.createMachine(datacenter2); Machine machine2_3 = machineGenerator.createMachine(datacenter2); machine1_1.setRack(rack1_1); machine2_2.setRack(rack2_1); machine2_3.setRack(rack2_1); ds().persistAll(datacenter1, datacenter2, rack1_1, rack2_1, rack2_2, machine1_1, machine2_2, machine2_3); MachineDAO dao = createDaoForRollbackTransaction(); Assert.assertEquals(dao.findRackMachines(reload(dao, rack1_1)).size(), 1); Assert.assertEquals(dao.findRackMachines(reload(dao, rack2_1)).size(), 2); Assert.assertEquals(dao.findRackMachines(reload(dao, rack2_2)).size(), 0); }