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
Claude Codeと2つの巻き戻し戦略 / Two Rewind Strategies with Claude Code
fruitriin
0
200
受け入れテスト駆動開発(ATDD)×AI駆動開発 AI時代のATDDの取り組み方を考える
kztakasaki
2
500
Go1.26 go fixをプロダクトに適用して困ったこと
kurakura0916
0
310
AI巻き込み型コードレビューのススメ
nealle
2
2.4k
AHC061解説
shun_pi
0
270
Ruby x Terminal
a_matsuda
5
520
AIプロダクト時代のQAエンジニアに求められること
imtnd
1
510
CSC307 Lecture 11
javiergs
PRO
0
580
オブザーバビリティ駆動開発って実際どうなの?
yohfee
2
630
AI駆動開発の本音 〜Claude Code並列開発で見えたエンジニアの新しい役割〜
hisuzuya
4
430
Head of Engineeringが現場で回した生産性向上施策 2025→2026
gessy0129
0
200
Rubyと楽しいをつくる / Creating joy with Ruby
chobishiba
0
200
Featured
See All Featured
From Legacy to Launchpad: Building Startup-Ready Communities
dugsong
0
170
First, design no harm
axbom
PRO
2
1.1k
Ruling the World: When Life Gets Gamed
codingconduct
0
160
Organizational Design Perspectives: An Ontology of Organizational Design Elements
kimpetersen
PRO
1
620
Introduction to Domain-Driven Design and Collaborative software design
baasie
1
610
Navigating the Design Leadership Dip - Product Design Week Design Leaders+ Conference 2024
apolaine
0
210
Hiding What from Whom? A Critical Review of the History of Programming languages for Music
tomoyanonymous
2
480
DevOps and Value Stream Thinking: Enabling flow, efficiency and business value
helenjbeal
1
130
AI: The stuff that nobody shows you
jnunemaker
PRO
3
340
BBQ
matthewcrist
89
10k
Code Review Best Practice
trishagee
74
20k
エンジニアに許された特別な時間の終わり
watany
106
240k
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?