Skip to content
This repository has been archived by the owner on May 23, 2020. It is now read-only.

Upgrade app to work with RxJava 2 #77

Merged
merged 2 commits into from
Nov 1, 2016
Merged

Upgrade app to work with RxJava 2 #77

merged 2 commits into from
Nov 1, 2016

Conversation

dlew
Copy link
Contributor

@dlew dlew commented Nov 1, 2016

No description provided.

component.addListener(event, listener);
}

private class EmitterListener<T> implements Listener<T>, Cancellable {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this will generate synthetic accessor methods should be just class

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good call.

RxNavi.observe(emitter, Event.CREATE_PERSISTABLE).subscribe(testSubscriber);
testSubscriber.assertNoValues();
TestObserver<BundleBundle> testObserver = new TestObserver<>();
RxNavi.observe(emitter, Event.CREATE_PERSISTABLE).subscribe(testObserver);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you could use RxNavi.observe(emitter, Event.CREATE_PERSISTABLE).test() instead which will give you a TestObserver

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Funny, I was just reading about this and deciding whether I wanted to switch or not. I'm not coming up with any compelling reason to go through the effort, since all the code is already there.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After a few more minutes of pondering I've decided it's worth switching, if for no other reason than that it's more succinct. That'll make future tests easier to write.

@@ -13,15 +13,15 @@
import io.reactivex.observers.TestObserver;
import org.junit.Test;

import static com.trello.navi2.rx.RxNavi.observe;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this done on purpose? Since this is the only test with a static import on navi

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hah good catch, no, that must've been a slip on the auto-complete when I was doing stuff.

@dlew dlew merged commit bdab655 into 2.x Nov 1, 2016
@dlew dlew deleted the dlew/rxjava2 branch November 1, 2016 15:02
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants