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
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
AI 輔助遺留系統現代化的經驗分享
jame2408
1
1.2k
霧の中の代数的エフェクト
funnyycat
1
340
壊れたパーサから始める関数型設計と構成的なパーサ #fp_matsuri
raiga0310
2
190
自作OSでスライド発表する
uyuki234
1
3.8k
分散システム、なんですぐ死んでしまうん?耐障害性を高めたいあなたのためのレジリエンスパターン入門
mshibuya
7
5.7k
AI駆動開発を妨げる技術的負債の解消アプローチ / ai-refactoring-approach
minodriven
17
8.9k
言語を使う側から、作る側へ。 自作 Lisp で得た新たな気づき。
andpad
0
110
Generative UI & AI-Assistants for Your Angular Solutions
manfredsteyer
PRO
0
100
初めてのKubernetes 本番運用でハマった話
oku053
0
120
PHPだって関数型したい 〜できること、できないこと〜 / fp-in-php
jsoizo
0
190
ランチタイムLT会3周年!ランチタイムLT会を3年間続けられたお話
y0hgi
1
140
例外の正しい扱い方 そのエラー try-catchして大丈夫?
jinwatanabe
0
360
Featured
See All Featured
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
32
3.7k
A Modern Web Designer's Workflow
chriscoyier
698
190k
Accessibility Awareness
sabderemane
1
150
Odyssey Design
rkendrick25
PRO
2
730
The Spectacular Lies of Maps
axbom
PRO
1
850
Learning to Love Humans: Emotional Interface Design
aarron
275
41k
We Have a Design System, Now What?
morganepeng
55
8.2k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
133
19k
End of SEO as We Know It (SMX Advanced Version)
ipullrank
3
4.3k
Designing Powerful Visuals for Engaging Learning
tmiket
1
450
Winning Ecommerce Organic Search in an AI Era - #searchnstuff2025
aleyda
1
2.1k
Imperfection Machines: The Place of Print at Facebook
scottboms
270
14k
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?