diff --git a/hamcrest/src/main/java/org/hamcrest/MatcherAssert.java b/hamcrest/src/main/java/org/hamcrest/MatcherAssert.java
index 049e1df3..b6c6166a 100644
--- a/hamcrest/src/main/java/org/hamcrest/MatcherAssert.java
+++ b/hamcrest/src/main/java/org/hamcrest/MatcherAssert.java
@@ -1,11 +1,37 @@
package org.hamcrest;
+/**
+ * Utility class that contains static methods for verifying that assertions
+ * hold and reporting the violation when they do not.
+ */
public class MatcherAssert {
+
+ /**
+ * Verifies that matcher
matches actual
.
+ * Convenience method for performing an assertion without supplying a reason.
+ * Equivalent to assertThat("", actual, matcher)
.
+ *
+ * @see {@link MatcherAssert#assertThat(String, Object, Matcher)}
+ *
+ * @param The type of the actual value to match.
+ * @param actual A value to test.
+ * @param matcher The matcher to use for matching the actual value
+ */
public static void assertThat(T actual, Matcher super T> matcher) {
assertThat("", actual, matcher);
}
+ /**
+ * Verifies that matcher
matches actual
. If the matcher
+ * does not match the actual value, this method throws an AssertionError
+ * with a description of the mismatch.
+ *
+ * @param The type of the actual value to match.
+ * @param reason A reason for explaining the mismatch.
+ * @param actual A value to test.
+ * @param matcher The matcher to use for matching the actual value
+ */
public static void assertThat(String reason, T actual, Matcher super T> matcher) {
if (!matcher.matches(actual)) {
Description description = new StringDescription();
@@ -19,6 +45,14 @@ public static void assertThat(String reason, T actual, Matcher super T> ma
}
}
+ /**
+ * Verifies that assertion
evaluates to true
, and
+ * throws an AssertionError
with the message reason
+ * if it does not.
+ *
+ * @param reason The message use to report an assertion failure.
+ * @param assertion An expression expected to evaluate to true
.
+ */
public static void assertThat(String reason, boolean assertion) {
if (!assertion) {
throw new AssertionError(reason);