1/*  Copyright (c) 2000-2006 hamcrest.org
2 */
3package org.hamcrest;
4
5
6public class MatcherAssert {
7    public static <T> void assertThat(T actual, Matcher<T> matcher) {
8        assertThat("", actual, matcher);
9    }
10
11    public static <T> void assertThat(String reason, T actual, Matcher<T> matcher) {
12        if (!matcher.matches(actual)) {
13            Description description = new StringDescription();
14            description.appendText(reason)
15                       .appendText("\nExpected: ")
16                       .appendDescriptionOf(matcher)
17                       .appendText("\n     got: ")
18                       .appendValue(actual)
19                       .appendText("\n");
20
21            throw new java.lang.AssertionError(description.toString());
22        }
23    }
24}
25