@Test
public void testNewResultSet_Size() throws Exception{

    // Mocks
    ConnectionManager connectionManager = mock(ConnectionManager.class);
    Connection connection = mock(Connection.class);
    PreparedStatement preparedStatement = mock(PreparedStatement.class);
    java.sql.ResultSet resultSet = mock(java.sql.ResultSet.class);
    // Behaviour
    when(connectionManager.getConnection(any(SQLiteIndex.class), anyQueryOptions())).thenReturn(connection);
    when(connection.prepareStatement("SELECT COUNT(1) AS countDistinct FROM (SELECT objectKey FROM " + TABLE_NAME + " WHERE value = ? GROUP BY objectKey);")).thenReturn(preparedStatement);
    when(preparedStatement.executeQuery()).thenReturn(resultSet);
    when(resultSet.getStatement()).thenReturn(preparedStatement);
    when(resultSet.next()).thenReturn(true);
    when(resultSet.getInt(1)).thenReturn(3);
    ResultSet<Car> carsWithAbs = new SQLiteIndex<String, Car, Integer>(
            Car.FEATURES,
            OBJECT_TO_ID,
            ID_TO_OBJECT,
            "")
            .retrieve(equal(Car.FEATURES, "abs"), createQueryOptions(connectionManager));
    assertNotNull(carsWithAbs);
    int size = carsWithAbs.size();
    assertEquals(3, size);
    verify(connection, times(0)).close();
}