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
Trevor John
November 10, 2015
Programming
180
1
Share
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
Other Decks in Programming
See All in Programming
エラー処理の温故知新 / history of error handling technic
ryotanakaya
7
1.8k
Vibe NLP for Applied NLP
inesmontani
PRO
0
580
GitHubCopilotCLIをはじめよう.pdf
htkym
0
320
GNU Makeの使い方 / How to use GNU Make
kaityo256
PRO
16
5.6k
2026_04_15_量子計算をパズルとして解く
hideakitakechi
0
130
mruby on C#: From VM Implementation to Game Scripting (RubyKaigi 2026)
hadashia
2
1.5k
Claude Code × Gemini × Ebitengine ゲーム制作素人WebエンジニアがGoでゲームを作った話
webzawa
0
220
20年以上続くプロダクトでも使い続けられる静的解析ツールを求めて
matsuo_atsushi
0
130
How We Practice Exploratory Testing in Iterative Development( #scrumniigata ) / 反復開発の中で、探索的テストをどう実施しているか
teyamagu
PRO
3
660
🦞OpenClaw works with AWS
licux
1
330
いつか誰かが、と思っていた フロントエンド刷新5年間の実践知
kiichisugihara
1
250
Structured Concurrency, Scoped Values and Joiners in the JDK 25 26 27
josepaumard
1
140
Featured
See All Featured
Agile that works and the tools we love
rasmusluckow
331
21k
State of Search Keynote: SEO is Dead Long Live SEO
ryanjones
0
190
How to Grow Your eCommerce with AI & Automation
katarinadahlin
PRO
1
180
AI Search: Implications for SEO and How to Move Forward - #ShenzhenSEOConference
aleyda
1
1.2k
Why You Should Never Use an ORM
jnunemaker
PRO
61
9.8k
Bridging the Design Gap: How Collaborative Modelling removes blockers to flow between stakeholders and teams @FastFlow conf
baasie
0
540
What's in a price? How to price your products and services
michaelherold
247
13k
エンジニアに許された特別な時間の終わり
watany
106
240k
Leadership Guide Workshop - DevTernity 2021
reverentgeek
1
280
Effective software design: The role of men in debugging patriarchy in IT @ Voxxed Days AMS
baasie
0
330
Reality Check: Gamification 10 Years Later
codingconduct
0
2.1k
The SEO identity crisis: Don't let AI make you average
varn
0
460
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?