Skip to content

Commit

Permalink
ReactiveX#6551 Renaming Single.onErrorResumeNext(Single) to Single.on…
Browse files Browse the repository at this point in the history
…ErrorResumeWith(Single), renamed an affected unit test, updated JavaDoc, and removed redundant casts.
  • Loading branch information
luis-cortes committed Jul 3, 2019
1 parent 16afaa7 commit 5ec1afd
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 15 deletions.
8 changes: 4 additions & 4 deletions src/main/java/io/reactivex/Single.java
Original file line number Diff line number Diff line change
Expand Up @@ -3207,9 +3207,9 @@ public final Single<T> onErrorReturnItem(final T value) {
* <p>
* By default, when a Single encounters an error that prevents it from emitting the expected item to
* its {@link SingleObserver}, the Single invokes its SingleObserver's {@code onError} method, and then quits
* without invoking any more of its SingleObserver's methods. The {@code onErrorResumeNext} method changes this
* without invoking any more of its SingleObserver's methods. The {@code onErrorResumeWith} method changes this
* behavior. If you pass another Single ({@code resumeSingleInCaseOfError}) to a Single's
* {@code onErrorResumeNext} method, if the original Single encounters an error, instead of invoking its
* {@code onErrorResumeWith} method, if the original Single encounters an error, instead of invoking its
* SingleObserver's {@code onError} method, it will instead relinquish control to {@code resumeSingleInCaseOfError} which
* will invoke the SingleObserver's {@link SingleObserver#onSuccess onSuccess} method if it is able to do so. In such a case,
* because no Single necessarily invokes {@code onError}, the SingleObserver may never know that an error
Expand All @@ -3219,7 +3219,7 @@ public final Single<T> onErrorReturnItem(final T value) {
* encountered.
* <dl>
* <dt><b>Scheduler:</b></dt>
* <dd>{@code onErrorResumeNext} does not operate by default on a particular {@link Scheduler}.</dd>
* <dd>{@code onErrorResumeWith} does not operate by default on a particular {@link Scheduler}.</dd>
* </dl>
*
* @param resumeSingleInCaseOfError a Single that will take control if source Single encounters an error.
Expand All @@ -3229,7 +3229,7 @@ public final Single<T> onErrorReturnItem(final T value) {
@CheckReturnValue
@NonNull
@SchedulerSupport(SchedulerSupport.NONE)
public final Single<T> onErrorResumeNext(final Single<? extends T> resumeSingleInCaseOfError) {
public final Single<T> onErrorResumeWith(final Single<? extends T> resumeSingleInCaseOfError) {
ObjectHelper.requireNonNull(resumeSingleInCaseOfError, "resumeSingleInCaseOfError is null");
return onErrorResumeNext(Functions.justFunction(resumeSingleInCaseOfError));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ public void accept(Throwable throwable) throws Exception {
latch.countDown();
}
})
.onErrorResumeNext(Single.just(""))
.onErrorResumeWith(Single.just(""))
.subscribe();

latch.await();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,9 @@ public void hide() {
}

@Test
public void onErrorResumeNext() {
public void onErrorResumeWith() {
Single.<Integer>error(new TestException())
.onErrorResumeNext(Single.just(1))
.onErrorResumeWith(Single.just(1))
.test()
.assertResult(1);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,31 +53,31 @@ public Integer apply(Throwable e) throws Exception {
@Test
public void resumeErrors() {
Single.error(new TestException("Main"))
.onErrorResumeNext(Single.error(new TestException("Resume")))
.onErrorResumeWith(Single.error(new TestException("Resume")))
.to(TestHelper.<Object>testConsumer())
.assertFailureAndMessage(TestException.class, "Resume");
}

@Test
public void resumeDispose() {
TestHelper.checkDisposed(Single.error(new TestException("Main"))
.onErrorResumeNext(Single.just(1)));
.onErrorResumeWith(Single.just(1)));
}

@Test
public void resumeDoubleOnSubscribe() {
TestHelper.checkDoubleOnSubscribeSingle(new Function<Single<Object>, SingleSource<Object>>() {
@Override
public SingleSource<Object> apply(Single<Object> s) throws Exception {
return s.onErrorResumeNext(Single.just(1));
return s.onErrorResumeWith(Single.just(1));
}
});
}

@Test
public void resumeSuccess() {
Single.just(1)
.onErrorResumeNext(Single.just(2))
.onErrorResumeWith(Single.just(2))
.test()
.assertResult(1);
}
Expand Down
8 changes: 4 additions & 4 deletions src/test/java/io/reactivex/single/SingleNullTests.java
Original file line number Diff line number Diff line change
Expand Up @@ -710,13 +710,13 @@ public void onErrorReturnValueNull() {
}

@Test(expected = NullPointerException.class)
public void onErrorResumeNextSingleNull() {
error.onErrorResumeNext((Single<Integer>)null);
public void onErrorResumeWithSingleNull() {
error.onErrorResumeWith(null);
}

@Test(expected = NullPointerException.class)
public void onErrorResumeNextFunctionNull() {
error.onErrorResumeNext((Function<Throwable, Single<Integer>>)null);
public void onErrorResumeNextNull() {
error.onErrorResumeNext(null);
}

@Test
Expand Down

0 comments on commit 5ec1afd

Please sign in to comment.