Skip to content

Commit eccc8c4

Browse files
committed
Merge pull request #2966 from ReactiveX/javadocs
The usual anally-retentive javadoc edits.
2 parents 03332a2 + 536d019 commit eccc8c4

File tree

1 file changed

+46
-6
lines changed

1 file changed

+46
-6
lines changed

src/main/java/rx/observers/TestSubscriber.java

Lines changed: 46 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,9 @@ public void onNext(Object t) {
5656

5757
/**
5858
* Constructs a TestSubscriber with the initial request to be requested from upstream.
59+
*
5960
* @param initialRequest the initial request value, negative value will revert to the default unbounded behavior
61+
* @since (if this graduates from "Experimental" replace this parenthetical with the release number)
6062
*/
6163
@SuppressWarnings("unchecked")
6264
@Experimental
@@ -67,8 +69,10 @@ public TestSubscriber(long initialRequest) {
6769
/**
6870
* Constructs a TestSubscriber with the initial request to be requested from upstream
6971
* and a delegate Observer to wrap.
72+
*
7073
* @param initialRequest the initial request value, negative value will revert to the default unbounded behavior
7174
* @param delegate the Observer instance to wrap
75+
* @since (if this graduates from "Experimental" replace this parenthetical with the release number)
7276
*/
7377
@Experimental
7478
public TestSubscriber(Observer<T> delegate, long initialRequest) {
@@ -78,7 +82,7 @@ public TestSubscriber(Observer<T> delegate, long initialRequest) {
7882
this.testObserver = new TestObserver<T>(delegate);
7983
this.initialRequest = initialRequest;
8084
}
81-
85+
8286
public TestSubscriber(Subscriber<T> delegate) {
8387
this(delegate, -1);
8488
}
@@ -305,6 +309,9 @@ public Thread getLastSeenThread() {
305309

306310
/**
307311
* Assert if there is exactly a single completion event.
312+
*
313+
* @throws AssertionError if there were zero, or more than one, onCompleted events
314+
* @since (if this graduates from "Experimental" replace this parenthetical with the release number)
308315
*/
309316
@Experimental
310317
public void assertCompleted() {
@@ -316,8 +323,12 @@ public void assertCompleted() {
316323
throw new AssertionError("Completed multiple times: " + s);
317324
}
318325
}
326+
319327
/**
320328
* Assert if there is no completion event.
329+
*
330+
* @throws AssertionError if there were one or more than one onCompleted events
331+
* @since (if this graduates from "Experimental" replace this parenthetical with the release number)
321332
*/
322333
@Experimental
323334
public void assertNotCompleted() {
@@ -329,9 +340,14 @@ public void assertNotCompleted() {
329340
throw new AssertionError("Completed multiple times: " + s);
330341
}
331342
}
343+
332344
/**
333345
* Assert if there is exactly one error event which is a subclass of the given class.
346+
*
334347
* @param clazz the class to check the error against.
348+
* @throws AssertionError if there were zero, or more than one, onError events, or if the single onError
349+
* event did not carry an error of a subclass of the given class
350+
* @since (if this graduates from "Experimental" replace this parenthetical with the release number)
335351
*/
336352
@Experimental
337353
public void assertError(Class<? extends Throwable> clazz) {
@@ -346,9 +362,14 @@ public void assertError(Class<? extends Throwable> clazz) {
346362
throw new AssertionError("Exceptions differ; expected: " + clazz + ", actual: " + err.get(0), err.get(0));
347363
}
348364
}
365+
349366
/**
350367
* Assert there is a single onError event with the exact exception.
368+
*
351369
* @param throwable the throwable to check
370+
* @throws AssertionError if there were zero, or more than one, onError events, or if the single onError
371+
* event did not carry an error that matches the specified throwable
372+
* @since (if this graduates from "Experimental" replace this parenthetical with the release number)
352373
*/
353374
@Experimental
354375
public void assertError(Throwable throwable) {
@@ -363,8 +384,12 @@ public void assertError(Throwable throwable) {
363384
throw new AssertionError("Exceptions differ; expected: " + throwable + ", actual: " + err.get(0), err.get(0));
364385
}
365386
}
387+
366388
/**
367389
* Assert for no onError and onCompleted events.
390+
*
391+
* @throws AssertionError if there was either an onError or onCompleted event
392+
* @since (if this graduates from "Experimental" replace this parenthetical with the release number)
368393
*/
369394
@Experimental
370395
public void assertNoTerminalEvent() {
@@ -381,8 +406,12 @@ public void assertNoTerminalEvent() {
381406
}
382407
}
383408
}
409+
384410
/**
385411
* Assert if there are no onNext events received.
412+
*
413+
* @throws AssertionError if there were any onNext events
414+
* @since (if this graduates from "Experimental" replace this parenthetical with the release number)
386415
*/
387416
@Experimental
388417
public void assertNoValues() {
@@ -391,9 +420,13 @@ public void assertNoValues() {
391420
throw new AssertionError("No onNext events expected yet some received: " + s);
392421
}
393422
}
423+
394424
/**
395425
* Assert if the given number of onNext events are received.
426+
*
396427
* @param count the expected number of onNext events
428+
* @throws AssertionError if there were more or fewer onNext events than specified by {@code count}
429+
* @since (if this graduates from "Experimental" replace this parenthetical with the release number)
397430
*/
398431
@Experimental
399432
public void assertValueCount(int count) {
@@ -404,19 +437,26 @@ public void assertValueCount(int count) {
404437
}
405438

406439
/**
407-
* Assert if the received onNext events, in order, are the specified values.
408-
* @param values the values to check
440+
* Assert if the received onNext events, in order, are the specified items.
441+
*
442+
* @param values the items to check
443+
* @throws AssertionError if the items emitted do not exactly match those specified by {@code values}
444+
* @since (if this graduates from "Experimental" replace this parenthetical with the release number)
409445
*/
410446
@Experimental
411447
public void assertValues(T... values) {
412448
assertReceivedOnNext(Arrays.asList(values));
413449
}
450+
414451
/**
415-
* Assert if there is only a single received onNext event.
416-
* @param values the values to check
452+
* Assert if there is only a single received onNext event and that it marks the emission of a specific item.
453+
*
454+
* @param value the item to check
455+
* @throws AssertionError if the Observable does not emit only the single item specified by {@code value}
456+
* @since (if this graduates from "Experimental" replace this parenthetical with the release number)
417457
*/
418458
@Experimental
419459
public void assertValue(T value) {
420460
assertReceivedOnNext(Collections.singletonList(value));
421461
}
422-
}
462+
}

0 commit comments

Comments
 (0)