### Question:
LogPosition implements Comparable<LogPosition> { @Override public int compareTo( LogPosition o ) { if ( logVersion != o.logVersion ) { return Long.compare( logVersion, o.logVersion ); } return Long.compare( byteOffset, o.byteOffset ); } LogPosition( long logVersion, long byteOffset ); static LogPosition start( long logVersion ); long getLogVersion(); long getByteOffset(); @Override String toString(); @Override boolean equals( Object o ); @Override int hashCode(); @Override int compareTo( LogPosition o ); static final LogPosition UNSPECIFIED; }### Answer:
@SuppressWarnings( {"EqualsWithItself", "SelfComparison"} ) @Test public void logPositionComparison() { assertEquals( 1, logPositionA.compareTo( logPositionB ) ); assertEquals( -1, logPositionB.compareTo( logPositionA ) ); assertEquals( 0, logPositionA.compareTo( logPositionA ) ); assertEquals( 0, logPositionB.compareTo( logPositionB ) ); }