EventHubSystemAdmin implements SystemAdmin { @Override public Integer offsetComparator(String offset1, String offset2) { return compareOffsets(offset1, offset2); } EventHubSystemAdmin(String systemName, EventHubConfig eventHubConfig,
                             EventHubClientManagerFactory eventHubClientManagerFactory); @Override void stop(); @Override Map<SystemStreamPartition, String> getOffsetsAfter(Map<SystemStreamPartition, String> offsets); @Override Map<String, SystemStreamMetadata> getSystemStreamMetadata(Set<String> streamNames); @Override String resolveStartpointToOffset(SystemStreamPartition systemStreamPartition, Startpoint startpoint); static Integer compareOffsets(String offset1, String offset2); @Override Integer offsetComparator(String offset1, String offset2);  }
@Test public void testOffsetComparison() { EventHubSystemFactory eventHubSystemFactory = new EventHubSystemFactory(); EventHubSystemAdmin eventHubSystemAdmin = (EventHubSystemAdmin) eventHubSystemFactory.getAdmin(SYSTEM_NAME, MockEventHubConfigFactory.getEventHubConfig(EventHubSystemProducer.PartitioningMethod.EVENT_HUB_HASHING)); Assert.assertEquals(-1, eventHubSystemAdmin.offsetComparator("100", "200").intValue()); Assert.assertEquals(0, eventHubSystemAdmin.offsetComparator("150", "150").intValue()); Assert.assertEquals(1, eventHubSystemAdmin.offsetComparator("200", "100").intValue()); Assert.assertNull(eventHubSystemAdmin.offsetComparator("1", "a")); Assert.assertNull(eventHubSystemAdmin.offsetComparator("100", EventHubSystemConsumer.END_OF_STREAM)); Assert.assertNull(eventHubSystemAdmin.offsetComparator(EventHubSystemConsumer.END_OF_STREAM, EventHubSystemConsumer.END_OF_STREAM)); }