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
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
Trevor John
November 10, 2015
Programming
190
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
気圧・高度・GPSを記録&可視化するアプリ「Koudo」を作った話
hjmkth
1
290
Developing with AI Agents — Codex, Claude Code & Cowork Practical Guide
x5gtrn
PRO
0
1.3k
Agentic UI
manfredsteyer
PRO
0
180
セキュリティの専門家じゃなくてもできる。「セキュリティ意識」をアップデートして サプライチェーン攻撃への耐性を高めよう。
tk3fftk
5
880
依存関係から依存物へ―Dependencyという言葉の歴史をひも解く
j_lee
0
120
The ROI of Quarkus for Spring Boot Applications
hollycummins
0
120
The NotImplementedError Problem in Ruby
koic
1
840
「エンジニアインターン、どうやって取った?」準備のリアルを語るLT会 Progate BAR
akiomatic
0
140
Contextとはなにか
chiroruxx
1
330
ECSアプリログをFireLensでコスト削減しようとしたけど諦めた話 in Fargate×Node.js
akihisaikeda
2
4.2k
Make SRE Operations Easier with Azure SRE Agent
kkamegawa
0
6.9k
C# and C++ Interoperability - cho-dotnetnew
harukasao
0
270
Featured
See All Featured
Into the Great Unknown - MozCon
thekraken
41
2.6k
How to make the Groovebox
asonas
2
2.2k
Everyday Curiosity
cassininazir
0
230
SERP Conf. Vienna - Web Accessibility: Optimizing for Inclusivity and SEO
sarafernandez
2
1.5k
Optimizing for Happiness
mojombo
378
71k
Done Done
chrislema
186
16k
How to optimise 3,500 product descriptions for ecommerce in one day using ChatGPT
katarinadahlin
PRO
1
3.6k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
31
10k
Un-Boring Meetings
codingconduct
0
320
The Straight Up "How To Draw Better" Workshop
denniskardys
239
140k
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
16
2k
Docker and Python
trallard
47
3.9k
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?