@Override
    public boolean equals(Object other) {
        if (this == other)
            return true;
        if(!(other instanceof HollowObjectSchema))
            return false;
        HollowObjectSchema otherSchema = (HollowObjectSchema) other;
        if(!getName().equals(otherSchema.getName()))
            return false;
        if(otherSchema.numFields() != numFields())
            return false;

        if (!isNullableObjectEquals(primaryKey, otherSchema.getPrimaryKey()))
            return false;

        for(int i=0;i<numFields();i++) {
            if(getFieldType(i) != otherSchema.getFieldType(i))
                return false;
            if(getFieldType(i) == FieldType.REFERENCE && !getReferencedType(i).equals(otherSchema.getReferencedType(i)))
                return false;
            if(!getFieldName(i).equals(otherSchema.getFieldName(i)))
                return false;
        }

        return true;
    }
@Test
    public void testEquals() {
        {
            HollowObjectSchema s1 = new HollowObjectSchema("Test", 2);
            s1.addField("F1", FieldType.INT);
            s1.addField("F2", FieldType.LONG);

            HollowObjectSchema s2 = new HollowObjectSchema("Test", 2);
            s2.addField("F1", FieldType.INT);
            s2.addField("F2", FieldType.LONG);

            Assert.assertEquals(s1, s2);
        }

        {
            HollowObjectSchema s1 = new HollowObjectSchema("Test", 2);
            s1.addField("F1", FieldType.INT);
            s1.addField("F2", FieldType.LONG);

            HollowObjectSchema s2 = new HollowObjectSchema("Test", 1);
            s2.addField("F1", FieldType.INT);

            Assert.assertNotEquals(s1, s2);
        }

    }