EnumInfo implements DataSerializableFixedID { @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; EnumInfo other = (EnumInfo) obj; if (clazz == null) { if (other.clazz != null) return false; } else if (!clazz.equals(other.clazz)) return false; if (name == null) { if (other.name != null) return false; } else if (!name.equals(other.name)) return false; if (this.ordinal != other.ordinal) { throw new PdxSerializationException("The ordinal value for the enum " + this.name + " on class " + this.clazz + " can not be changed. Pdx only allows new enum constants to be added to the end of the enum."); } return true; } EnumInfo(Enum<?> e);  EnumInfo(String clazz, String name, int enumOrdinal);  EnumInfo(); @Override int getDSFID(); String getClassName(); void setClassName(String v); @Override void toData(DataOutput out,
      SerializationContext context); @Override void fromData(DataInput in,
      DeserializationContext context); void flushCache(); int compareTo(EnumInfo other); Enum<?> getEnum(); int getOrdinal(); @Override int hashCode(); @Override String toString(); String toFormattedString(); @Override boolean equals(Object obj); PdxInstance getPdxInstance(int enumId); @Override KnownVersion[] getSerializationVersions(); void toStream(PrintStream printStream);  }
@Test public void testEquals() { final EnumInfo enumInfo = new EnumInfo(TestEnum.ONE); assertTrue(enumInfo.equals(enumInfo)); assertFalse(enumInfo.equals(null)); assertFalse(enumInfo.equals(new Object())); final EnumInfo sameClazzSameNameAndSameOrdinal = new EnumInfo("org.apache.geode.pdx.internal.EnumInfoTest$TestEnum", "ONE", 1); assertTrue(enumInfo.equals(sameClazzSameNameAndSameOrdinal)); final EnumInfo differentClazzSameNameAndSameOrdinal = new EnumInfo("Not " + "org.apache.geode.pdx.internal.EnumInfoTest$TestEnum", "ONE", 1); assertFalse(enumInfo.equals(differentClazzSameNameAndSameOrdinal)); final EnumInfo sameClazzDifferentNameAndSameOrdinal = new EnumInfo("org.apache.geode.pdx.internal.EnumInfoTest$TestEnum", "Not " + "ONE", 1); assertFalse(enumInfo.equals(sameClazzDifferentNameAndSameOrdinal)); final EnumInfo sameClazzDifferentNameAndDifferentOrdinal = new EnumInfo("org.apache.geode.pdx.internal.EnumInfoTest$TestEnum", "Not " + "ONE", 1 + 1); assertFalse(enumInfo.equals(sameClazzDifferentNameAndDifferentOrdinal)); }