/** Test with values */ @Test public void testWithValues() { GedcomVersion orig = new GedcomVersion(); orig.setGedcomForm("foo"); orig.setVersionNumber(SupportedVersion.V5_5); orig.getCustomFacts(true).add(getTestCustomFact()); GedcomVersion copy = new GedcomVersion(orig); assertEquals(orig, copy); assertNotSame(orig, copy); assertEquals(orig.toString(), copy.toString()); }
@Override public int hashCode() { final int prime = 31; int result = super.hashCode(); result = prime * result + (characterSet == null ? 0 : characterSet.hashCode()); result = prime * result + (copyrightData == null ? 0 : copyrightData.hashCode()); result = prime * result + (date == null ? 0 : date.hashCode()); result = prime * result + (destinationSystem == null ? 0 : destinationSystem.hashCode()); result = prime * result + (fileName == null ? 0 : fileName.hashCode()); result = prime * result + (gedcomVersion == null ? 0 : gedcomVersion.hashCode()); result = prime * result + (language == null ? 0 : language.hashCode()); result = prime * result + (notes == null ? 0 : notes.hashCode()); result = prime * result + (placeHierarchy == null ? 0 : placeHierarchy.hashCode()); result = prime * result + (sourceSystem == null ? 0 : sourceSystem.hashCode()); result = prime * result + (submission == null ? 0 : submission.hashCode()); result = prime * result + (submitter == null ? 0 : submitter.hashCode()); result = prime * result + (time == null ? 0 : time.hashCode()); return result; }
@Override public boolean equals(Object obj) { if (this == obj) { return true; } if (!super.equals(obj)) { return false; } if (getClass() != obj.getClass()) { return false; } Header other = (Header) obj; if (characterSet == null) { if (other.characterSet != null) { return false; } } else if (!characterSet.equals(other.characterSet)) { return false; } if (copyrightData == null) { if (other.copyrightData != null) { return false; } } else if (!copyrightData.equals(other.copyrightData)) { return false; } if (date == null) { if (other.date != null) { return false; } } else if (!date.equals(other.date)) { return false; } if (destinationSystem == null) { if (other.destinationSystem != null) { return false; } } else if (!destinationSystem.equals(other.destinationSystem)) { return false; } if (fileName == null) { if (other.fileName != null) { return false; } } else if (!fileName.equals(other.fileName)) { return false; } if (gedcomVersion == null) { if (other.gedcomVersion != null) { return false; } } else if (!gedcomVersion.equals(other.gedcomVersion)) { return false; } if (language == null) { if (other.language != null) { return false; } } else if (!language.equals(other.language)) { return false; } if (notes == null) { if (other.notes != null) { return false; } } else if (!notes.equals(other.notes)) { return false; } if (placeHierarchy == null) { if (other.placeHierarchy != null) { return false; } } else if (!placeHierarchy.equals(other.placeHierarchy)) { return false; } if (sourceSystem == null) { if (other.sourceSystem != null) { return false; } } else if (!sourceSystem.equals(other.sourceSystem)) { return false; } if (submission == null) { if (other.submission != null) { return false; } } else if (!submission.equals(other.submission)) { return false; } if (submitter == null) { if (other.submitter != null) { return false; } } else if (!submitter.equals(other.submitter)) { return false; } if (time == null) { if (other.time != null) { return false; } } else if (!time.equals(other.time)) { return false; } return true; }