Skip to content

Commit ebfc82d

Browse files
author
joe.walnes
committed
More JavaDoc for core matchers.
1 parent 0b62f3c commit ebfc82d

5 files changed

Lines changed: 24 additions & 5 deletions

File tree

hamcrest-core/src/main/java/org/hamcrest/core/AllOf.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,17 @@ public void describeTo(Description description) {
4242
description.appendText(")");
4343
}
4444

45+
/**
46+
* MM Evaluates to true only if ALL of the passed in matchers evaluate to true.
47+
*/
4548
@Factory
4649
public static <T> Matcher<T> allOf(Matcher<T>... matchers) {
4750
return allOf(Arrays.asList(matchers));
4851
}
4952

53+
/**
54+
* IM Evaluates to true only if ALL of the passed in matchers evaluate to true.
55+
*/
5056
@Factory
5157
public static <T> Matcher<T> allOf(Iterable<Matcher<T>> matchers) {
5258
return new AllOf<T>(matchers);

hamcrest-core/src/main/java/org/hamcrest/core/AnyOf.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,17 @@ public void describeTo(Description description) {
4343
description.appendText(")");
4444
}
4545

46+
/**
47+
* Evaluates to true if ANY of the passed in matchers evaluate to true.
48+
*/
4649
@Factory
4750
public static <T> Matcher<T> anyOf(Matcher<T>... matchers) {
4851
return anyOf(Arrays.asList(matchers));
4952
}
5053

54+
/**
55+
* Evaluates to true if ANY of the passed in matchers evaluate to true.
56+
*/
5157
@Factory
5258
public static <T> Matcher<T> anyOf(Iterable<Matcher<T>> matchers) {
5359
return new AnyOf<T>(matchers);

hamcrest-core/src/main/java/org/hamcrest/core/DescribedAs.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,10 @@ public void describeTo(Description description) {
4444
description.appendText(descriptionTemplate.substring(textStart));
4545
}
4646
}
47-
47+
48+
/**
49+
* Wraps an existing matcher and overrides the description when it fails.
50+
*/
4851
@Factory
4952
public static <T> Matcher<T> describedAs(String description, Matcher<T> matcher, Object... values) {
5053
return new DescribedAs<T>(description, matcher, values);

hamcrest-core/src/main/java/org/hamcrest/core/IsInstanceOf.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,12 @@ public void describeTo(Description description) {
3333
.appendText(theClass.getName());
3434
}
3535

36+
/**
37+
* Is the value an instance of a particular type?
38+
*/
3639
@Factory
37-
public static <T> Matcher<T> instanceOf(Class<T> instanceOf) {
38-
return new IsInstanceOf<T>(instanceOf);
40+
public static <T> Matcher<T> instanceOf(Class<T> type) {
41+
return new IsInstanceOf<T>(type);
3942
}
4043

4144
}

hamcrest-generator/src/main/java/org/hamcrest/generator/ReflectiveFactoryReader.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,11 +73,12 @@ public void remove() {
7373
* <p/>
7474
* <p>The rules for determining this are:
7575
* 1. The method must be public static.
76-
* 2. It must have a return type of {@link Matcher} (or something that extends this).
77-
* 3. It must be marked with the {@link Factory} annotation.
76+
* 2. It must have a return type of org.hamcrest.Matcher (or something that extends this).
77+
* 3. It must be marked with the org.hamcrest.Factory annotation.
7878
* <p/>
7979
* <p>To use another set of rules, override this method.
8080
*/
81+
@SuppressWarnings({"unchecked"})
8182
protected boolean isFactoryMethod(Method javaMethod) {
8283
// We dynamically load these classes, to avoid a compile time
8384
// dependency on org.hamcrest.{Factory,Matcher}. This gets around

0 commit comments

Comments
 (0)