DocumentSample { @Override public boolean equals(Object obj) { if (this == obj) { return true; } else if (obj instanceof DocumentSample) { DocumentSample a = (DocumentSample) obj; return getCategory().equals(a.getCategory()) && Arrays.equals(getText(), a.getText()); } else { return false; } } DocumentSample(String category, String text);  DocumentSample(String category, String text[]); String getCategory(); String[] getText(); @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())); }