### Question:
TransformedNullaryFunction implements NullaryFunction<T> { @Override public final boolean equals(Object obj) { if (obj == this) { return true; } if (!(obj instanceof TransformedNullaryFunction<?>)) { return false; } TransformedNullaryFunction<?> that = (TransformedNullaryFunction<?>) obj; return this.helper.preceding.equals(that.helper.preceding) && this.helper.following.equals(that.helper.following); } <X> TransformedNullaryFunction(NullaryFunction<? extends X> preceding,
            Function<? super X, ? extends T> following); final T evaluate(); @Override final boolean equals(Object obj); @Override int hashCode(); @Override String toString();  }### Answer:
@Test public void testEquals() { TransformedNullaryFunction<Integer> t = new TransformedNullaryFunction<Integer>(one, addOne); NullaryFunction<Integer> f = new NullaryFunction<Integer>() { public Integer evaluate() { return Integer.valueOf(2); } }; Function<Integer, Integer> p = new Function<Integer, Integer>() { public Integer evaluate(Integer obj) { return obj + 2; } }; assertEquals(t, t); assertObjectsAreEqual(t, new TransformedNullaryFunction<Integer>(one, addOne)); assertObjectsAreNotEqual(t, new TransformedNullaryFunction<Integer>(f, addOne)); assertObjectsAreNotEqual(t, new TransformedNullaryFunction<Integer>(one, p)); assertTrue(!t.equals(null)); }