### Question:
ZonedDateTimeIndexKey extends NativeIndexSingleValueKey<ZonedDateTimeIndexKey> { @Override public int compareValueTo( ZonedDateTimeIndexKey other ) { int compare = Long.compare( epochSecondUTC, other.epochSecondUTC ); if ( compare == 0 ) { compare = Integer.compare( nanoOfSecond, other.nanoOfSecond ); if ( compare == 0 && TimeZones.validZoneOffset( zoneOffsetSeconds ) && TimeZones.validZoneOffset( other.zoneOffsetSeconds ) ) { if ( zoneOffsetSeconds != other.zoneOffsetSeconds || zoneId != other.zoneId ) { compare = Values.COMPARATOR.compare( asValue(), other.asValue() ); } } } return compare; }  @Override Value asValue(); @Override void initValueAsLowest( ValueGroup valueGroups ); @Override void initValueAsHighest( ValueGroup valueGroups ); @Override int compareValueTo( ZonedDateTimeIndexKey other ); @Override String toString(); @Override void writeDateTime( long epochSecondUTC, int nano, int offsetSeconds ); @Override void writeDateTime( long epochSecondUTC, int nano, String zoneId );  }### Answer:
@Test public void compareToSameAsValue() { Value[] values = {DateTimeValue.datetime( 9999, 100, ZoneId.of( "+18:00" ) ), DateTimeValue.datetime( 10000, 100, ZoneId.of( "-18:00" ) ), DateTimeValue.datetime( 10000, 100, ZoneOffset.of( "-17:59:59" ) ), DateTimeValue.datetime( 10000, 100, ZoneId.of( "UTC" ) ), DateTimeValue.datetime( 10000, 100, ZoneId.of( "+01:00" ) ), DateTimeValue.datetime( 10000, 100, ZoneId.of( "Europe/Stockholm" ) ), DateTimeValue.datetime( 10000, 100, ZoneId.of( "+03:00" ) ), DateTimeValue.datetime( 10000, 101, ZoneId.of( "-18:00" ) )}; ZonedDateTimeIndexKey keyI = new ZonedDateTimeIndexKey(); ZonedDateTimeIndexKey keyJ = new ZonedDateTimeIndexKey(); int len = values.length; for ( int i = 0; i < len; i++ ) { for ( int j = 0; j < len; j++ ) { Value vi = values[i]; Value vj = values[j]; vi.writeTo( keyI ); vj.writeTo( keyJ ); int expected = Integer.signum( Values.COMPARATOR.compare( vi, vj ) ); assertEquals( format( "comparing %s and %s", vi, vj ), expected, Integer.signum( i - j ) ); assertEquals( format( "comparing %s and %s", vi, vj ), expected, Integer.signum( keyI.compareValueTo( keyJ ) ) ); } } }