RowKeyWrapper implements Comparable<RowKeyWrapper> { @Override public int compareTo(RowKeyWrapper o) { return compare(key, o.key); } RowKeyWrapper(ByteString key); ByteString getKey(); @Override int compareTo(RowKeyWrapper o);  }
@Test public void testCompareRowKeyWrappers() { assertEquals(0, new RowKeyWrapper(null).compareTo(new RowKeyWrapper(null))); RowKeyWrapper rowKey = new RowKeyWrapper(ByteString.copyFromUtf8("a")); assertEquals(-1, rowKey.compareTo(new RowKeyWrapper(null))); assertEquals(0, rowKey.compareTo(new RowKeyWrapper(ByteString.copyFromUtf8("a")))); assertEquals(1, new RowKeyWrapper(null).compareTo(rowKey)); RowKeyWrapper anotherRowKey = new RowKeyWrapper(ByteString.copyFromUtf8("b")); assertEquals("a".compareTo("b"), rowKey.compareTo(anotherRowKey)); assertEquals("b".compareTo("a"), anotherRowKey.compareTo(rowKey)); }