### Question:
AnyValueComparator implements Comparator<AnyValue>, TernaryComparator<AnyValue> { @Override public int compare( AnyValue v1, AnyValue v2 ) { return cmp( v1, v2, false ).value(); } AnyValueComparator( ValueComparator valueComparator, Comparator<VirtualValueGroup> virtualValueGroupComparator ); @Override int compare( AnyValue v1, AnyValue v2 ); @Override Comparison ternaryCompare( AnyValue v1, AnyValue v2 ); @Override boolean equals( Object obj ); @Override int hashCode();  }### Answer:
@Test void shouldOrderValuesCorrectly() { List<AnyValue> values = Arrays.stream( objs ) .map( VirtualValueTestUtil::toAnyValue ) .collect( Collectors.toList() ); for ( int i = 0; i < values.size(); i++ ) { for ( int j = 0; j < values.size(); j++ ) { AnyValue left = values.get( i ); AnyValue right = values.get( j ); int cmpPos = signum( i - j ); int cmpVal = signum( compare( comparator, left, right ) ); assertEquals( cmpPos, cmpVal, format( "Comparing %s against %s does not agree with their positions in the sorted list (%d and %d)", left, right, i, j ) ); } } }