Skip to content

Commit 54f1a53

Browse files
committed
JavaDoc only @return org.hamcrest.collection
1 parent 60b28d2 commit 54f1a53

15 files changed

Lines changed: 63 additions & 2 deletions

hamcrest/src/main/java/org/hamcrest/collection/ArrayMatching.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ public class ArrayMatching {
2626
*
2727
* @param elementMatcher
2828
* the matcher to apply to elements in examined arrays
29+
* @return The matcher.
2930
*/
3031
public static <T> Matcher<T[]> hasItemInArray(Matcher<? super T> elementMatcher) {
3132
return new HasItemInArray<>(elementMatcher);
@@ -40,6 +41,7 @@ public static <T> Matcher<T[]> hasItemInArray(Matcher<? super T> elementMatcher)
4041
*
4142
* @param element
4243
* the element that should be present in examined arrays
44+
* @return The matcher.
4345
*/
4446
public static <T> Matcher<T[]> hasItemInArray(T element) {
4547
return hasItemInArray(equalTo(element));
@@ -64,6 +66,7 @@ public static <T> Matcher<T[]> hasItemInArray(T element) {
6466
*
6567
* @param itemMatchers
6668
* a list of matchers, each of which must be satisfied by an entry in an examined array
69+
* @return The matcher.
6770
*/
6871
@SafeVarargs
6972
public static <E> Matcher<E[]> arrayContainingInAnyOrder(Matcher<? super E>... itemMatchers) {
@@ -89,6 +92,7 @@ public static <E> Matcher<E[]> arrayContainingInAnyOrder(Matcher<? super E>... i
8992
*
9093
* @param itemMatchers
9194
* a list of matchers, each of which must be satisfied by an item provided by an examined array
95+
* @return The matcher.
9296
*/
9397
public static <E> Matcher<E[]> arrayContainingInAnyOrder(Collection<Matcher<? super E>> itemMatchers) {
9498
return new ArrayAsIterableMatcher<>(new IsIterableContainingInAnyOrder<>(itemMatchers), itemMatchers, "in any order");
@@ -111,6 +115,7 @@ public static <E> Matcher<E[]> arrayContainingInAnyOrder(Collection<Matcher<? su
111115
*
112116
* @param items
113117
* the items that must equal the entries of an examined array, in any order
118+
* @return The matcher.
114119
*/
115120
@SafeVarargs
116121
public static <E> Matcher<E[]> arrayContainingInAnyOrder(E... items) {
@@ -126,6 +131,7 @@ public static <E> Matcher<E[]> arrayContainingInAnyOrder(E... items) {
126131
*
127132
* @param items
128133
* the items that must equal the items within an examined array
134+
* @return The matcher.
129135
*/
130136
@SafeVarargs
131137
public static <E> Matcher<E[]> arrayContaining(E... items) {
@@ -140,6 +146,7 @@ public static <E> Matcher<E[]> arrayContaining(E... items) {
140146
*
141147
* @param itemMatchers
142148
* the matchers that must be satisfied by the items in the examined array
149+
* @return The matcher.
143150
*/
144151
@SafeVarargs
145152
public static <E> Matcher<E[]> arrayContaining(Matcher<? super E>... itemMatchers) {
@@ -159,6 +166,7 @@ public static <E> Matcher<E[]> arrayContaining(Matcher<? super E>... itemMatcher
159166
*
160167
* @param itemMatchers
161168
* a list of matchers, each of which must be satisfied by the corresponding item in an examined array
169+
* @return The matcher.
162170
*/
163171
public static <E> Matcher<E[]> arrayContaining(List<Matcher<? super E>> itemMatchers) {
164172
return new ArrayAsIterableMatcher<>(new IsIterableContainingInOrder<>(itemMatchers), itemMatchers, "");

hamcrest/src/main/java/org/hamcrest/collection/IsArray.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@ public void describeTo(Description description) {
5555
*
5656
* Can be overridden in subclasses to customise how the matcher is
5757
* described.
58+
*
59+
* @return The description prefix.
5860
*/
5961
protected String descriptionStart() {
6062
return "[";
@@ -65,6 +67,8 @@ protected String descriptionStart() {
6567
*
6668
* Can be overridden in subclasses to customise how the matcher is
6769
* described.
70+
*
71+
* @return The description separator.
6872
*/
6973
protected String descriptionSeparator() {
7074
return ", ";
@@ -75,6 +79,8 @@ protected String descriptionSeparator() {
7579
*
7680
* Can be overridden in subclasses to customise how the matcher is
7781
* described.
82+
*
83+
* @return The description suffix.
7884
*/
7985
protected String descriptionEnd() {
8086
return "]";
@@ -89,6 +95,7 @@ protected String descriptionEnd() {
8995
*
9096
* @param elementMatchers
9197
* the matchers that the elements of examined arrays should satisfy
98+
* @return The matcher.
9299
*/
93100
public static <T> IsArray<T> array(Matcher<? super T>... elementMatchers) {
94101
return new IsArray<T>(elementMatchers);

hamcrest/src/main/java/org/hamcrest/collection/IsArrayContainingInAnyOrder.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ public void describeTo(Description description) {
5757
*
5858
* @param itemMatchers
5959
* a list of matchers, each of which must be satisfied by an entry in an examined array
60+
* @return The matcher.
6061
*/
6162
public static <E> Matcher<E[]> arrayContainingInAnyOrder(Matcher<? super E>... itemMatchers) {
6263
return arrayContainingInAnyOrder(Arrays.asList(itemMatchers));
@@ -79,6 +80,7 @@ public static <E> Matcher<E[]> arrayContainingInAnyOrder(Matcher<? super E>... i
7980
*
8081
* @param itemMatchers
8182
* a list of matchers, each of which must be satisfied by an item provided by an examined array
83+
* @return The matcher.
8284
*/
8385
public static <E> Matcher<E[]> arrayContainingInAnyOrder(Collection<Matcher<? super E>> itemMatchers) {
8486
return new IsArrayContainingInAnyOrder<E>(itemMatchers);
@@ -101,6 +103,7 @@ public static <E> Matcher<E[]> arrayContainingInAnyOrder(Collection<Matcher<? su
101103
*
102104
* @param items
103105
* the items that must equal the entries of an examined array, in any order
106+
* @return The matcher.
104107
*/
105108
public static <E> Matcher<E[]> arrayContainingInAnyOrder(E... items) {
106109
List<Matcher<? super E>> matchers = new ArrayList<Matcher<? super E>>();

hamcrest/src/main/java/org/hamcrest/collection/IsArrayContainingInOrder.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ public void describeTo(Description description) {
5050
*
5151
* @param items
5252
* the items that must equal the items within an examined array
53+
* @return The matcher.
5354
*/
5455
public static <E> Matcher<E[]> arrayContaining(E... items) {
5556
List<Matcher<? super E>> matchers = new ArrayList<Matcher<? super E>>();
@@ -71,6 +72,7 @@ public static <E> Matcher<E[]> arrayContaining(E... items) {
7172
*
7273
* @param itemMatchers
7374
* the matchers that must be satisfied by the items in the examined array
75+
* @return The matcher.
7476
*/
7577
public static <E> Matcher<E[]> arrayContaining(Matcher<? super E>... itemMatchers) {
7678
return arrayContaining(asList(itemMatchers));
@@ -88,6 +90,7 @@ public static <E> Matcher<E[]> arrayContaining(Matcher<? super E>... itemMatcher
8890
*
8991
* @param itemMatchers
9092
* a list of matchers, each of which must be satisfied by the corresponding item in an examined array
93+
* @return The matcher.
9194
*/
9295
public static <E> Matcher<E[]> arrayContaining(List<Matcher<? super E>> itemMatchers) {
9396
return new IsArrayContainingInOrder<E>(itemMatchers);

hamcrest/src/main/java/org/hamcrest/collection/IsArrayWithSize.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ protected Integer featureValueOf(E[] actual) {
2727
*
2828
* @param sizeMatcher
2929
* a matcher for the length of an examined array
30+
* @return The matcher.
3031
*/
3132
public static <E> Matcher<E[]> arrayWithSize(Matcher<? super Integer> sizeMatcher) {
3233
return new IsArrayWithSize<>(sizeMatcher);
@@ -40,6 +41,7 @@ public static <E> Matcher<E[]> arrayWithSize(Matcher<? super Integer> sizeMatche
4041
*
4142
* @param size
4243
* the length that an examined array must have for a positive match
44+
* @return The matcher.
4345
*/
4446
public static <E> Matcher<E[]> arrayWithSize(int size) {
4547
return arrayWithSize(equalTo(size));
@@ -50,6 +52,8 @@ public static <E> Matcher<E[]> arrayWithSize(int size) {
5052
* is zero.
5153
* For example:
5254
* <pre>assertThat(new String[0], emptyArray())</pre>
55+
*
56+
* @return The matcher.
5357
*/
5458
public static <E> Matcher<E[]> emptyArray() {
5559
return describedAs("an empty array", IsArrayWithSize.<E>arrayWithSize(0));

hamcrest/src/main/java/org/hamcrest/collection/IsCollectionWithSize.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ protected Integer featureValueOf(Collection<? extends E> actual) {
2828
*
2929
* @param sizeMatcher
3030
* a matcher for the size of an examined {@link java.util.Collection}
31+
* @return The matcher.
3132
*/
3233
public static <E> Matcher<Collection<? extends E>> hasSize(Matcher<? super Integer> sizeMatcher) {
3334
return new IsCollectionWithSize<E>(sizeMatcher);
@@ -41,6 +42,7 @@ public static <E> Matcher<Collection<? extends E>> hasSize(Matcher<? super Integ
4142
*
4243
* @param size
4344
* the expected size of an examined {@link java.util.Collection}
45+
* @return The matcher.
4446
*/
4547
@SuppressWarnings({ "rawtypes", "unchecked" })
4648
public static <E> Matcher<Collection<? extends E>> hasSize(int size) {

hamcrest/src/main/java/org/hamcrest/collection/IsEmptyCollection.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ public void describeTo(Description description) {
3131
* method returns <code>true</code>.
3232
* For example:
3333
* <pre>assertThat(new ArrayList&lt;String&gt;(), is(empty()))</pre>
34+
*
35+
* @return The matcher.
3436
*/
3537
public static <E> Matcher<Collection<? extends E>> empty() {
3638
return new IsEmptyCollection<E>();
@@ -44,6 +46,7 @@ public static <E> Matcher<Collection<? extends E>> empty() {
4446
*
4547
* @param unusedToForceReturnType
4648
* the type of the collection's content
49+
* @return The matcher.
4750
*/
4851
@SuppressWarnings({"unchecked", "UnusedParameters"})
4952
public static <E> Matcher<Collection<E>> emptyCollectionOf(Class<E> unusedToForceReturnType) {

hamcrest/src/main/java/org/hamcrest/collection/IsEmptyIterable.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ public void describeTo(Description description) {
2727
* Creates a matcher for {@link Iterable}s matching examined iterables that yield no items.
2828
* For example:
2929
* <pre>assertThat(new ArrayList&lt;String&gt;(), is(emptyIterable()))</pre>
30+
*
31+
* @return The matcher.
3032
*/
3133
public static <E> Matcher<Iterable<? extends E>> emptyIterable() {
3234
return new IsEmptyIterable<E>();
@@ -39,6 +41,7 @@ public static <E> Matcher<Iterable<? extends E>> emptyIterable() {
3941
*
4042
* @param unusedToForceReturnType
4143
* the type of the iterable's content
44+
* @return The matcher.
4245
*/
4346
@SuppressWarnings({"unchecked", "UnusedParameters"})
4447
public static <E> Matcher<Iterable<E>> emptyIterableOf(Class<E> unusedToForceReturnType) {

hamcrest/src/main/java/org/hamcrest/collection/IsIn.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ public void describeTo(Description buffer) {
4040
*
4141
* @param collection
4242
* the collection in which matching items must be found
43+
* @return The matcher.
4344
*/
4445
@Deprecated
4546
public static <T> Matcher<T> isIn(Collection<T> collection) {
@@ -54,6 +55,7 @@ public static <T> Matcher<T> isIn(Collection<T> collection) {
5455
*
5556
* @param collection
5657
* the collection in which matching items must be found
58+
* @return The matcher.
5759
*/
5860
public static <T> Matcher<T> in(Collection<T> collection) {
5961
return new IsIn<>(collection);
@@ -69,6 +71,7 @@ public static <T> Matcher<T> in(Collection<T> collection) {
6971
*
7072
* @param elements
7173
* the array in which matching items must be found
74+
* @return The matcher.
7275
*/
7376
@Deprecated
7477
public static <T> Matcher<T> isIn(T[] elements) {
@@ -83,6 +86,7 @@ public static <T> Matcher<T> isIn(T[] elements) {
8386
*
8487
* @param elements
8588
* the array in which matching items must be found
89+
* @return The matcher.
8690
*/
8791
public static <T> Matcher<T> in(T[] elements) {
8892
return new IsIn<>(elements);
@@ -97,7 +101,8 @@ public static <T> Matcher<T> in(T[] elements) {
97101
* @deprecated use is(oneOf(...)) instead
98102
*
99103
* @param elements
100-
* the elements amongst which matching items will be found
104+
* the elements amongst which matching items will be found
105+
* @return The matcher.
101106
*/
102107
@SafeVarargs
103108
@Deprecated
@@ -112,7 +117,8 @@ public static <T> Matcher<T> isOneOf(T... elements) {
112117
* <pre>assertThat("foo", is(oneOf("bar", "foo")))</pre>
113118
*
114119
* @param elements
115-
* the elements amongst which matching items will be found
120+
* the elements amongst which matching items will be found
121+
* @return The matcher.
116122
*/
117123
@SafeVarargs
118124
public static <T> Matcher<T> oneOf(T... elements) {

hamcrest/src/main/java/org/hamcrest/collection/IsIterableContainingInAnyOrder.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ private boolean isMatched(S item) {
9595
*
9696
* @param itemMatchers
9797
* a list of matchers, each of which must be satisfied by an item provided by an examined {@link Iterable}
98+
* @return The matcher.
9899
*/
99100
@SafeVarargs
100101
public static <T> Matcher<Iterable<? extends T>> containsInAnyOrder(Matcher<? super T>... itemMatchers) {
@@ -120,6 +121,7 @@ public static <T> Matcher<Iterable<? extends T>> containsInAnyOrder(Matcher<? su
120121
*
121122
* @param items
122123
* the items that must equal the items provided by an examined {@link Iterable} in any order
124+
* @return The matcher.
123125
*/
124126
@SafeVarargs
125127
public static <T> Matcher<Iterable<? extends T>> containsInAnyOrder(T... items) {
@@ -148,6 +150,7 @@ public static <T> Matcher<Iterable<? extends T>> containsInAnyOrder(T... items)
148150
*
149151
* @param itemMatchers
150152
* a list of matchers, each of which must be satisfied by an item provided by an examined {@link Iterable}
153+
* @return The matcher.
151154
*/
152155
public static <T> Matcher<Iterable<? extends T>> containsInAnyOrder(Collection<Matcher<? super T>> itemMatchers) {
153156
return new IsIterableContainingInAnyOrder<>(itemMatchers);

0 commit comments

Comments
 (0)