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
AI時代のソフトウェア開発でも「人が仕様を書く」から始めよう-医療IT現場での実践とこれから
koukimiura
0
110
15年目のiOSアプリを1から作り直す技術
teakun
0
570
What Spring Developers Should Know About Jakarta EE
ivargrimstad
0
110
朝日新聞のデジタル版を支えるGoバックエンド ー価値ある情報をいち早く確実にお届けするために
junkiishida
1
290
AI活用のコスパを最大化する方法
ochtum
0
120
AIコーディングの理想と現実 2026 | AI Coding: Expectations vs. Reality 2026
tomohisa
0
800
CSC307 Lecture 13
javiergs
PRO
0
310
Premier Disciplin for Micro Frontends Multi Version/ Framework Scenarios @OOP 2026, Munic
manfredsteyer
PRO
0
200
文字コードの話
qnighy
43
16k
Beyond the Basics: Signal Forms
manfredsteyer
PRO
0
110
grapheme_strrev関数が採択されました(あと雑感)
youkidearitai
PRO
1
190
TipKitTips
ktcryomm
0
130
Featured
See All Featured
RailsConf 2023
tenderlove
30
1.4k
What does AI have to do with Human Rights?
axbom
PRO
0
2k
The Pragmatic Product Professional
lauravandoore
37
7.2k
Utilizing Notion as your number one productivity tool
mfonobong
3
240
Leadership Guide Workshop - DevTernity 2021
reverentgeek
1
220
Efficient Content Optimization with Google Search Console & Apps Script
katarinadahlin
PRO
1
360
The Illustrated Children's Guide to Kubernetes
chrisshort
51
52k
Building Adaptive Systems
keathley
44
2.9k
How To Speak Unicorn (iThemes Webinar)
marktimemedia
1
400
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
35
3.4k
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
26
3.4k
My Coaching Mixtape
mlcsv
0
63
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?