### Question:
AnnotationSuggestion implements Serializable { @Override public int hashCode() { return Objects.hash(id, recommenderId, documentName); } AnnotationSuggestion(int aId, long aRecommenderId, String aRecommenderName,
        long aLayerId, String aFeature, String aDocumentName, int aBegin, int aEnd,
        String aCoveredText, String aLabel, String aUiLabel, double aConfidence,
        String aConfidenceExplanation);  AnnotationSuggestion(AnnotationSuggestion aObject); String getCoveredText(); int getBegin(); int getEnd(); int getId(); @Nullable String getLabel(); String getUiLabel(); long getLayerId(); String getFeature(); String getRecommenderName(); double getConfidence(); Optional<String> getConfidenceExplanation(); long getRecommenderId(); String getDocumentName(); @Deprecated Offset getOffset(); void hide(int aFlags); void show(int aFlags); String getReasonForHiding(); boolean isVisible(); VID getVID(); @Override int hashCode(); @Override boolean equals(Object o); @Override String toString(); boolean labelEquals(String aLabel); static final String EXTENSION_ID; static final int FLAG_OVERLAP; static final int FLAG_SKIPPED; static final int FLAG_REJECTED; static final int FLAG_TRANSIENT_ACCEPTED; static final int FLAG_TRANSIENT_REJECTED; static final int FLAG_TRANSIENT_CORRECTED; static final int FLAG_ALL; }### Answer:
@Test public void thatEqualsAndHashCodeAndCompareToWorkCorrectly() { AnnotationSuggestion rec1Sug1 = new AnnotationSuggestion(1, 1, "rec1", 1, "value", "doc1", 0, 1, "a", "A", "#A", 0.1, "E1"); AnnotationSuggestion rec1Sug2 = new AnnotationSuggestion(2, 1, "rec1", 1, "value", "doc1", 0, 1, "b", "B", "#B", 0.2, "E2"); AnnotationSuggestion rec2Sug1 = new AnnotationSuggestion(3, 2, "rec2", 1, "value", "doc1", 0, 1, "c", "C", "#C", 0.1, "E1"); AnnotationSuggestion rec2Sug2 = new AnnotationSuggestion(4, 2, "rec2", 1, "value", "doc1", 0, 1, "d", "D", "#D", 0.3, "E3"); List<AnnotationSuggestion> all = asList(rec1Sug1, rec1Sug2, rec2Sug1, rec2Sug2); for (AnnotationSuggestion x : all) { for (AnnotationSuggestion y : all) { if (x == y) { assertThat(x).isEqualTo(y); assertThat(y).isEqualTo(x); assertThat(x.hashCode()).isEqualTo(y.hashCode()); } else { assertThat(x).isNotEqualTo(y); assertThat(y).isNotEqualTo(x); assertThat(x.hashCode()).isNotEqualTo(y.hashCode()); } } } }