public static boolean equals(FlatRecordTraversalObjectNode left, FlatRecordTraversalObjectNode right) {
        if (left == null && right == null) {
            return true;
        }
        if (left == null || right == null) {
            return false;
        }
        if (!left.getSchema().getName().equals(right.getSchema().getName())) {
            return false;
        }
        extractCommonObjectSchema(left, right);

        return compare(left, right);
    }
@Test
    public void shouldUseExactFlagToConsiderExtraFieldsInEquality_usingReferences() {
        TypeState1 typeState1 = new TypeState1();
        typeState1.longField = 1L;
        typeState1.stringField = "A";
        typeState1.doubleField = 1.0;
        typeState1.basicIntField = 1;
        typeState1.basicIntFieldOnlyInTypeState1 = 1; // This field being set should make the records unequal.

        writer1.reset();
        mapper1.writeFlat(typeState1, writer1);
        FlatRecord rec1 = writer1.generateFlatRecord();

        TypeState2 typeState2 = new TypeState2();
        typeState2.longField = 1L;
        typeState2.stringField = "A";
        typeState2.doubleField = 1.0;
        typeState2.basicIntField = 1;
        writer2.reset();
        mapper2.writeFlat(typeState2, writer2);
        FlatRecord rec2 = writer2.generateFlatRecord();

        FlatRecordTraversalObjectNode leftNode = new FlatRecordTraversalObjectNode(rec1);
        FlatRecordTraversalObjectNode rightNode = new FlatRecordTraversalObjectNode(rec2);

        assertThat(FlatRecordTraversalObjectNodeEquality.equals(leftNode, rightNode)).isTrue();
        assertThat(FlatRecordTraversalObjectNodeEquality.equals(rightNode, leftNode)).isTrue();
    }