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
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
Trevor John
November 10, 2015
Programming
190
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
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
自動化したのに回らないテスト運用の壁ーAI時代の品質責任と生産性
mfunaki
0
110
ドリフトを絶対に許さない(?)CDK運用 / CDK Ops with Zero Tolerance for Drifts (?)
akihisaikeda
1
130
『コードを書く以外の』エンジニアリング〜課金基盤移行プロジェクト推進のためのTips4選
yuriko1211
0
560
AI時代に設計が 最大の生産性レバーになる 意図駆動開発とデータを消さない設計|Don't Delete Your Data or Your Intent — Design as the Deepest Lever in the AI Era
tomohisa
0
120
わからない話を追いかけたら、プログラミング言語を作る側にいた
ydah
2
130
為什麼你並不需要ViewModel / No, you don't need a ViewModel
lovee
1
450
AIが無かった頃の素敵な出会いの話
codmoninc
1
300
そこに3びきプロダクトがいるじゃろう——生成AI時代における“価値が届かない理由”の構造
kosuket
0
350
PHP初心者セッション2026 〜生成AIでは見えない裏側を知る:今だからLAMPを通して仕組みを学ぶ〜
kashioka
0
750
信頼性について考えてみる(SRE NEXT 2026 miniLT)
hayama17
0
230
人間の目はかわらない、だからJPEGは30年もつ
yuzneri
12
17k
AI時代の仕事技芸論〜ソフトウェア開発で「遊ぶように働く」職人的熟達のすすめ(スクフェス仙台 2026バージョン)
kuranuki
0
790
Featured
See All Featured
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
35
3.7k
The Illustrated Children's Guide to Kubernetes
chrisshort
51
53k
sira's awesome portfolio website redesign presentation
elsirapls
0
310
Color Theory Basics | Prateek | Gurzu
gurzu
0
400
The #1 spot is gone: here's how to win anyway
tamaranovitovic
3
1.1k
Abbi's Birthday
coloredviolet
3
8.9k
Unlocking the hidden potential of vector embeddings in international SEO
frankvandijk
0
880
Ecommerce SEO: The Keys for Success Now & Beyond - #SERPConf2024
aleyda
1
2.1k
Stewardship and Sustainability of Urban and Community Forests
pwiseman
0
410
Documentation Writing (for coders)
carmenintech
77
5.4k
AI in Enterprises - Java and Open Source to the Rescue
ivargrimstad
0
1.4k
Game over? The fight for quality and originality in the time of robots
wayneb77
1
230
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?