@Test
public void testGetStatisticsForDistinctKeysDescending(){

    ConnectionManager connectionManager = temporaryInMemoryDatabase.getConnectionManager(true);
    SQLiteIndex<String, Car, Integer> offHeapIndex = SQLiteIndex.onAttribute(
            Car.MANUFACTURER,
            Car.CAR_ID,
            new SimpleAttribute<Integer, Car>() {
                @Override
                public Car getValue(Integer carId, QueryOptions queryOptions) {
                    return CarFactory.createCar(carId);
                }
            }
    );
    offHeapIndex.addAll(createObjectSetOfCars(20), createQueryOptions(connectionManager));
    Set<KeyStatistics<String>> keyStatistics = setOf(offHeapIndex.getStatisticsForDistinctKeysDescending(createQueryOptions(connectionManager)));
    Assert.assertEquals(setOf(
                    new KeyStatistics<String>("Toyota", 6),
                    new KeyStatistics<String>("Honda", 6),
                    new KeyStatistics<String>("Ford", 6),
                    new KeyStatistics<String>("BMW", 2)
            ),
            keyStatistics);
}