### Question:
RunlistElementDAO extends DefaultDAOBase<Integer, RunlistElement> { public List<RunlistElement> findByVirtualMachine(final VirtualMachine virtualmachine) { Criteria criteria = createCriteria(sameVirtualMachine(virtualmachine)); criteria.addOrder(Order.asc(RunlistElement.PRIORITY_PROPERTY)); return getResultList(criteria); } RunlistElementDAO();  RunlistElementDAO(final EntityManager entityManager); List<RunlistElement> findByVirtualMachine(final VirtualMachine virtualmachine); void clearVirtualMachineRunlist(final VirtualMachine virtualmachine);  }### Answer:
@Test public void testFindByVirtualMachine() { VirtualMachine vm = vmGenerator.createUniqueInstance(); RunlistElement element = eg().createInstance(vm); List<Object> entitiesToPersist = new ArrayList<Object>(); eg().addAuxiliaryEntitiesToPersist(element, entitiesToPersist); persistAll(ds(), entitiesToPersist, element); RunlistElementDAO dao = createDaoForRollbackTransaction(); List<RunlistElement> elements = dao.findByVirtualMachine(vm); assertEquals(elements.size(), 1); }