Skip to content

Commit fce23bf

Browse files
committed
JavaDoc only @return org.hamcrest
1 parent f627f9b commit fce23bf

File tree

6 files changed

+238
-0
lines changed

6 files changed

+238
-0
lines changed

hamcrest/src/main/java/org/hamcrest/CoreMatchers.java

+58
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ public class CoreMatchers {
99
* Creates a matcher that matches if the examined object matches <b>ALL</b> of the specified matchers.
1010
* For example:
1111
* <pre>assertThat("myValue", allOf(startsWith("my"), containsString("Val")))</pre>
12+
*
13+
* @return The matcher.
1214
*/
1315
public static <T> org.hamcrest.Matcher<T> allOf(java.lang.Iterable<org.hamcrest.Matcher<? super T>> matchers) {
1416
return org.hamcrest.core.AllOf.allOf(matchers);
@@ -18,6 +20,8 @@ public static <T> org.hamcrest.Matcher<T> allOf(java.lang.Iterable<org.hamcrest.
1820
* Creates a matcher that matches if the examined object matches <b>ALL</b> of the specified matchers.
1921
* For example:
2022
* <pre>assertThat("myValue", allOf(startsWith("my"), containsString("Val")))</pre>
23+
*
24+
* @return The matcher.
2125
*/
2226
@SafeVarargs
2327
public static <T> org.hamcrest.Matcher<T> allOf(org.hamcrest.Matcher<? super T>... matchers) {
@@ -29,6 +33,8 @@ public static <T> org.hamcrest.Matcher<T> allOf(org.hamcrest.Matcher<? super T>.
2933
* Creates a matcher that matches if the examined object matches <b>ANY</b> of the specified matchers.
3034
* For example:
3135
* <pre>assertThat("myValue", anyOf(startsWith("foo"), containsString("Val")))</pre>
36+
*
37+
* @return The matcher.
3238
*/
3339
public static <T> org.hamcrest.core.AnyOf<T> anyOf(java.lang.Iterable<org.hamcrest.Matcher<? super T>> matchers) {
3440
return org.hamcrest.core.AnyOf.anyOf(matchers);
@@ -38,6 +44,8 @@ public static <T> org.hamcrest.core.AnyOf<T> anyOf(java.lang.Iterable<org.hamcre
3844
* Creates a matcher that matches if the examined object matches <b>ANY</b> of the specified matchers.
3945
* For example:
4046
* <pre>assertThat("myValue", anyOf(startsWith("foo"), containsString("Val")))</pre>
47+
*
48+
* @return The matcher.
4149
*/
4250
@SafeVarargs
4351
public static <T> org.hamcrest.core.AnyOf<T> anyOf(org.hamcrest.Matcher<? super T>... matchers) {
@@ -48,6 +56,8 @@ public static <T> org.hamcrest.core.AnyOf<T> anyOf(org.hamcrest.Matcher<? super
4856
* Creates a matcher that matches when both of the specified matchers match the examined object.
4957
* For example:
5058
* <pre>assertThat("fab", both(containsString("a")).and(containsString("b")))</pre>
59+
*
60+
* @return The matcher.
5161
*/
5262
public static <LHS> org.hamcrest.core.CombinableMatcher.CombinableBothMatcher<LHS> both(org.hamcrest.Matcher<? super LHS> matcher) {
5363
return org.hamcrest.core.CombinableMatcher.both(matcher);
@@ -57,6 +67,8 @@ public static <LHS> org.hamcrest.core.CombinableMatcher.CombinableBothMatcher<LH
5767
* Creates a matcher that matches when either of the specified matchers match the examined object.
5868
* For example:
5969
* <pre>assertThat("fan", either(containsString("a")).or(containsString("b")))</pre>
70+
*
71+
* @return The matcher.
6072
*/
6173
public static <LHS> org.hamcrest.core.CombinableMatcher.CombinableEitherMatcher<LHS> either(org.hamcrest.Matcher<? super LHS> matcher) {
6274
return org.hamcrest.core.CombinableMatcher.either(matcher);
@@ -74,6 +86,8 @@ public static <LHS> org.hamcrest.core.CombinableMatcher.CombinableEitherMatcher<
7486
* the matcher to wrap
7587
* @param values
7688
* optional values to insert into the tokenised description
89+
*
90+
* @return The matcher.
7791
*/
7892
public static <T> org.hamcrest.Matcher<T> describedAs(java.lang.String description, org.hamcrest.Matcher<T> matcher, java.lang.Object... values) {
7993
return org.hamcrest.core.DescribedAs.describedAs(description, matcher, values);
@@ -88,6 +102,8 @@ public static <T> org.hamcrest.Matcher<T> describedAs(java.lang.String descripti
88102
*
89103
* @param itemMatcher
90104
* the matcher to apply to every item provided by the examined {@link Iterable}
105+
*
106+
* @return The matcher.
91107
*/
92108
public static <U> org.hamcrest.Matcher<java.lang.Iterable<? extends U>> everyItem(org.hamcrest.Matcher<U> itemMatcher) {
93109
return org.hamcrest.core.Every.everyItem(itemMatcher);
@@ -100,6 +116,8 @@ public static <U> org.hamcrest.Matcher<java.lang.Iterable<? extends U>> everyIte
100116
* <pre>assertThat(cheese, is(equalTo(smelly)))</pre>
101117
* instead of:
102118
* <pre>assertThat(cheese, equalTo(smelly))</pre>
119+
*
120+
* @return The matcher.
103121
*/
104122
public static <T> org.hamcrest.Matcher<T> is(org.hamcrest.Matcher<T> matcher) {
105123
return org.hamcrest.core.Is.is(matcher);
@@ -111,6 +129,8 @@ public static <T> org.hamcrest.Matcher<T> is(org.hamcrest.Matcher<T> matcher) {
111129
* <pre>assertThat(cheese, is(smelly))</pre>
112130
* instead of:
113131
* <pre>assertThat(cheese, is(equalTo(smelly)))</pre>
132+
*
133+
* @return The matcher.
114134
*/
115135
public static <T> org.hamcrest.Matcher<T> is(T value) {
116136
return org.hamcrest.core.Is.is(value);
@@ -122,13 +142,17 @@ public static <T> org.hamcrest.Matcher<T> is(T value) {
122142
* <pre>assertThat(cheese, isA(Cheddar.class))</pre>
123143
* instead of:
124144
* <pre>assertThat(cheese, is(instanceOf(Cheddar.class)))</pre>
145+
*
146+
* @return The matcher.
125147
*/
126148
public static <T> org.hamcrest.Matcher<T> isA(java.lang.Class<T> type) {
127149
return org.hamcrest.core.Is.isA(type);
128150
}
129151

130152
/**
131153
* Creates a matcher that always matches, regardless of the examined object.
154+
*
155+
* @return The matcher.
132156
*/
133157
public static org.hamcrest.Matcher<java.lang.Object> anything() {
134158
return org.hamcrest.core.IsAnything.anything();
@@ -140,6 +164,8 @@ public static org.hamcrest.Matcher<java.lang.Object> anything() {
140164
*
141165
* @param description
142166
* a meaningful {@link String} used when describing itself
167+
*
168+
* @return The matcher.
143169
*/
144170
public static org.hamcrest.Matcher<java.lang.Object> anything(java.lang.String description) {
145171
return org.hamcrest.core.IsAnything.anything(description);
@@ -155,6 +181,8 @@ public static org.hamcrest.Matcher<java.lang.Object> anything(java.lang.String d
155181
*
156182
* @param itemMatcher
157183
* the matcher to apply to items provided by the examined {@link Iterable}
184+
*
185+
* @return The matcher.
158186
*/
159187
public static <T> org.hamcrest.Matcher<java.lang.Iterable<? super T>> hasItem(org.hamcrest.Matcher<? super T> itemMatcher) {
160188
return IsIterableContaining.hasItem(itemMatcher);
@@ -170,6 +198,8 @@ public static <T> org.hamcrest.Matcher<java.lang.Iterable<? super T>> hasItem(or
170198
*
171199
* @param item
172200
* the item to compare against the items provided by the examined {@link Iterable}
201+
*
202+
* @return The matcher.
173203
*/
174204
public static <T> org.hamcrest.Matcher<java.lang.Iterable<? super T>> hasItem(T item) {
175205
return IsIterableContaining.hasItem(item);
@@ -185,6 +215,8 @@ public static <T> org.hamcrest.Matcher<java.lang.Iterable<? super T>> hasItem(T
185215
*
186216
* @param itemMatchers
187217
* the matchers to apply to items provided by the examined {@link Iterable}
218+
*
219+
* @return The matcher.
188220
*/
189221
@SafeVarargs
190222
public static <T> org.hamcrest.Matcher<java.lang.Iterable<T>> hasItems(org.hamcrest.Matcher<? super T>... itemMatchers) {
@@ -201,6 +233,8 @@ public static <T> org.hamcrest.Matcher<java.lang.Iterable<T>> hasItems(org.hamcr
201233
*
202234
* @param items
203235
* the items to compare against the items provided by the examined {@link Iterable}
236+
*
237+
* @return The matcher.
204238
*/
205239
@SafeVarargs
206240
public static <T> org.hamcrest.Matcher<java.lang.Iterable<T>> hasItems(T... items) {
@@ -227,6 +261,8 @@ public static <T> org.hamcrest.Matcher<java.lang.Iterable<T>> hasItems(T... item
227261
* assertThat("foo", equalTo("foo"));
228262
* assertThat(new String[] {"foo", "bar"}, equalTo(new String[] {"foo", "bar"}));
229263
* </pre>
264+
*
265+
* @return The matcher.
230266
*/
231267
public static <T> org.hamcrest.Matcher<T> equalTo(T operand) {
232268
return org.hamcrest.core.IsEqual.equalTo(operand);
@@ -235,6 +271,8 @@ public static <T> org.hamcrest.Matcher<T> equalTo(T operand) {
235271
/**
236272
* Creates an {@link org.hamcrest.core.IsEqual} matcher that does not enforce the values being
237273
* compared to be of the same static type.
274+
*
275+
* @return The matcher.
238276
*/
239277
public static org.hamcrest.Matcher<java.lang.Object> equalToObject(java.lang.Object operand) {
240278
return org.hamcrest.core.IsEqual.equalToObject(operand);
@@ -250,6 +288,8 @@ public static org.hamcrest.Matcher<java.lang.Object> equalToObject(java.lang.Obj
250288
* <code>with(any(Thing.class))</code></p>
251289
* For example:
252290
* <pre>assertThat(new Canoe(), any(Canoe.class));</pre>
291+
*
292+
* @return The matcher.
253293
*/
254294
public static <T> org.hamcrest.Matcher<T> any(java.lang.Class<T> type) {
255295
return org.hamcrest.core.IsInstanceOf.any(type);
@@ -263,6 +303,8 @@ public static <T> org.hamcrest.Matcher<T> any(java.lang.Class<T> type) {
263303
* <p>The created matcher assumes no relationship between specified type and the examined object.</p>
264304
* For example:
265305
* <pre>assertThat(new Canoe(), instanceOf(Paddlable.class));</pre>
306+
*
307+
* @return The matcher.
266308
*/
267309
public static <T> org.hamcrest.Matcher<T> instanceOf(java.lang.Class<?> type) {
268310
return org.hamcrest.core.IsInstanceOf.instanceOf(type);
@@ -276,6 +318,7 @@ public static <T> org.hamcrest.Matcher<T> instanceOf(java.lang.Class<?> type) {
276318
*
277319
* @param matcher
278320
* the matcher whose sense should be inverted
321+
* @return The matcher.
279322
*/
280323
public static <T> org.hamcrest.Matcher<T> not(org.hamcrest.Matcher<T> matcher) {
281324
return org.hamcrest.core.IsNot.not(matcher);
@@ -290,6 +333,7 @@ public static <T> org.hamcrest.Matcher<T> not(org.hamcrest.Matcher<T> matcher) {
290333
*
291334
* @param value
292335
* the value that any examined object should <b>not</b> equal
336+
* @return The matcher.
293337
*/
294338
public static <T> org.hamcrest.Matcher<T> not(T value) {
295339
return org.hamcrest.core.IsNot.not(value);
@@ -301,6 +345,8 @@ public static <T> org.hamcrest.Matcher<T> not(T value) {
301345
* <pre>assertThat(cheese, is(notNullValue()))</pre>
302346
* instead of:
303347
* <pre>assertThat(cheese, is(not(nullValue())))</pre>
348+
*
349+
* @return The matcher.
304350
*/
305351
public static org.hamcrest.Matcher<java.lang.Object> notNullValue() {
306352
return org.hamcrest.core.IsNull.notNullValue();
@@ -316,6 +362,7 @@ public static org.hamcrest.Matcher<java.lang.Object> notNullValue() {
316362
*
317363
* @param type
318364
* dummy parameter used to infer the generic type of the returned matcher
365+
* @return The matcher.
319366
*/
320367
public static <T> org.hamcrest.Matcher<T> notNullValue(java.lang.Class<T> type) {
321368
return org.hamcrest.core.IsNull.notNullValue(type);
@@ -325,6 +372,8 @@ public static <T> org.hamcrest.Matcher<T> notNullValue(java.lang.Class<T> type)
325372
* Creates a matcher that matches if examined object is <code>null</code>.
326373
* For example:
327374
* <pre>assertThat(cheese, is(nullValue())</pre>
375+
*
376+
* @return The matcher.
328377
*/
329378
public static org.hamcrest.Matcher<java.lang.Object> nullValue() {
330379
return org.hamcrest.core.IsNull.nullValue();
@@ -338,6 +387,7 @@ public static org.hamcrest.Matcher<java.lang.Object> nullValue() {
338387
*
339388
* @param type
340389
* dummy parameter used to infer the generic type of the returned matcher
390+
* @return The matcher.
341391
*/
342392
public static <T> org.hamcrest.Matcher<T> nullValue(java.lang.Class<T> type) {
343393
return org.hamcrest.core.IsNull.nullValue(type);
@@ -349,6 +399,7 @@ public static <T> org.hamcrest.Matcher<T> nullValue(java.lang.Class<T> type) {
349399
*
350400
* @param target
351401
* the target instance against which others should be assessed
402+
* @return The matcher.
352403
*/
353404
public static <T> org.hamcrest.Matcher<T> sameInstance(T target) {
354405
return org.hamcrest.core.IsSame.sameInstance(target);
@@ -360,6 +411,7 @@ public static <T> org.hamcrest.Matcher<T> sameInstance(T target) {
360411
*
361412
* @param target
362413
* the target instance against which others should be assessed
414+
* @return The matcher.
363415
*/
364416
public static <T> org.hamcrest.Matcher<T> theInstance(T target) {
365417
return org.hamcrest.core.IsSame.theInstance(target);
@@ -373,6 +425,7 @@ public static <T> org.hamcrest.Matcher<T> theInstance(T target) {
373425
*
374426
* @param substring
375427
* the substring that the returned matcher will expect to find within any examined string
428+
* @return The matcher.
376429
*/
377430
public static org.hamcrest.Matcher<java.lang.String> containsString(java.lang.String substring) {
378431
return org.hamcrest.core.StringContains.containsString(substring);
@@ -386,6 +439,7 @@ public static org.hamcrest.Matcher<java.lang.String> containsString(java.lang.St
386439
*
387440
* @param substring
388441
* the substring that the returned matcher will expect to find within any examined string
442+
* @return The matcher.
389443
*/
390444
public static org.hamcrest.Matcher<java.lang.String> containsStringIgnoringCase(java.lang.String substring) {
391445
return org.hamcrest.core.StringContains.containsStringIgnoringCase(substring);
@@ -401,6 +455,7 @@ public static org.hamcrest.Matcher<java.lang.String> containsStringIgnoringCase(
401455
*
402456
* @param prefix
403457
* the substring that the returned matcher will expect at the start of any examined string
458+
* @return The matcher.
404459
*/
405460
public static org.hamcrest.Matcher<java.lang.String> startsWith(java.lang.String prefix) {
406461
return org.hamcrest.core.StringStartsWith.startsWith(prefix);
@@ -416,6 +471,7 @@ public static org.hamcrest.Matcher<java.lang.String> startsWith(java.lang.String
416471
*
417472
* @param prefix
418473
* the substring that the returned matcher will expect at the start of any examined string
474+
* @return The matcher.
419475
*/
420476
public static org.hamcrest.Matcher<java.lang.String> startsWithIgnoringCase(java.lang.String prefix) {
421477
return org.hamcrest.core.StringStartsWith.startsWithIgnoringCase(prefix);
@@ -429,6 +485,7 @@ public static org.hamcrest.Matcher<java.lang.String> startsWithIgnoringCase(java
429485
*
430486
* @param suffix
431487
* the substring that the returned matcher will expect at the end of any examined string
488+
* @return The matcher.
432489
*/
433490
public static org.hamcrest.Matcher<java.lang.String> endsWith(java.lang.String suffix) {
434491
return org.hamcrest.core.StringEndsWith.endsWith(suffix);
@@ -442,6 +499,7 @@ public static org.hamcrest.Matcher<java.lang.String> endsWith(java.lang.String s
442499
*
443500
* @param suffix
444501
* the substring that the returned matcher will expect at the end of any examined string
502+
* @return The matcher.
445503
*/
446504
public static org.hamcrest.Matcher<java.lang.String> endsWithIgnoringCase(java.lang.String suffix) {
447505
return org.hamcrest.core.StringEndsWith.endsWithIgnoringCase(suffix);

hamcrest/src/main/java/org/hamcrest/Description.java

+12
Original file line numberDiff line numberDiff line change
@@ -14,34 +14,46 @@ public interface Description {
1414

1515
/**
1616
* Appends some plain text to the description.
17+
*
18+
* @return the update description when displaying the matcher error.
1719
*/
1820
Description appendText(String text);
1921

2022
/**
2123
* Appends the description of a {@link SelfDescribing} value to this description.
24+
*
25+
* @return the update description when displaying the matcher error.
2226
*/
2327
Description appendDescriptionOf(SelfDescribing value);
2428

2529
/**
2630
* Appends an arbitrary value to the description.
31+
*
32+
* @return the update description when displaying the matcher error.
2733
*/
2834
Description appendValue(Object value);
2935

3036
/**
3137
* Appends a list of values to the description.
38+
*
39+
* @return the update description when displaying the matcher error.
3240
*/
3341
<T> Description appendValueList(String start, String separator, String end,
3442
T... values);
3543

3644
/**
3745
* Appends a list of values to the description.
46+
*
47+
* @return the update description when displaying the matcher error.
3848
*/
3949
<T> Description appendValueList(String start, String separator, String end,
4050
Iterable<T> values);
4151

4252
/**
4353
* Appends a list of {@link org.hamcrest.SelfDescribing} objects
4454
* to the description.
55+
*
56+
* @return the update description when displaying the matcher error.
4557
*/
4658
Description appendList(String start, String separator, String end,
4759
Iterable<? extends SelfDescribing> values);

0 commit comments

Comments
 (0)