@Test
public void testChronologize() {

    Map<Long, Set<Value>> map = Maps.newLinkedHashMap();
    Set<Value> set = Sets.newLinkedHashSet();
    Set<Value> allValues = Sets.newLinkedHashSet();
    long recordId = TestData.getLong();
    PrimaryKey primaryKey = PrimaryKey.wrap(recordId);
    TableRecord record = TableRecord.create(primaryKey);
    for (long i = 30; i <= 35; i++) {
        Value value = null;
        while (value == null || !allValues.add(value)) {
            value = TestData.getValue();
        }
        record.append(
                getRevision(primaryKey, Text.wrapCached("name"), value));
        set.add(value);
    }
    long start = Time.now();
    for (long i = 36; i <= 45; i++) {
        set = Sets.newLinkedHashSet(set);
        Value value = null;
        while (value == null || !allValues.add(value)) {
            value = TestData.getValue();
        }
        record.append(
                getRevision(primaryKey, Text.wrapCached("name"), value));
        set.add(value);
        map.put(i, set);
    }
    long end = Time.now();
    for (long i = 51; i <= 60; i++) {
        Value value = null;
        while (value == null || !allValues.add(value)) {
            value = TestData.getValue();
        }
        record.append(
                getRevision(primaryKey, Text.wrapCached("name"), value));
    }
    Map<Long, Set<Value>> newMap = record
            .chronologize(Text.wrapCached("name"), start, end);
    long key = 36;
    for (Entry<Long, Set<Value>> e : newMap.entrySet()) {
        Set<Value> result = e.getValue();
        Assert.assertEquals(map.get(key), result);
        key++;
    }
}