@Test
    public void testMinMaxCompare() {

        final List<Number> zeros = Arrays.asList((byte) 0, (short) 0, 0, 0L, 0F, 0D, BigInteger.ZERO, BigDecimal.ZERO);
        final List<Number> ones = Arrays.asList((byte) 1, (short) 1, 1, 1L, 1F, 1D, BigInteger.ONE, BigDecimal.ONE);

        for (Number zero : zeros) {
            for (Number one : ones) {
                assertEquals(0, min(zero, one).intValue());
                assertEquals(0, min(one, zero).intValue());
                assertEquals(1, max(zero, one).intValue());
                assertEquals(1, max(one, zero).intValue());
                assertTrue(compare(zero, one) < 0);
                assertTrue(compare(one, zero) > 0);
                assertTrue(compare(zero, zero) == 0);
                assertTrue(compare(one, one) == 0);
            }
        }

        for (Number one : ones) {
            assertEquals(1, min(null, one).intValue());
            assertEquals(1, min(one, null).intValue());
            assertEquals(1, max(null, one).intValue());
            assertEquals(1, max(one, null).intValue());

            assertEquals(-1, compare(null, one).intValue());
            assertEquals(1, compare(one, null).intValue());
        }
    }
@author Daniel Kuppitz (http://gremlin.guru)
gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/util/NumberHelperTest.java