Not implements ConditionWrapper, Cloneable { @Override public boolean equals(Object o) { if(this == o) return true; if(o == null || getClass() != o.getClass()) return false; final Not not = (Not) o; return !(condition != null ? !condition.equals(not.condition) : not.condition != null); } Not();  Not(Condition condition); @Override Condition getCondition(); @Override void setCondition(Condition condition); @Override boolean isTrue(Object element); @Override Not clone(); @Override String toString(); @Override boolean equals(Object o); @Override int hashCode();  }
@Test public void testEquals() { Not condition1 = new Not(); Not condition2 = new Not(); assertEquals(condition1, condition2); condition1.setCondition(BooleanValues.TRUE); assertNotEquals(condition1, condition2); assertNotEquals(condition2, condition1); condition2.setCondition(BooleanValues.TRUE); assertEquals(condition1, condition2); condition1.setCondition(BooleanValues.FALSE); condition2.setCondition(BooleanValues.FALSE); assertEquals(condition1, condition2); condition1.setCondition(BooleanValues.TRUE); assertNotEquals(condition1, condition2); }
@Test @SuppressWarnings({"PMD.EqualsNull", "PMD.UseAssertEqualsInsteadOfAssertTrue"}) public void testBasicEquals() { Condition condition = new Not(); assertFalse(condition.equals(null)); assertFalse(condition.equals(new Object())); assertTrue(condition.equals(condition)); }