### Question:
Identity implements Function<T, T>, Predicate<T> { public boolean test(Object obj) { return test((Boolean) obj); } Identity(); T evaluate(T obj); boolean test(Object obj); boolean test(Boolean bool); @Override boolean equals(Object that); @Override int hashCode(); @Override String toString(); static Identity<T> instance(); static final Identity<Object> INSTANCE; }### Answer:
@Test public void testTest() throws Exception { Predicate<Object> p = new Identity<Object>(); assertTrue(p.test(Boolean.TRUE)); assertTrue(!p.test(Boolean.FALSE)); try { p.test("true"); fail("Expected ClassCastException"); } catch(ClassCastException e) { } try { p.test(null); fail("Expected NullPointerException"); } catch(NullPointerException e) { } }