@Test
        public void shouldOrder() {
            if (a == NaN || b == NaN) {
                // test all the NaN combos
                final List<Pair> args = new ArrayList<>();
                if (a == NaN && b == NaN) {
                    args.add(new Pair(Double.NaN, Double.NaN));
                    args.add(new Pair(Double.NaN, Float.NaN));
                    args.add(new Pair(Float.NaN, Double.NaN));
                    args.add(new Pair(Float.NaN, Float.NaN));
                } else if (a == NaN) {
                    args.add(new Pair(Double.NaN, b));
                    args.add(new Pair(Float.NaN, b));
                } else {
                    args.add(new Pair(a, Double.NaN));
                    args.add(new Pair(a, Float.NaN));
                }
                for (final Pair arg : args) {
                    assertEquals(expected.longValue(), order.compare(arg.getValue0(), arg.getValue1()));
                }
            } else {
                assertEquals(expected.longValue(), order.compare(a, b));
            }
        }
@author Mike Personick (http://github.com/mikepersonick)
gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/OrderTest.java