### Question:
PredicateImpl implements Predicate { @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (!(obj instanceof Predicate)) { return false; } final Predicate other = (Predicate) obj; return this.arity == other.getArity() && this.name.equals(other.getName()); } PredicateImpl(final String name, int arity); @Override String getName(); @Override int getArity(); @Override int hashCode(); @Override boolean equals(Object obj); @Override String toString();  }### Answer:
@Test public void testEquals() { final Predicate p1 = new PredicateImpl("p", 1); final Predicate p1too = Expressions.makePredicate("p", 1); final Predicate p2 = new PredicateImpl("p", 2); final Predicate q1 = new PredicateImpl("q", 1); assertEquals(p1, p1); assertEquals(p1too, p1); assertNotEquals(p2, p1); assertNotEquals(q1, p1); assertNotEquals(p2.hashCode(), p1.hashCode()); assertNotEquals(q1.hashCode(), p1.hashCode()); assertFalse(p1.equals(null)); assertFalse(p1.equals("p")); }