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
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
なあ兄弟、 余白の意味を考えてから UI実装してくれ!
ktcryomm
10
10k
FluorTracer / RayTracingCamp11
kugimasa
0
170
全員アーキテクトで挑む、 巨大で高密度なドメインの紐解き方
agatan
8
18k
DSPy Meetup Tokyo #1 - はじめてのDSPy
masahiro_nishimi
1
130
UIデザインに役立つ 2025年の最新CSS / The Latest CSS for UI Design 2025
clockmaker
16
6.1k
データファイルをAWSのDWHサービスに格納する / 20251115jawsug-tochigi
kasacchiful
2
100
競馬で学ぶ機械学習の基本と実践 / Machine Learning with Horse Racing
shoheimitani
14
14k
JJUG CCC 2025 Fall: Virtual Thread Deep Dive
ternbusty
3
510
ID管理機能開発の裏側 高速にSaaS連携を実現したチームのAI活用編
atzzcokek
0
160
乱雑なコードの整理から学ぶ設計の初歩
masuda220
PRO
32
15k
非同期処理の迷宮を抜ける: 初学者がつまづく構造的な原因
pd1xx
1
400
TypeScriptで設計する 堅牢さとUXを両立した非同期ワークフローの実現
moeka__c
6
2.8k
Featured
See All Featured
jQuery: Nuts, Bolts and Bling
dougneiner
65
8k
The Pragmatic Product Professional
lauravandoore
37
7k
Building Applications with DynamoDB
mza
96
6.8k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
PRO
196
69k
Product Roadmaps are Hard
iamctodd
PRO
55
12k
StorybookのUI Testing Handbookを読んだ
zakiyama
31
6.4k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
12
1.3k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
46
7.8k
The Illustrated Children's Guide to Kubernetes
chrisshort
51
51k
Building Better People: How to give real-time feedback that sticks.
wjessup
370
20k
Designing for Performance
lara
610
69k
The Cult of Friendly URLs
andyhume
79
6.7k
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?