### Question:
CategoryDAO extends DefaultDAOBase<Integer, Category> { public boolean existsAnyWithName(final String name) { return existsAnyByCriterions(equalsName(name)); } CategoryDAO();  CategoryDAO(final EntityManager entityManager); Category findDefault(); ArrayList<Category> findGlobalCategories(); ArrayList<Category> findLocalCategories(final Integer idEnterprise); Category findByNameAndEnterprise(final String categoryName, final Enterprise enterprise); boolean existsAnyWithName(final String name); boolean existsAnyOtherWithName(final Category category, final String name); static final String BY_NAME_AND_ENTERPRISE; static final String BY_NAME_AND_NO_ENTERPRISE; static final String BY_GLOBAL; static final String BY_LOCAL; }### Answer:
@Test public void testExistCategoryWithSameName() { Category category = eg().createUniqueInstance(); ds().persistAll(category); CategoryDAO dao = createDaoForRollbackTransaction(); boolean result = dao.existsAnyWithName(category.getName()); assertTrue(result); result = dao.existsAnyWithName(category.getName() + "UNEXISTING"); assertFalse(result); }