@Test
    @FeatureRequirement(featureClass = GraphFeatures.class, feature = GraphFeatures.FEATURE_ORDERABILITY_SEMANTICS)
    public void testCompareNull() {
        // null vs. null
        // P.eq
        checkHasNext(true, g.inject(null).is(P.eq(null)));
        // P.neq
        checkHasNext(false, g.inject(null).is(P.neq(null)));
        // P.lt
        checkHasNext(false, g.inject(null).is(P.lt(null)));
        // P.lte
        checkHasNext(true, g.inject(null).is(P.lte(null)));
        // P.gt
        checkHasNext(false, g.inject(null).is(P.gt(null)));
        // P.gte
        checkHasNext(true, g.inject(null).is(P.gte(null)));

        // non-null vs. null
        // P.eq
        checkHasNext(false, g.inject(1.0d).is(P.eq(null)));
        checkHasNext(false, g.inject(null).is(P.eq(1.0d)));
        // P.neq
        checkHasNext(true, g.inject(1.0d).is(P.neq(null)));
        checkHasNext(true, g.inject(null).is(P.neq(1.0d)));
        // P.lt
        checkHasNext(false, g.inject(1.0d).is(P.lt(null)));
        checkHasNext(false, g.inject(null).is(P.lt(1.0d)));
        // P.lte
        checkHasNext(false, g.inject(1.0d).is(P.lte(null)));
        checkHasNext(false, g.inject(null).is(P.lte(1.0d)));
        // P.gt
        checkHasNext(false, g.inject(1.0d).is(P.gt(null)));
        checkHasNext(false, g.inject(null).is(P.gt(1.0d)));
        // P.gte
        checkHasNext(false, g.inject(1.0d).is(P.gte(null)));
        checkHasNext(false, g.inject(null).is(P.gte(1.0d)));

        // NaN vs null
        // P.eq
        checkHasNext(false, g.inject(null).is(P.eq(Double.NaN)));
        checkHasNext(false, g.inject(Double.NaN).is(P.eq(null)));
        // P.neq
        checkHasNext(true, g.inject(null).is(P.neq(Double.NaN)));
        checkHasNext(true, g.inject(Double.NaN).is(P.neq(null)));
        // P.lt
        checkHasNext(false, g.inject(null).is(P.lt(Double.NaN)));
        checkHasNext(false, g.inject(Double.NaN).is(P.lt(null)));
        // P.lte
        checkHasNext(false, g.inject(null).is(P.lte(Double.NaN)));
        checkHasNext(false, g.inject(Double.NaN).is(P.lte(null)));
        // P.gt
        checkHasNext(false, g.inject(null).is(P.gt(Double.NaN)));
        checkHasNext(false, g.inject(Double.NaN).is(P.gt(null)));
        // P.gte
        checkHasNext(false, g.inject(null).is(P.gte(Double.NaN)));
        checkHasNext(false, g.inject(Double.NaN).is(P.gte(null)));
    }
Null comparisons. Null is considered to be a distinct type, thus will produce ERROR for comparison against
non-null, just like any cross-type comparison. Null is == null and is != to any non-null (except for NaN, which
is always UNDEF/ERROR).
gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/TernaryBooleanLogicsTest.java