/** * Creates a matcher that matches when the examined object is an instance of the specified <code>type</code>, * as determined by calling the {@link java.lang.Class#isInstance(Object)} method on that type, passing the * the examined object. * * <p>The created matcher forces a relationship between specified type and the examined object, and should be * used when it is necessary to make generics conform, for example in the JMock clause * <code>with(any(Thing.class))</code></p> * <p/> * For example: * <pre>assertThat(new Canoe(), instanceOf(Canoe.class));</pre> */ public static <T> org.hamcrest.Matcher<T> any(java.lang.Class<T> type) { return org.hamcrest.core.IsInstanceOf.<T>any(type); }
/** * Creates a matcher that matches when the examined object is an instance of the specified <code>type</code>, * as determined by calling the {@link java.lang.Class#isInstance(Object)} method on that type, passing the * the examined object. * * <p>The created matcher forces a relationship between specified type and the examined object, and should be * used when it is necessary to make generics conform, for example in the JMock clause * <code>with(any(Thing.class))</code></p> * <p/> * For example: * <pre>assertThat(new Canoe(), instanceOf(Canoe.class));</pre> */ public static <T> org.hamcrest.Matcher<T> any(java.lang.Class<T> type) { return org.hamcrest.core.IsInstanceOf.<T>any(type); }
/** * Creates a matcher that matches when the examined object is an instance of the specified <code>type</code>, * as determined by calling the {@link java.lang.Class#isInstance(Object)} method on that type, passing the * the examined object. * * <p>The created matcher forces a relationship between specified type and the examined object, and should be * used when it is necessary to make generics conform, for example in the JMock clause * <code>with(any(Thing.class))</code></p> * <p/> * For example: * <pre>assertThat(new Canoe(), instanceOf(Canoe.class));</pre> */ public static <T> org.hamcrest.Matcher<T> any(java.lang.Class<T> type) { return org.hamcrest.core.IsInstanceOf.<T>any(type); }
/** * Creates a matcher that matches when the examined object is an instance of the specified <code>type</code>, * as determined by calling the {@link java.lang.Class#isInstance(Object)} method on that type, passing the * the examined object. * * <p>The created matcher forces a relationship between specified type and the examined object, and should be * used when it is necessary to make generics conform, for example in the JMock clause * <code>with(any(Thing.class))</code></p> * For example: * <pre>assertThat(new Canoe(), instanceOf(Canoe.class));</pre> */ public static <T> org.hamcrest.Matcher<T> any(java.lang.Class<T> type) { return org.hamcrest.core.IsInstanceOf.any(type); }
/** * Creates a matcher that matches when the examined object is an instance of the specified <code>type</code>, * as determined by calling the {@link java.lang.Class#isInstance(Object)} method on that type, passing the * the examined object. * * <p>The created matcher forces a relationship between specified type and the examined object, and should be * used when it is necessary to make generics conform, for example in the JMock clause * <code>with(any(Thing.class))</code></p> * For example: * <pre>assertThat(new Canoe(), instanceOf(Canoe.class));</pre> */ public static <T> org.hamcrest.Matcher<T> any(java.lang.Class<T> type) { return org.hamcrest.core.IsInstanceOf.any(type); }
public static Matcher<? super Serializable> serializesRoundTrip() { return serializesRoundTrip(any(Serializable.class)); }
public static <T extends Serializable> Matcher<T> serializesRoundTrip(final Class<T> clazz) { return serializesRoundTrip(any(clazz)); }
@Test public void matchesPrimitiveTypes() { assertMatches(any(boolean.class), true); assertMatches(any(byte.class), (byte)1); assertMatches(any(char.class), 'x'); assertMatches(any(double.class), 5.0); assertMatches(any(float.class), 5.0f); assertMatches(any(int.class), 2); assertMatches(any(long.class), 4L); assertMatches(any(short.class), (short)1); }
@Test public void anyWillReturnTheCorrectTypeForUseInJMock() { @SuppressWarnings("unused") Integer anInteger = with(any(Integer.class)); }
/** * Creates a matcher that matches when the examined object is an instance of the specified <code>type</code>, * as determined by calling the {@link java.lang.Class#isInstance(Object)} method on that type, passing the * the examined object. * * <p>The created matcher forces a relationship between specified type and the examined object, and should be * used when it is necessary to make generics conform, for example in the JMock clause * <code>with(any(Thing.class))</code></p> * For example: * <pre>assertThat(new Canoe(), instanceOf(Canoe.class));</pre> */ public static <T> org.hamcrest.Matcher<T> any(java.lang.Class<T> type) { return org.hamcrest.core.IsInstanceOf.any(type); }
/** * Creates a matcher that matches when the examined object is an instance of the specified <code>type</code>, * as determined by calling the {@link java.lang.Class#isInstance(Object)} method on that type, passing the * the examined object. * * <p>The created matcher forces a relationship between specified type and the examined object, and should be * used when it is necessary to make generics conform, for example in the JMock clause * <code>with(any(Thing.class))</code></p> * <p/> * For example: * <pre>assertThat(new Canoe(), instanceOf(Canoe.class));</pre> */ public static <T> org.hamcrest.Matcher<T> any(java.lang.Class<T> type) { return org.hamcrest.core.IsInstanceOf.<T>any(type); }
/** * Creates a matcher that matches when the examined object is an instance of the specified <code>type</code>, * as determined by calling the {@link java.lang.Class#isInstance(Object)} method on that type, passing the * the examined object. * * <p>The created matcher forces a relationship between specified type and the examined object, and should be * used when it is necessary to make generics conform, for example in the JMock clause * <code>with(any(Thing.class))</code></p> * For example: * <pre>assertThat(new Canoe(), instanceOf(Canoe.class));</pre> */ public static <T> org.hamcrest.Matcher<T> any(java.lang.Class<T> type) { return org.hamcrest.core.IsInstanceOf.<T>any(type); }
/** * Creates a matcher that matches when the examined object is an instance of the specified <code>type</code>, * as determined by calling the {@link java.lang.Class#isInstance(Object)} method on that type, passing the * the examined object. * * <p>The created matcher forces a relationship between specified type and the examined object, and should be * used when it is necessary to make generics conform, for example in the JMock clause * <code>with(any(Thing.class))</code></p> * For example: * <pre>assertThat(new Canoe(), instanceOf(Canoe.class));</pre> */ public static <T> org.hamcrest.Matcher<T> any(java.lang.Class<T> type) { return org.hamcrest.core.IsInstanceOf.any(type); }
/** * Creates a matcher that matches when the examined object is an instance of the specified <code>type</code>, * as determined by calling the {@link java.lang.Class#isInstance(Object)} method on that type, passing the * the examined object. * * <p>The created matcher forces a relationship between specified type and the examined object, and should be * used when it is necessary to make generics conform, for example in the JMock clause * <code>with(any(Thing.class))</code></p> * <p/> * For example: * <pre>assertThat(new Canoe(), instanceOf(Canoe.class));</pre> */ public static <T> org.hamcrest.Matcher<T> any(java.lang.Class<T> type) { return org.hamcrest.core.IsInstanceOf.<T>any(type); }
/** * Creates a matcher that matches when the examined object is an instance of the specified <code>type</code>, * as determined by calling the {@link java.lang.Class#isInstance(Object)} method on that type, passing the * the examined object. * * <p>The created matcher forces a relationship between specified type and the examined object, and should be * used when it is necessary to make generics conform, for example in the JMock clause * <code>with(any(Thing.class))</code></p> * <p/> * For example: * <pre>assertThat(new Canoe(), instanceOf(Canoe.class));</pre> */ public static <T> org.hamcrest.Matcher<T> any(java.lang.Class<T> type) { return org.hamcrest.core.IsInstanceOf.<T>any(type); }
/** * Creates a matcher that matches when the examined object is an instance of the specified <code>type</code>, * as determined by calling the {@link java.lang.Class#isInstance(Object)} method on that type, passing the * the examined object. * * <p>The created matcher forces a relationship between specified type and the examined object, and should be * used when it is necessary to make generics conform, for example in the JMock clause * <code>with(any(Thing.class))</code></p> * For example: * <pre>assertThat(new Canoe(), instanceOf(Canoe.class));</pre> */ public static <T> org.hamcrest.Matcher<T> any(java.lang.Class<T> type) { return org.hamcrest.core.IsInstanceOf.any(type); }
/** * Creates a matcher that matches when the examined object is an instance of the specified <code>type</code>, * as determined by calling the {@link java.lang.Class#isInstance(Object)} method on that type, passing the * the examined object. * * <p>The created matcher forces a relationship between specified type and the examined object, and should be * used when it is necessary to make generics conform, for example in the JMock clause * <code>with(any(Thing.class))</code></p> * <p/> * For example: * <pre>assertThat(new Canoe(), instanceOf(Canoe.class));</pre> */ public static <T> org.hamcrest.Matcher<T> any(java.lang.Class<T> type) { return org.hamcrest.core.IsInstanceOf.<T>any(type); }
/** * Creates a matcher that matches when the examined object is an instance of the specified <code>type</code>, * as determined by calling the {@link java.lang.Class#isInstance(Object)} method on that type, passing the * the examined object. * * <p>The created matcher forces a relationship between specified type and the examined object, and should be * used when it is necessary to make generics conform, for example in the JMock clause * <code>with(any(Thing.class))</code></p> * <p/> * For example: * <pre>assertThat(new Canoe(), instanceOf(Canoe.class));</pre> */ public static <T> org.hamcrest.Matcher<T> any(java.lang.Class<T> type) { return org.hamcrest.core.IsInstanceOf.<T>any(type); }
/** * Creates a matcher that matches when the examined object is an instance of the specified <code>type</code>, * as determined by calling the {@link java.lang.Class#isInstance(Object)} method on that type, passing the * the examined object. * * <p>The created matcher forces a relationship between specified type and the examined object, and should be * used when it is necessary to make generics conform, for example in the JMock clause * <code>with(any(Thing.class))</code></p> * <p/> * For example: * <pre>assertThat(new Canoe(), instanceOf(Canoe.class));</pre> */ public static <T> org.hamcrest.Matcher<T> any(java.lang.Class<T> type) { return org.hamcrest.core.IsInstanceOf.<T>any(type); }
/** * Creates a matcher that matches when the examined object is an instance of the specified <code>type</code>, * as determined by calling the {@link java.lang.Class#isInstance(Object)} method on that type, passing the * the examined object. * * <p>The created matcher forces a relationship between specified type and the examined object, and should be * used when it is necessary to make generics conform, for example in the JMock clause * <code>with(any(Thing.class))</code></p> * <p/> * For example: * <pre>assertThat(new Canoe(), instanceOf(Canoe.class));</pre> */ public static <T> org.hamcrest.Matcher<T> any(java.lang.Class<T> type) { return org.hamcrest.core.IsInstanceOf.<T>any(type); }