32
32
* <p>You can override the onSubscribe, onNext, onError, onComplete and
33
33
* cancel methods but not the others (this is by design).
34
34
*
35
- * <p>The TestSubscriber implements Disposable for convenience where dispose calls cancel.
35
+ * <p>The TestObserver implements Disposable for convenience where dispose calls cancel.
36
36
*
37
37
* @param <T> the value type
38
38
*/
@@ -218,8 +218,8 @@ public void onComplete() {
218
218
}
219
219
220
220
/**
221
- * Returns true if this TestSubscriber has been cancelled.
222
- * @return true if this TestSubscriber has been cancelled
221
+ * Returns true if this TestObserver has been cancelled.
222
+ * @return true if this TestObserver has been cancelled
223
223
*/
224
224
public final boolean isCancelled () {
225
225
return isDisposed ();
@@ -247,7 +247,7 @@ public final boolean isDisposed() {
247
247
// state retrieval methods
248
248
249
249
/**
250
- * Returns the last thread which called the onXXX methods of this TestSubscriber .
250
+ * Returns the last thread which called the onXXX methods of this TestObserver .
251
251
* @return the last thread which called the onXXX methods
252
252
*/
253
253
public final Thread lastThread () {
@@ -279,8 +279,8 @@ public final long completions() {
279
279
}
280
280
281
281
/**
282
- * Returns true if TestSubscriber received any onError or onComplete events.
283
- * @return true if TestSubscriber received any onError or onComplete events
282
+ * Returns true if TestObserver received any onError or onComplete events.
283
+ * @return true if TestObserver received any onError or onComplete events
284
284
*/
285
285
public final boolean isTerminated () {
286
286
return done .getCount () == 0 ;
@@ -303,15 +303,15 @@ public final int errorCount() {
303
303
}
304
304
305
305
/**
306
- * Returns true if this TestSubscriber received a subscription.
307
- * @return true if this TestSubscriber received a subscription
306
+ * Returns true if this TestObserver received a subscription.
307
+ * @return true if this TestObserver received a subscription
308
308
*/
309
309
public final boolean hasSubscription () {
310
310
return subscription .get () != null ;
311
311
}
312
312
313
313
/**
314
- * Awaits until this TestSubscriber receives an onError or onComplete events.
314
+ * Awaits until this TestObserver receives an onError or onComplete events.
315
315
* @return this
316
316
* @throws InterruptedException if the current thread is interrupted while waiting
317
317
* @see #awaitTerminalEvent()
@@ -326,11 +326,11 @@ public final TestObserver<T> await() throws InterruptedException {
326
326
}
327
327
328
328
/**
329
- * Awaits the specified amount of time or until this TestSubscriber
329
+ * Awaits the specified amount of time or until this TestObserver
330
330
* receives an onError or onComplete events, whichever happens first.
331
331
* @param time the waiting time
332
332
* @param unit the time unit of the waiting time
333
- * @return true if the TestSubscriber terminated, false if timeout happened
333
+ * @return true if the TestObserver terminated, false if timeout happened
334
334
* @throws InterruptedException if the current thread is interrupted while waiting
335
335
* @see #awaitTerminalEvent(long, TimeUnit)
336
336
*/
@@ -372,7 +372,7 @@ private AssertionError fail(String message) {
372
372
}
373
373
374
374
/**
375
- * Assert that this TestSubscriber received exactly one onComplete event.
375
+ * Assert that this TestObserver received exactly one onComplete event.
376
376
* @return this;
377
377
*/
378
378
public final TestObserver <T > assertComplete () {
@@ -387,7 +387,7 @@ public final TestObserver<T> assertComplete() {
387
387
}
388
388
389
389
/**
390
- * Assert that this TestSubscriber has not received any onComplete event.
390
+ * Assert that this TestObserver has not received any onComplete event.
391
391
* @return this;
392
392
*/
393
393
public final TestObserver <T > assertNotComplete () {
@@ -402,7 +402,7 @@ public final TestObserver<T> assertNotComplete() {
402
402
}
403
403
404
404
/**
405
- * Assert that this TestSubscriber has not received any onError event.
405
+ * Assert that this TestObserver has not received any onError event.
406
406
* @return this;
407
407
*/
408
408
public final TestObserver <T > assertNoErrors () {
@@ -414,7 +414,7 @@ public final TestObserver<T> assertNoErrors() {
414
414
}
415
415
416
416
/**
417
- * Assert that this TestSubscriber received exactly the specified onError event value.
417
+ * Assert that this TestObserver received exactly the specified onError event value.
418
418
*
419
419
* <p>The comparison is performed via Objects.equals(); since most exceptions don't
420
420
* implement equals(), this assertion may fail. Use the {@link #assertError(Class)}
@@ -439,7 +439,7 @@ public final TestObserver<T> assertError(Throwable error) {
439
439
}
440
440
441
441
/**
442
- * Asserts that this TestSubscriber received exactly one onError event which is an
442
+ * Asserts that this TestObserver received exactly one onError event which is an
443
443
* instance of the specified errorClass class.
444
444
* @param errorClass the error class to expect
445
445
* @return this;
@@ -470,7 +470,7 @@ public final TestObserver<T> assertError(Class<? extends Throwable> errorClass)
470
470
}
471
471
472
472
/**
473
- * Assert that this TestSubscriber received exactly one onNext value which is equal to
473
+ * Assert that this TestObserver received exactly one onNext value which is equal to
474
474
* the given value with respect to Objects.equals.
475
475
* @param value the value to expect
476
476
* @return this;
@@ -496,7 +496,7 @@ static String valueAndClass(Object o) {
496
496
}
497
497
498
498
/**
499
- * Assert that this TestSubscriber received the specified number onNext events.
499
+ * Assert that this TestObserver received the specified number onNext events.
500
500
* @param count the expected number of onNext events
501
501
* @return this;
502
502
*/
@@ -509,15 +509,15 @@ public final TestObserver<T> assertValueCount(int count) {
509
509
}
510
510
511
511
/**
512
- * Assert that this TestSubscriber has not received any onNext events.
512
+ * Assert that this TestObserver has not received any onNext events.
513
513
* @return this;
514
514
*/
515
515
public final TestObserver <T > assertNoValues () {
516
516
return assertValueCount (0 );
517
517
}
518
518
519
519
/**
520
- * Assert that the TestSubscriber received only the specified values in the specified order.
520
+ * Assert that the TestObserver received only the specified values in the specified order.
521
521
* @param values the values expected
522
522
* @return this;
523
523
* @see #assertValueSet(Collection)
@@ -539,7 +539,7 @@ public final TestObserver<T> assertValues(T... values) {
539
539
}
540
540
541
541
/**
542
- * Assert that the TestSubscriber received only the specified values in any order.
542
+ * Assert that the TestObserver received only the specified values in any order.
543
543
* <p>This helps asserting when the order of the values is not guaranteed, i.e., when merging
544
544
* asynchronous streams.
545
545
*
@@ -560,7 +560,7 @@ public final TestObserver<T> assertValueSet(Collection<? extends T> expected) {
560
560
}
561
561
562
562
/**
563
- * Assert that the TestSubscriber received only the specified sequence of values in the same order.
563
+ * Assert that the TestObserver received only the specified sequence of values in the same order.
564
564
* @param sequence the sequence of expected values in order
565
565
* @return this;
566
566
*/
@@ -599,7 +599,7 @@ public final TestObserver<T> assertValueSequence(Iterable<? extends T> sequence)
599
599
}
600
600
601
601
/**
602
- * Assert that the TestSubscriber terminated (i.e., the terminal latch reached zero).
602
+ * Assert that the TestObserver terminated (i.e., the terminal latch reached zero).
603
603
* @return this;
604
604
*/
605
605
public final TestObserver <T > assertTerminated () {
@@ -622,7 +622,7 @@ public final TestObserver<T> assertTerminated() {
622
622
}
623
623
624
624
/**
625
- * Assert that the TestSubscriber has not terminated (i.e., the terminal latch is still non-zero).
625
+ * Assert that the TestObserver has not terminated (i.e., the terminal latch is still non-zero).
626
626
* @return this;
627
627
*/
628
628
public final TestObserver <T > assertNotTerminated () {
@@ -658,9 +658,9 @@ public final TestObserver<T> assertNotSubscribed() {
658
658
}
659
659
660
660
/**
661
- * Waits until the any terminal event has been received by this TestSubscriber
661
+ * Waits until the any terminal event has been received by this TestObserver
662
662
* or returns false if the wait has been interrupted.
663
- * @return true if the TestSubscriber terminated, false if the wait has been interrupted
663
+ * @return true if the TestObserver terminated, false if the wait has been interrupted
664
664
*/
665
665
public final boolean awaitTerminalEvent () {
666
666
try {
@@ -673,11 +673,11 @@ public final boolean awaitTerminalEvent() {
673
673
}
674
674
675
675
/**
676
- * Awaits the specified amount of time or until this TestSubscriber
676
+ * Awaits the specified amount of time or until this TestObserver
677
677
* receives an onError or onComplete events, whichever happens first.
678
678
* @param duration the waiting time
679
679
* @param unit the time unit of the waiting time
680
- * @return true if the TestSubscriber terminated, false if timeout or interrupt happened
680
+ * @return true if the TestObserver terminated, false if timeout or interrupt happened
681
681
*/
682
682
public final boolean awaitTerminalEvent (long duration , TimeUnit unit ) {
683
683
try {
@@ -864,7 +864,7 @@ public final TestObserver<T> assertFailureAndMessage(Class<? extends Throwable>
864
864
865
865
/**
866
866
* Awaits until the internal latch is counted down.
867
- * <p>If the wait times out or gets interrupted, the TestSubscriber is cancelled.
867
+ * <p>If the wait times out or gets interrupted, the TestObserver is cancelled.
868
868
* @param time the waiting time
869
869
* @param unit the time unit of the waiting time
870
870
* @return this
0 commit comments