PdxType implements DataSerializable { @Override public boolean equals(Object other) { if (other == this) { return true; } if (!(other instanceof PdxType)) { return false; } PdxType otherVT = (PdxType) other; if (!(this.className.equals(otherVT.className))) { return false; } if (this.noDomainClass != otherVT.noDomainClass) { return false; } if (otherVT.fields.size() != this.fields.size() || otherVT.vlfCount != this.vlfCount) { return false; } for (int i = 0; i < this.fields.size(); i++) { if (!this.fields.get(i).equals(otherVT.fields.get(i))) { return false; } } return true; } PdxType();  PdxType(String name, boolean expectDomainClass);  PdxType(PdxType copy); @Override void fromData(DataInput in); @Override void toData(DataOutput out); @Override int hashCode(); @Override boolean equals(Object other); boolean compatible(PdxType other); int getVariableLengthFieldCount(); String getClassName(); boolean getNoDomainClass(); void setNoDomainClass(boolean noDomainClass); int getTypeId(); int getDSId(); int getTypeNum(); void setTypeId(int tId); void setClassName(String className); void addField(PdxField ft); void initialize(PdxWriterImpl writer); PdxField getPdxField(String fieldName); List<PdxField> getFields(); PdxField getPdxFieldByIndex(int index); int getFieldCount(); int getUndeletedFieldCount(); String toFormattedString(); String toString(); List<Integer> getUnreadFieldIndexes(List<String> readFields); boolean hasExtraFields(PdxType other); SortedSet<PdxField> getSortedIdentityFields(); Collection<PdxField> getSortedFields(); List<String> getFieldNames(); void setAutoInfo(AutoClassInfo autoClassInfo); AutoClassInfo getAutoInfo(Class<?> c); void toStream(PrintStream printStream, boolean printFields); boolean getHasDeletedField(); void setHasDeletedField(boolean b);  }
@Test public void testEquals() { final PdxType type = new PdxType(TYPE_NAME, EXPECT_DOMAIN_CLASS); type.addField(FIELD_4); type.addField(FIELD_0); type.addField(FIELD_1); assertTrue(type.equals(type)); assertFalse(type.equals(null)); assertFalse(type.equals(new Object())); final PdxType sameTypeNameAndFields = new PdxType(TYPE_NAME, EXPECT_DOMAIN_CLASS); sameTypeNameAndFields.addField(FIELD_4); sameTypeNameAndFields.addField(FIELD_0); sameTypeNameAndFields.addField(FIELD_1); assertTrue(type.equals(sameTypeNameAndFields)); final PdxType sameTypeNameAndFieldsDifferentDomain = new PdxType(TYPE_NAME, !EXPECT_DOMAIN_CLASS); sameTypeNameAndFieldsDifferentDomain.addField(FIELD_4); sameTypeNameAndFieldsDifferentDomain.addField(FIELD_0); sameTypeNameAndFieldsDifferentDomain.addField(FIELD_1); assertFalse(type.equals(sameTypeNameAndFieldsDifferentDomain)); final PdxType differentTypeNameAndSameFields = new PdxType("Not " + TYPE_NAME, EXPECT_DOMAIN_CLASS); differentTypeNameAndSameFields.addField(FIELD_4); differentTypeNameAndSameFields.addField(FIELD_0); differentTypeNameAndSameFields.addField(FIELD_1); assertFalse(type.equals(differentTypeNameAndSameFields)); final PdxType sameTypeNameAndDifferentFields = new PdxType(TYPE_NAME, EXPECT_DOMAIN_CLASS); sameTypeNameAndDifferentFields.addField(FIELD_3); sameTypeNameAndDifferentFields.addField(FIELD_2); sameTypeNameAndDifferentFields.addField(FIELD_1); assertFalse(type.equals(sameTypeNameAndDifferentFields)); }