### Question:
DatastoreDAO extends DefaultDAOBase<Integer, Datastore> { public boolean existsAnyOtherWithDirectory(final Datastore entity, final String directory) { assert entity != null; assert isManaged(entity); assert !StringUtils.isEmpty(directory); return this.existsAnyOtherByCriterions(entity, equalDirectory(directory)); } DatastoreDAO();  DatastoreDAO(final EntityManager entityManager); List<Datastore> findMachineDatastores(final Machine machine); List<Datastore> findShares(final Datastore datastore); Datastore findDatastore(final String uuid, final Machine machine); boolean existsAnyWithName(final String name); boolean existsAnyOtherWithName(final Datastore entity, final String name); boolean existsAnyWithDirectory(final String directory); boolean existsAnyOtherWithDirectory(final Datastore entity, final String directory);  }### Answer:
@Test public void test_existsAnyOtherWithDirectory() { Datastore entity = createUniqueEntity(); entity.setDirectory("A property"); Datastore entity2 = createUniqueEntity(); entity2.setDirectory("Property 2"); ds().persistAll(entity, entity2); DatastoreDAO dao = createDaoForRollbackTransaction(); entity = dao.findById(entity.getId()); Assert.assertFalse(dao.existsAnyOtherWithDirectory(entity, "INEXISTENT_PROPERTY")); Assert.assertFalse(dao.existsAnyOtherWithDirectory(entity, "A property")); Assert.assertTrue(dao.existsAnyOtherWithDirectory(entity, "Property 2")); }