ListenerRepo { public List<Listener> findByTableName(String tableName, Connection connection) { try ( PreparedStatement stmt = connection.prepareStatement(FIND_BY_TABLE_NAME_QUERY) ) { stmt.setObject(1, tableName); ResultSet rs = stmt.executeQuery(); List<Listener> result = newArrayList(); while (rs.next()) { result.add(extractListener(rs)); } return result; } catch (SQLException e) { throw new DataAccessException("Something went wrong while listing listeners for table: " + tableName, e); } }  Listener insert(Listener listener, Connection connection); void refreshLastCheck(Listener listener, Connection connection); void remove(Listener listener, Connection connection); void update(Listener listener, Connection connection); Listener findById(long id, Connection connection); List<Listener> findByTableName(String tableName, Connection connection);  }
@Test(groups = INTEGRATION) public void testCanGetListenersByTableNameCorrectlyWhenNoListenerExists() { assertEquals(repo.findByTableName(TEST_TABLE_NAME, connection).size(), 0); }