Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Unit Testing / Understanding Rx Java
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
Trevor John
November 10, 2015
Programming
200
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
HTML-in-Canvasで作る未来のWeb UI表現
clockmaker
5
6.1k
プロジェクトコードをキレイキレイしよう!暗黙的な参照を読み解く静的解析
ostk0069
0
200
No More NoSuchMethodError
exoego
1
120
Inertia Rails: The One-Person Framework with React & Friends
skryukov
0
200
クラウドエージェントは、 何がそんなに便利なのか / what makes cloud agents so useful
rkaga
4
670
Spec-driven Development with AI
simas
PRO
0
2.2k
Python Lambdaにおけるテストしやすい設計とAI支援の活用 / Designing Testable Python Lambda Functions with AI
kitano_yuichi
1
270
クラウドゲーミングのパフォーマンス最適化に挑む / Cloud Gaming Performance Tuning
vivion
0
310
Lambda durable functionsでHuman in the Loopを楽に…楽に……
har1101
2
240
golang-bob.pdf
iwatsukayura
0
150
TanStack Vue Query と Pinia Colada から学ぶ非同期状態の型設計
aoshi
0
580
Groovy as a human and AI friendly programming language
paulk
0
160
Featured
See All Featured
Test your architecture with Archunit
thirion
2
2.5k
AI Search: Where Are We & What Can We Do About It?
aleyda
0
8.2k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
12
1.9k
Building AI with AI
inesmontani
PRO
1
1.3k
Done Done
chrislema
187
17k
Money Talks: Using Revenue to Get Sh*t Done
nikkihalliwell
0
540
The Curious Case for Waylosing
cassininazir
1
600
技術選定の審美眼(2025年版) / Understanding the Spiral of Technologies 2025 edition
twada
PRO
120
120k
The Cost Of JavaScript in 2023
addyosmani
55
10k
HDC tutorial
michielstock
2
990
Being A Developer After 40
akosma
PRO
92
590k
The B2B funnel & how to create a winning content strategy
katarinadahlin
PRO
1
600
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?