@Test
    public void shouldReturnHighestCommonNumberClass() {
        for (final Quartet<Number, Number, Class<? extends Number>, Class<? extends Number>> q : COMMON_NUMBER_CLASSES) {
            assertEquals(q.getValue2(), getHighestCommonNumberClass(q.getValue0(), q.getValue1()));
            assertEquals(q.getValue2(), getHighestCommonNumberClass(q.getValue1(), q.getValue0()));
            assertEquals(q.getValue3(), getHighestCommonNumberClass(true, q.getValue0(), q.getValue1()));
            assertEquals(q.getValue3(), getHighestCommonNumberClass(true, q.getValue1(), q.getValue0()));
        }
        // Double.NaN and null are not numbers and thus should be ignored
        for (final Number number : EACH_NUMBER_TYPE) {
            assertEquals(number.getClass(), getHighestCommonNumberClass(number, Double.NaN));
            assertEquals(number.getClass(), getHighestCommonNumberClass(Double.NaN, number));
            assertEquals(number.getClass(), getHighestCommonNumberClass(number, null));
            assertEquals(number.getClass(), getHighestCommonNumberClass(null, number));
        }
    }
@author Daniel Kuppitz (http://gremlin.guru)
gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/util/NumberHelperTest.java