Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Unit Testing / Understanding Rx Java
Search
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
Trevor John
November 10, 2015
Programming
1
180
Unit Testing / Understanding Rx Java
Talk on understanding RxJava interfaces given at the NY Android meetup on 11/10/2015
Trevor John
November 10, 2015
Tweet
Share
Other Decks in Programming
See All in Programming
16年目のピクシブ百科事典を支える最新の技術基盤 / The Modern Tech Stack Powering Pixiv Encyclopedia in its 16th Year
ahuglajbclajep
5
990
責任感のあるCloudWatchアラームを設計しよう
akihisaikeda
3
160
SourceGeneratorのススメ
htkym
0
190
AIフル活用時代だからこそ学んでおきたい働き方の心得
shinoyu
0
130
CSC307 Lecture 01
javiergs
PRO
0
680
AI によるインシデント初動調査の自動化を行う AI インシデントコマンダーを作った話
azukiazusa1
1
680
Oxlintはいいぞ
yug1224
5
1.3k
AgentCoreとHuman in the Loop
har1101
5
220
それ、本当に安全? ファイルアップロードで見落としがちなセキュリティリスクと対策
penpeen
7
2.4k
登壇資料を作る時に意識していること #登壇資料_findy
konifar
3
900
OCaml 5でモダンな並列プログラミングを Enjoyしよう!
haochenx
0
120
コントリビューターによるDenoのすゝめ / Deno Recommendations by a Contributor
petamoriken
0
200
Featured
See All Featured
Automating Front-end Workflow
addyosmani
1371
200k
How to make the Groovebox
asonas
2
1.9k
How Software Deployment tools have changed in the past 20 years
geshan
0
32k
Unsuck your backbone
ammeep
671
58k
Ethics towards AI in product and experience design
skipperchong
2
190
So, you think you're a good person
axbom
PRO
2
1.9k
Designing for humans not robots
tammielis
254
26k
Building Experiences: Design Systems, User Experience, and Full Site Editing
marktimemedia
0
400
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
31
9.9k
Mozcon NYC 2025: Stop Losing SEO Traffic
samtorres
0
140
Between Models and Reality
mayunak
1
180
Introduction to Domain-Driven Design and Collaborative software design
baasie
1
580
Transcript
Unit Testing Rx API’s (Understanding Rx API’s) Trevor John Draft
trevorrjohn @trevorrjohn
What We Will Cover Learn how RxJava APIs work (should
work) How to use what we learned to write simple tests
Quick Overview Rx programming definition: An API for asynchronous programming
with observable streams (http: //reactivex.io/) While the API is simple it is very large Most common use case is fetching data
RxJava Usage Allows you to simply handle responses while ignoring
threading It allows for easier error handling Minimizes race conditions
Understanding How Rx Works Observable
Understanding How Rx Works Observable
Understanding How Rx Works Observable
Understanding How Rx Works Subscription
Understanding How Rx Works With Rx if nobody is listening
it won’t do anything! No subscription, no anything (There are exceptions)
Unit Test It Unit test → Mock it!
WHOA!? Crazy right?! Not flexible Not practical What can we
do? What if we want to use map?
WHOA!? The test doesn’t even work… :(
Observable Creation OnSubscribe interface? Subscriber?
Subscriber! I know those methods! Observable#subscribe() How data is passed
back How does this help us test?
So what now?
Fake OnSubscribe Captures the subscriber Creates interface for notifying the
subscriber
How Do We Use It? That looks good! Not tied
to the implementation!
What is Better? 5* statements Reusable Magic? 11 statements Ridged
Very straightforward
Another Option? Subjects! - They are super powerful and could
be a better/simpler solution for testing. Less configurable, but it works and no “fake” classes
Common Smells Name your tests! @Test public void methodName_context_assertion() Keep
tests short! Limit assertions per test
Questions?