InstanceThat { @Factory @SuppressWarnings("unchecked") public static <T, T2> AndChainMatcher.Builder<T> instanceThat(Class<T2> clazz, Matcher<? super T2> m) { return (AndChainMatcher.Builder) AndChainMatcher.both(IsInstanceOf.instanceOf(clazz), m); }  @Factory @SuppressWarnings("unchecked") static AndChainMatcher.Builder<T> instanceThat(Class<T2> clazz, Matcher<? super T2> m); @Factory @SuppressWarnings("unchecked") static AndChainMatcher.Builder<T> instanceThat(Class<T2> clazz, Matcher<? super T2>... m); @Factory @SuppressWarnings("unchecked") static AndChainMatcher.Builder<T> isInstanceThat(Class<T2> clazz, Matcher<? super T2> m); @Factory @SuppressWarnings("unchecked") static Matcher<T> isInstanceThat(Class<T2> clazz, Matcher<? super T2>... m);  }
@Test public void test_instanceThat() { Matcher<Object> int_gt_1 = instanceThat(Integer.class, greaterThan(1)); assertThat(int_gt_1, accepts(2)); assertThat(int_gt_1, rejects(0)); assertThat(int_gt_1, rejects("2")); assertThat(int_gt_1, rejects(2.0)); }
@Test public void test_description() { Matcher<Object> int_gt_1 = instanceThat(Integer.class, greaterThan(1)); assertThat(int_gt_1, description("an instance of java.lang.Integer and a value greater than <1>")); }
@Test public void test_mismatch_instance() { Matcher<Object> int_gt_1 = instanceThat(Integer.class, greaterThan(1)); assertThat(int_gt_1, rejects(2.0, "<2.0> is a java.lang.Double")); }
@Test public void test_mismatch_value() { Matcher<Object> int_gt_1 = instanceThat(Integer.class, greaterThan(1)); assertThat(int_gt_1, rejects(0, "<0> was less than <1>")); }