Assert.assertThat

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

<pre> assertThat(&quot;Help! Integers don't work&quot;, 0, is(1)); // fails: // failure message: // Help! Integers don't work // expected: is &lt;1&gt; // got value: &lt;0&gt; assertThat(&quot;Zero is one&quot;, 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 reason additional information about the error @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)
  2. void assertThat(string message, T actual, T matcher)
    class Assert
    static
    void
    assertThat
    (
    T
    size_t line = __LINE__
    string file = __FILE__
    )
    (
    string message
    ,,)

Meta