### Question:
InstanceOfPredicate implements Predicate<T> { @Override public boolean evaluate(T instance) { return testClass.isInstance(instance); } InstanceOfPredicate(Class<?> testClass); @Override boolean evaluate(T instance); @Override boolean equals(Object other); @Override int hashCode();  }### Answer:
@Test public void shouldReturnTrueIfTheInstanceBeingEvaluatedIsOfTheClassSpecifiedAtConstruction() throws Exception { Predicate<Number> instanceOfPredicate = new InstanceOfPredicate<Number>(Integer.class); boolean result = instanceOfPredicate.evaluate(180); assertThat(result, is(true)); }
@Test public void shouldReturnFalseIfTheInstanceBeingEvaluatedIsNotOfTheClassSpecifiedAtConstruction() throws Exception { Predicate<Number> instanceOfPredicate = new InstanceOfPredicate<Number>(Integer.class); boolean result = instanceOfPredicate.evaluate(180L); assertThat(result, is(false)); }