Skip to content

Renamed Completable#finallyDo to #doAfterTerminate #3568

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 9, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/main/java/rx/Completable.java
Original file line number Diff line number Diff line change
Expand Up @@ -1356,7 +1356,7 @@ public final <T> Observable<T> endWith(Observable<T> next) {
* @return the new Completable instance
* @throws NullPointerException if onAfterComplete is null
*/
public final Completable finallyDo(Action0 onAfterComplete) {
public final Completable doAfterTerminate(Action0 onAfterComplete) {
return doOnLifecycle(Actions.empty(), Actions.empty(), Actions.empty(), onAfterComplete, Actions.empty());
}

Expand Down
16 changes: 8 additions & 8 deletions src/test/java/rx/CompletableTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -1888,11 +1888,11 @@ public void call() {
}

@Test(timeout = 1000)
public void finallyDoNormal() {
public void doAfterTerminateNormal() {
final AtomicBoolean doneAfter = new AtomicBoolean();
final AtomicBoolean complete = new AtomicBoolean();

Completable c = normal.completable.finallyDo(new Action0() {
Completable c = normal.completable.doAfterTerminate(new Action0() {
@Override
public void call() {
doneAfter.set(complete.get());
Expand All @@ -1919,14 +1919,14 @@ public void onCompleted() {
c.await();

Assert.assertTrue("Not completed", complete.get());
Assert.assertTrue("Finally called before onComplete", doneAfter.get());
Assert.assertTrue("Closure called before onComplete", doneAfter.get());
}

@Test(timeout = 1000)
public void finallyDoWithError() {
public void doAfterTerminateWithError() {
final AtomicBoolean doneAfter = new AtomicBoolean();

Completable c = error.completable.finallyDo(new Action0() {
Completable c = error.completable.doAfterTerminate(new Action0() {
@Override
public void call() {
doneAfter.set(true);
Expand All @@ -1940,12 +1940,12 @@ public void call() {
// expected
}

Assert.assertFalse("FinallyDo called", doneAfter.get());
Assert.assertFalse("Closure called", doneAfter.get());
}

@Test(expected = NullPointerException.class)
public void finallyDoNull() {
normal.completable.finallyDo(null);
public void doAfterTerminateNull() {
normal.completable.doAfterTerminate(null);
}

@Test(timeout = 1000)
Expand Down