### Question:
HypervisorDAO extends DefaultDAOBase<Integer, Hypervisor> { public boolean existsAnyWithIpAndDatacenter(final String ip, final Integer datacenterId) { Query query = getSession().createQuery(QUERY_SAME_IP_DATACENTER); query.setParameter("ip", ip); query.setParameter("datacenterId", datacenterId); return !query.list().isEmpty(); } HypervisorDAO();  HypervisorDAO(final EntityManager entityManager); boolean existsAnyWithIp(final String ip); boolean existsAnyWithIpService(final String ip); List<Integer> getUsedPorts(final int idHyper); boolean existsAnyWithIpAndDatacenter(final String ip, final Integer datacenterId); boolean existsAnyWithIpServiceAndDatacenter(final String ip, final Integer datacenterId); Collection<HypervisorType> findTypesfromDatacenter(final Integer datacenterId);  }### Answer:
@Test public void existAnyWithIpSameDatacenter() { Hypervisor hypervisor = eg().createUniqueInstance(); ds().persistAll(hypervisor.getMachine().getDatacenter(), hypervisor.getMachine().getRack(), hypervisor.getMachine(), hypervisor); HypervisorDAO dao = createDaoForRollbackTransaction(); Assert.assertTrue(dao.existsAnyWithIpAndDatacenter(hypervisor.getIp(), hypervisor .getMachine().getDatacenter().getId())); }