### Question:
NodeVirtualImageDAO extends DefaultDAOBase<Integer, NodeVirtualImage> { public List<NodeVirtualImage> findByVirtualImage(final VirtualMachineTemplate virtualImage) { Criteria criteria = sameVirtualImage(virtualImage); return getResultList(criteria); } NodeVirtualImageDAO();  NodeVirtualImageDAO(final EntityManager entityManager); VirtualAppliance findVirtualAppliance(final VirtualMachine vmachine); NodeVirtualImage findByVirtualMachine(final VirtualMachine vmachine); List<NodeVirtualImage> findByEnterprise(final Enterprise enterprise); List<NodeVirtualImage> findByVirtualImage(final VirtualMachineTemplate virtualImage); List<NodeVirtualImage> findByVirtualAppliance(final VirtualAppliance virtualAppliance); List<Integer> findVirtualMachineIdsByVirtualAppliance(
        final VirtualAppliance virtualAppliance);  }### Answer:
@Test public void testFindByVirtualImage() { NodeVirtualImage nvi1 = eg().createInstance(vapp, vmachine); NodeVirtualImage nvi2 = eg().createInstance(vapp, vmachine); NodeVirtualImage nvi3 = eg().createInstance(vapp, vmachine); ds().persistAll(nvi1, nvi2, nvi3); NodeVirtualImageDAO nodeVirtualImageDAO = createDaoForRollbackTransaction(); List<NodeVirtualImage> result = nodeVirtualImageDAO.findByVirtualImage(vmachine.getVirtualMachineTemplate()); assertNotNull(result); assertEquals(result.size(), 3); }