Assert.assertThat

Asserts that <code>actual</code> satisfies the condition specified by <code>matcher</code>. If not, an {@link AssertionError} is thrown with information about the matcher and failing value. Example:

<pre> assertThat(0, is(1)); // fails: // failure message: // expected: is &lt;1&gt; // got value: &lt;0&gt; assertThat(0, is(not(1))) // passes </pre>

<code>org.hamcrest.Matcher</code> does not currently document the meaning of its type parameter <code>T</code>. This method assumes that a matcher typed as <code>Matcher&lt;T&gt;</code> can be meaningfully applied only to values that could be assigned to a variable of type <code>T</code>.

@param (T) the static type accepted by the matcher (this can flag obvious compile-time problems such as {@code assertThat(1, is("a"))} @param actual the computed value being compared @param matcher an expression, built of {@link Matcher}s, specifying allowed values @see org.hamcrest.CoreMatchers @see org.hamcrest.MatcherAssert

  1. void assertThat(T actual, T matcher)
    class Assert
    static
    void
    assertThat
    (
    T
    size_t line = __LINE__
    string file = __FILE__
    )
  2. void assertThat(string message, T actual, T matcher)

Meta