@Test
    public void shouldTest() {
        if (expected instanceof Class)
            exceptionRule.expect((Class) expected);

        if (first == NaN || second == NaN) {
            // test all the NaN combos
            final List<Pair> args = new ArrayList<>();
            if (first == NaN && second == 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 (first == NaN) {
                args.add(new Pair(Double.NaN, second));
                args.add(new Pair(Float.NaN, second));
            } else {
                args.add(new Pair(first, Double.NaN));
                args.add(new Pair(first, Float.NaN));
            }
            for (Pair arg : args) {
                assertEquals(expected, compare.test(arg.getValue0(), arg.getValue1()));
            }
        } else {
            assertEquals(expected, compare.test(first, second));
        }
    }
@author Stephen Mallette (http://stephen.genoprime.com)
@author Matt Frantz (http://github.com/mhfrantz)
gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/CompareTest.java