Upgrade to PRO for Only $50/Year—Limited-Time Offer! 🔥
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🧠でWebの未来を感じてみよう #jsfes #gemini
n0bisuke2
3
1.2k
ViewファーストなRailsアプリ開発のたのしさ
sugiwe
0
500
ローターアクトEクラブ アメリカンナイト:川端 柚菜 氏(Japan O.K. ローターアクトEクラブ 会長):2720 Japan O.K. ロータリーEクラブ2025年12月1日卓話
2720japanoke
0
730
実は歴史的なアップデートだと思う AWS Interconnect - multicloud
maroon1st
0
220
大規模Cloud Native環境におけるFalcoの運用
owlinux1000
0
130
C-Shared Buildで突破するAI Agent バックテストの壁
po3rin
0
400
「コードは上から下へ読むのが一番」と思った時に、思い出してほしい話
panda728
PRO
39
26k
これならできる!個人開発のすゝめ
tinykitten
PRO
0
120
脳の「省エネモード」をデバッグする ~System 1(直感)と System 2(論理)の切り替え~
panda728
PRO
0
100
AIエンジニアリングのご紹介 / Introduction to AI Engineering
rkaga
8
3.1k
sbt 2
xuwei_k
0
300
チームをチームにするEM
hitode909
0
350
Featured
See All Featured
Designing for Timeless Needs
cassininazir
0
84
Test your architecture with Archunit
thirion
1
2.1k
Mozcon NYC 2025: Stop Losing SEO Traffic
samtorres
0
73
A Modern Web Designer's Workflow
chriscoyier
698
190k
Unsuck your backbone
ammeep
671
58k
The #1 spot is gone: here's how to win anyway
tamaranovitovic
1
860
Prompt Engineering for Job Search
mfonobong
0
110
The Straight Up "How To Draw Better" Workshop
denniskardys
239
140k
Stewardship and Sustainability of Urban and Community Forests
pwiseman
0
67
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
122
21k
Building Applications with DynamoDB
mza
96
6.8k
The Invisible Side of Design
smashingmag
302
51k
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?