ResidueNumber implements Serializable, Comparable<ResidueNumber> { @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; ResidueNumber other = (ResidueNumber) obj; if (chainId == null) { if (other.chainId != null) return false; } else if (!chainId.equals(other.chainId)) return false; if (insCode == null) { if (other.insCode != null) return false; } else if (!insCode.equals(other.insCode)) return false; if (seqNum == null) { if (other.seqNum != null) return false; } else if (!seqNum.equals(other.seqNum)) return false; return true; } ResidueNumber();  ResidueNumber(String chainId, Integer residueNumber, Character insCode); String getChainId(); void setChainId(String chainId); Character getInsCode(); void setInsCode(Character insCode); Integer getSeqNum(); void setSeqNum(Integer seqNum); @Override boolean equals(Object obj); @Override int hashCode(); @Override String toString(); String toPDB(); static ResidueNumber fromString(String pdb_code); int compareTo(ResidueNumber other); String printFull();  }
@Test public void testEquals() { ResidueNumber number1 = new ResidueNumber("A", 42, ' '); ResidueNumber number2 = new ResidueNumber("A", 42, ' '); boolean expResult = true; boolean result = number2.equals(number1); assertEquals(expResult, result); Set<ResidueNumber> numberSet= new HashSet<ResidueNumber>(); numberSet.add(number1); numberSet.add(number2); assertEquals(1, numberSet.size()); }