// keys that aggregate
nkv(tm1, 1, 1, 1, 1, false, nal(1l, 2l), encoder);
nkv(tm1, 1, 1, 1, 2, false, nal(3l, 4l, 5l), encoder);
nkv(tm1, 1, 1, 1, 3, false, nal(), encoder);
Combiner ai = new SummingArrayCombiner();
IteratorSetting is = new IteratorSetting(1, SummingArrayCombiner.class);
SummingArrayCombiner.setEncodingType(is, type);
Combiner.setColumns(is, Collections.singletonList(new IteratorSetting.Column("cf001")));
ai.init(new SortedMapIterator(tm1), is.getOptions(), null);
ai.seek(new Range(), EMPTY_COL_FAMS, false);
assertTrue(ai.hasTop());
assertEquals(nk(1, 1, 1, 3), ai.getTopKey());
assertBytesEqual(encoder.encode(nal(4l, 6l, 5l)), ai.getTopValue().get());
ai.next();
assertFalse(ai.hasTop());
is.clearOptions();
SummingArrayCombiner.setEncodingType(is, encoderClass);
Combiner.setColumns(is, Collections.singletonList(new IteratorSetting.Column("cf001")));
ai.init(new SortedMapIterator(tm1), is.getOptions(), null);
ai.seek(new Range(), EMPTY_COL_FAMS, false);
assertTrue(ai.hasTop());
assertEquals(nk(1, 1, 1, 3), ai.getTopKey());
assertBytesEqual(encoder.encode(nal(4l, 6l, 5l)), ai.getTopValue().get());
ai.next();
assertFalse(ai.hasTop());
is.clearOptions();
SummingArrayCombiner.setEncodingType(is, encoderClass.getName());
Combiner.setColumns(is, Collections.singletonList(new IteratorSetting.Column("cf001")));
ai.init(new SortedMapIterator(tm1), is.getOptions(), null);
ai.seek(new Range(), EMPTY_COL_FAMS, false);
assertTrue(ai.hasTop());
assertEquals(nk(1, 1, 1, 3), ai.getTopKey());
assertBytesEqual(encoder.encode(nal(4l, 6l, 5l)), ai.getTopValue().get());
ai.next();
assertFalse(ai.hasTop());
is.clearOptions();
SummingArrayCombiner.setEncodingType(is, SummingCombiner.VAR_LEN_ENCODER.getClass().getName());
Combiner.setColumns(is, Collections.singletonList(new IteratorSetting.Column("cf001")));
try {
ai.init(new SortedMapIterator(tm1), is.getOptions(), null);
Assert.fail();
} catch (IllegalArgumentException e) {}
is.clearOptions();
SummingArrayCombiner.setEncodingType(is, BadEncoder.class.getName());
Combiner.setColumns(is, Collections.singletonList(new IteratorSetting.Column("cf001")));
try {
ai.init(new SortedMapIterator(tm1), is.getOptions(), null);
Assert.fail();
} catch (IllegalArgumentException e) {}
}