@Test
public void testGetCountOfDistinctKeys() {

    IndexedCollection<Car> cars = createIndexedCollectionOfCars(20); // the 20 cars will contain 4 distinct manufacturers
    // Add a sorted index on Car.MANUFACTURER (a NavigableIndex)...
    cars.addIndex(NavigableIndex.onAttribute(Car.MANUFACTURER));
    MetadataEngine<Car> metadataEngine = cars.getMetadataEngine();
    // Count the distinct manufacturers...
    SortedAttributeMetadata<String, Car> sortedAttributeMetadata = metadataEngine.getSortedAttributeMetadata(Car.MANUFACTURER);
    assertEquals(Integer.valueOf(4), sortedAttributeMetadata.getCountOfDistinctKeys());
}