Part { @Override public boolean equals(Object obj) { if (obj instanceof Part) { Part other = (Part) obj; return d_treatments.equals(other.d_treatments) && d_studies.equals(other.d_studies); } return false; } Part(final Treatment t1, final Treatment t2, final Set<Study> studies);  Part(Treatment ta, Treatment tb, Collection<Study> studies); Set<Treatment> getTreatments(); Set<Study> getStudies(); @Override boolean equals(Object obj); @Override int hashCode(); @Override String toString();  }
@Test public void testEquals() { assertEquals(new Part(d_ta, d_tb, new HashSet<Study>(Arrays.asList(d_s1))), new Part(d_ta, d_tb, new HashSet<Study>(Arrays.asList(d_s1)))); assertEquals(new Part(d_ta, d_tb, new HashSet<Study>(Arrays.asList(d_s1))).hashCode(), new Part(d_ta, d_tb, new HashSet<Study>(Arrays.asList(d_s1))).hashCode()); assertEquals(new Part(d_ta, d_tb, new HashSet<Study>(Arrays.asList(d_s1))), new Part(d_tb, d_ta, new HashSet<Study>(Arrays.asList(d_s1)))); assertEquals(new Part(d_ta, d_tb, new HashSet<Study>(Arrays.asList(d_s1))).hashCode(), new Part(d_tb, d_ta, new HashSet<Study>(Arrays.asList(d_s1))).hashCode()); JUnitUtil.assertNotEquals(new Part(d_ta, d_tb, new HashSet<Study>(Arrays.asList(d_s1))), new Part(d_ta, d_tb, new HashSet<Study>(Arrays.asList(d_s3)))); }