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
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
Automatic Grammar Agreementと Markdown Extended Attributes について
kishikawakatsumi
0
130
2年のAppleウォレットパス開発の振り返り
muno92
PRO
0
180
[AI Engineering Summit Tokyo 2025] LLMは計画業務のゲームチェンジャーか? 最適化業務における活⽤の可能性と限界
terryu16
2
340
余白を設計しフロントエンド開発を 加速させる
tsukuha
4
470
ThorVG Viewer In VS Code
nors
0
700
【卒業研究】会話ログ分析によるユーザーごとの関心に応じた話題提案手法
momok47
0
170
AtCoder Conference 2025「LLM時代のAHC」
imjk
2
670
実は歴史的なアップデートだと思う AWS Interconnect - multicloud
maroon1st
0
320
生成AI時代を勝ち抜くエンジニア組織マネジメント
coconala_engineer
0
40k
Claude Codeの「Compacting Conversation」を体感50%減! CLAUDE.md + 8 Skills で挑むコンテキスト管理術
kmurahama
1
760
Python札幌 LT資料
t3tra
7
1.1k
ゆくKotlin くるRust
exoego
1
200
Featured
See All Featured
Visual Storytelling: How to be a Superhuman Communicator
reverentgeek
2
410
RailsConf 2023
tenderlove
30
1.3k
Introduction to Domain-Driven Design and Collaborative software design
baasie
1
560
Embracing the Ebb and Flow
colly
88
5k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
367
27k
Documentation Writing (for coders)
carmenintech
77
5.2k
Breaking role norms: Why Content Design is so much more than writing copy - Taylor Woolridge
uxyall
0
130
Prompt Engineering for Job Search
mfonobong
0
140
SEO in 2025: How to Prepare for the Future of Search
ipullrank
3
3.3k
Navigating the moral maze — ethical principles for Al-driven product design
skipperchong
1
230
Claude Code のすすめ
schroneko
67
210k
Learning to Love Humans: Emotional Interface Design
aarron
274
41k
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?