### Question:
VirtualMachineTemplateDAO extends
    DefaultDAOBase<Integer, VirtualMachineTemplate> { public List<VirtualMachineTemplate> findByEnterprise(final Enterprise enterprise) { Criteria criteria = createCriteria(sameEnterpriseOrShared(enterprise)); criteria.addOrder(Order.asc(VirtualMachine.NAME_PROPERTY)); return getResultList(criteria); } VirtualMachineTemplateDAO();  VirtualMachineTemplateDAO(final EntityManager entityManager); List<VirtualMachineTemplate> findByEnterprise(final Enterprise enterprise); List<VirtualMachineTemplate> findByEnterpriseAndRepository(final Enterprise enterprise,
        final com.abiquo.server.core.infrastructure.Repository repository); List<VirtualMachineTemplate> findImportedByEnterprise(final Enterprise enterprise); List<VirtualMachineTemplate> findBy(final Enterprise enterprise,
        final com.abiquo.server.core.infrastructure.Repository repository, final Category category,
        final HypervisorType hypervisor); List<VirtualMachineTemplate> findBy(final Category category); List<VirtualMachineTemplate> findImportedBy(final Enterprise enterprise,
        final Category category, final HypervisorType hypervisor); VirtualMachineTemplate findByName(final String name); VirtualMachineTemplate findByPath(final Enterprise enterprise,
        final com.abiquo.server.core.infrastructure.Repository repository, final String path); boolean existWithSamePath(final Enterprise enterprise,
        final com.abiquo.server.core.infrastructure.Repository repository, final String path); List<VirtualMachineTemplate> findStatefuls(); List<VirtualMachineTemplate> findStatefulsByDatacenter(final Datacenter datacenter,
        final StatefulInclusion stateful); List<VirtualMachineTemplate> findStatefulsByDatacenter(final Datacenter datacenter,
        final VirtualDatacenter vdc, final StatefulInclusion stateful); List<VirtualMachineTemplate> findStatefulsByCategoryAndDatacenter(
        final Category category, final Datacenter datacenter, final StatefulInclusion stateful); List<VirtualMachineTemplate> findStatefulsByCategoryAndDatacenter(
        final Category category, final Datacenter datacenter, final VirtualDatacenter vdc,
        final StatefulInclusion stateful); List<VirtualMachineTemplate> findByMaster(final VirtualMachineTemplate master); boolean isMaster(final VirtualMachineTemplate vmtemplate); List<String> findIconsByEnterprise(final Integer enterpriseId);  }### Answer:
@Test public void testFindVirtualMachineTemplatesByEnterprise() { Enterprise ent = enterpriseGenerator.createUniqueInstance(); VirtualMachineTemplate vi = eg().createInstance(ent); List<Object> entitiesToPersist = new ArrayList<Object>(); eg().addAuxiliaryEntitiesToPersist(vi, entitiesToPersist); persistAll(ds(), entitiesToPersist, vi); VirtualMachineTemplateDAO dao = createDaoForRollbackTransaction(); List<VirtualMachineTemplate> templates = dao.findByEnterprise(ent); assertEquals(templates.size(), 1); }