InMemorySystemAdmin implements SystemAdmin { @Override public Integer offsetComparator(String offset1, String offset2) { if (offset1 == null && offset2 == null) { return 0; } else if (offset1 == null) { return -1; } else if (offset2 == null) { return 1; } else { return Integer.compare(Integer.parseInt(offset1), Integer.parseInt(offset2)); } } InMemorySystemAdmin(String systemName, InMemoryManager manager); @Override void start(); @Override void stop(); @Override Map<SystemStreamPartition, String> getOffsetsAfter(Map<SystemStreamPartition, String> offsets); @Override Map<String, SystemStreamMetadata> getSystemStreamMetadata(Set<String> streamNames); @Override Integer offsetComparator(String offset1, String offset2); @Override boolean createStream(StreamSpec streamSpec); @Override void validateStream(StreamSpec streamSpec); @Override boolean clearStream(StreamSpec streamSpec);  }
@Test public void testOffsetComparator() { assertEquals(0, inMemorySystemAdmin.offsetComparator(null, null).intValue()); assertEquals(-1, inMemorySystemAdmin.offsetComparator(null, "0").intValue()); assertEquals(1, inMemorySystemAdmin.offsetComparator("0", null).intValue()); assertEquals(-1, inMemorySystemAdmin.offsetComparator("0", "1").intValue()); assertEquals(0, inMemorySystemAdmin.offsetComparator("0", "0").intValue()); assertEquals(1, inMemorySystemAdmin.offsetComparator("1", "0").intValue()); }