### Question:
CompositePredicate implements Predicate<A> { @Override public boolean equals(Object obj) { if (obj == this) { return true; } if (!(obj instanceof CompositePredicate<?>)) { return false; } CompositePredicate<?> that = (CompositePredicate<?>) obj; return this.function.equals(that.function); } CompositePredicate(Predicate<? super A> predicate); private  CompositePredicate(CompositeFunction<? super A, Boolean> function); CompositePredicate<P> of(Function<? super P, ? extends A> preceding); boolean test(A obj); @Override boolean equals(Object obj); @Override int hashCode(); @Override String toString();  }### Answer:
@Test public void testEquals() throws Exception { CompositePredicate<Object> f = new CompositePredicate<Object>(Constant.TRUE); assertEquals(f,f); CompositePredicate<Object> g = new CompositePredicate<Object>(Constant.TRUE); assertObjectsAreEqual(f,g); for (int i=0;i<3;i++) { f = f.of(Constant.of("x")); assertObjectsAreNotEqual(f,g); g = g.of(Constant.of("x")); assertObjectsAreEqual(f,g); f = f.of(Constant.of("y")).of(Constant.of("z")); assertObjectsAreNotEqual(f,g); g = g.of(Constant.of("y")).of(Constant.of("z")); assertObjectsAreEqual(f,g); } assertObjectsAreNotEqual(f,Constant.FALSE); assertTrue(!f.equals(null)); }