Or implements ConditionGroup, Cloneable { @Override public boolean equals(Object o) { if(this == o) return true; if(o == null || getClass() != o.getClass()) return false; final Or or = (Or) o; return !(conditions != null ? !conditions.equals(or.conditions) : or.conditions != null); } Or();  Or(List<Condition> conditions); @Override List<Condition> getConditions(); @Override void setConditions(List<Condition> conditions); @Override boolean isTrue(Object element); @Override Or clone(); @Override String toString(); @Override boolean equals(Object o); @Override int hashCode();  }
@Test public void testEquals() { Or condition1 = new Or(); Or condition2 = new Or(); assertEquals(condition1, condition2); List<Condition> conditions1=new ArrayList<>(); List<Condition> conditions2=new ArrayList<>(); condition1.setConditions(conditions1); assertNotEquals(condition1, condition2); assertNotEquals(condition2, condition1); condition2.setConditions(conditions2); assertEquals(condition1, condition2); conditions1.add(BooleanValues.FALSE); conditions2.add(BooleanValues.FALSE); assertEquals(condition1, condition2); conditions2.add(BooleanValues.FALSE); assertNotEquals(hashCode(), condition2); }
@Test @SuppressWarnings({"PMD.EqualsNull", "PMD.UseAssertEqualsInsteadOfAssertTrue"}) public void testBasicEquals() { Condition condition = new Or(); assertFalse(condition.equals(null)); assertFalse(condition.equals(new Object())); assertTrue(condition.equals(condition)); }