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
170
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
Agentic Applications with Symfony
el_stoffel
2
300
DataStoreをテストする
mkeeda
0
290
Compose Hot Reload is here, stop re-launching your apps! (Android Makers 2025)
zsmb
1
510
生成AIを使ったQAアプリケーションの作成 - ハンズオン補足資料
oracle4engineer
PRO
3
220
RubyKaigi Dev Meeting 2025
tenderlove
1
150
Exit 8 for SwiftUI
ojun9
0
130
状態と共に暮らす:ステートフルへの挑戦
ypresto
1
530
プロフェッショナルとしての成長「問題の深掘り」が導く真のスキルアップ / issue-analysis-and-skill-up
minodriven
6
760
Unlock the Potential of Swift Code Generation
rockname
0
250
Deoptimization: How YJIT Speeds Up Ruby by Slowing Down / RubyKaigi 2025
k0kubun
0
830
Vibe Coding の話をしよう
schroneko
2
590
Chrome Extension Techniques from Hell
moznion
1
160
Featured
See All Featured
GitHub's CSS Performance
jonrohan
1030
460k
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
5
550
How To Stay Up To Date on Web Technology
chriscoyier
790
250k
For a Future-Friendly Web
brad_frost
176
9.7k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
52
2.4k
How to Think Like a Performance Engineer
csswizardry
23
1.5k
Optimising Largest Contentful Paint
csswizardry
36
3.2k
What's in a price? How to price your products and services
michaelherold
245
12k
The Straight Up "How To Draw Better" Workshop
denniskardys
232
140k
Speed Design
sergeychernyshev
29
900
Designing for humans not robots
tammielis
252
25k
Bootstrapping a Software Product
garrettdimon
PRO
307
110k
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?