SentenceSample { @Override public boolean equals(Object obj) { if (this == obj) { return true; } else if (obj instanceof SentenceSample) { SentenceSample a = (SentenceSample) obj; return getDocument().equals(a.getDocument()) && Arrays.equals(getSentences(), a.getSentences()); } else { return false; } } SentenceSample(String document, Span... sentences);  SentenceSample(Detokenizer detokenizer, String[][] sentences); String getDocument(); Span[] getSentences(); @Override String toString(); @Override boolean equals(Object obj);  }
@Test public void testEquals() { assertFalse(createGoldSample() == createGoldSample()); assertTrue(createGoldSample().equals(createGoldSample())); assertFalse(createPredSample().equals(createGoldSample())); assertFalse(createPredSample().equals(new Object())); }