WalPosition implements IncrementalPosition { @Override public int compareTo(final Position position) { if (null == position) { return 1; } long o1 = logSequenceNumber.asLong(); long o2 = ((WalPosition) position).logSequenceNumber.asLong(); return Long.compare(o1, o2); }  @Override int compareTo(final Position position); @Override JsonElement toJson();  }
@Test public void assertCompareTo() { WalPosition walPosition = new WalPosition(LogSequenceNumber.valueOf(100L)); assertThat(walPosition.compareTo(null), is(1)); assertThat(walPosition.compareTo(new WalPosition(LogSequenceNumber.valueOf(100L))), is(0)); }