IndexRepositoryImpl extends AbstractCRUDRepository<Index> implements IndexRepository { @Override public boolean exists(Identifier identifier) { if (identifier == null || identifier.isEmpty()) { return false; } BoundStatement bs = new BoundStatement(existStmt); bindIdentifier(bs, identifier); return (getSession().execute(bs).one().getLong(0) > 0); } IndexRepositoryImpl(Session session); @Override boolean exists(Identifier identifier); @Override Index read(Identifier identifier); @Override Index create(Index entity); @Override void markActive(Index entity); @Override Index update(Index entity); @Override void delete(Identifier id); @Override void delete(Index entity); @Override List<Index> readAll(Identifier id); @Override List<Index> readAll(); @Override List<Index> readAllCached(Identifier id); @Override long countAll(Identifier id);  }
@Test public void testExists() { System.out.println("exists"); Index testIndex = Fixtures.createTestIndexOneField(); Identifier identifier = testIndex.getId(); IndexRepositoryImpl instance = new IndexRepositoryImpl(f.getSession()); boolean result = instance.exists(identifier); assertEquals(false, result); f.insertIndex(testIndex); result = instance.exists(identifier); assertEquals(true, result); }