DocumentId implements Comparable<DocumentId> { @Override public boolean equals(Object o) { if (o == null || !(o instanceof DocumentId) || this.docNumber == null) { return false; } else { DocumentId other = (DocumentId) o; return getIdNoKind().equals(other.getIdNoKind()); } } DocumentId(CountryCode countryCode, String docNumber);  DocumentId(CountryCode countryCode, String docNumber, boolean allowLeadingZeros);  DocumentId(CountryCode countryCode, String docNumber, String kindCode);  DocumentId(CountryCode countryCode, String docNumber, String kindCode, boolean allowLeadingZeros); void setRawText(String raw); String getRawText(); void setPatentType(PatentType patentType); PatentType getPatentType(); void setType(DocumentIdType docIdType); DocumentIdType getType(); DocType getDocType(); String getDocNumber(); void setApplicationYear(String yearStr); void setApplicationYear(String yearStr, DocumentDate date); String getApplicationYear(); String getId(); String getIdNoKind(); String getId(int zeroPadMinLen); CountryCode getCountryCode(); void setKindCode(String kindCode); String getKindCode(); String getName(); void setName(String name); DocumentDate getDate(); void setDate(DocumentDate date); String toTextNoKind(); String toText(); String toText(int zeroPadMinLen); static DocumentId fromPCTText(final String docIdStr); static DocumentId fromText(final String documentIdStr, int year); static List<DocumentId> getByType(Collection<DocumentId> docIds, DocumentIdType type); static List<DocumentId> getByDocType(Collection<DocumentId> docIds, DocType type); @Override final int hashCode(); @Override boolean equals(Object o); @Override int compareTo(DocumentId o); @Override String toString();  }
@Test public void equals() throws InvalidDataException { DocumentId docId = new DocumentId(CountryCode.US, "123456", "A1"); assertEquals(docId, new DocumentId(CountryCode.US, "123456")); assertEquals(docId, new DocumentId(CountryCode.US, "00123456")); assertNotEquals(docId, new DocumentId(CountryCode.WO, "123456")); assertNotEquals(docId, new DocumentId(CountryCode.US, "888888")); }