GroupPartitioner { public PartitionKey getIthPartitionKey(final int i) { return splitPoints.get(i); } GroupPartitioner(final String group, final List<PartitionKey> splitPoints); String getGroup(); int getPartitionId(final PartitionKey partitionKey); List<Integer> getPartitionIds(final Object[] partialKey); PartitionKey getIthPartitionKey(final int i); List<PartitionKey> getSplitPoints(); List<Partition> getPartitions(); @Override String toString(); @Override boolean equals(final Object obj); @Override int hashCode();  }
@Test public void testGetIthPartitionKey() { final PartitionKey key1 = new PartitionKey(new Object[]{1L, "B"}); final PartitionKey key2 = new PartitionKey(new Object[]{5L, "A"}); final PartitionKey key3 = new PartitionKey(new Object[]{100L, "Z"}); final List<PartitionKey> splitPoints = new ArrayList<>(Arrays.asList(key1, key2, key3)); final GroupPartitioner partitioner = new GroupPartitioner("GROUP", splitPoints); final PartitionKey zeroth = partitioner.getIthPartitionKey(0); final PartitionKey first = partitioner.getIthPartitionKey(1); final PartitionKey second = partitioner.getIthPartitionKey(2); assertEquals(key1, zeroth); assertEquals(key2, first); assertEquals(key3, second); }