IndexRepositoryImpl extends AbstractCRUDRepository<Index> implements IndexRepository { @Override public long countAll(Identifier id) { BoundStatement bs = new BoundStatement(readAllCountStmt); bs.bind(id.getDatabaseName(), id.getTableName()); return (getSession().execute(bs).one().getLong(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 testCountAll() { System.out.println("countAll"); Index testIndex = Fixtures.createTestIndexOneField(); Index testIndex2 = Fixtures.createTestIndexTwoField(); f.insertIndex(testIndex); f.insertIndex(testIndex2); String database = testIndex.getDatabaseName(); String table = testIndex.getTableName(); IndexRepository instance = new IndexRepositoryImpl(f.getSession()); long expResult = 2L; long result = instance.countAll(new Identifier(database, table)); assertEquals(expResult, result); }