Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
dagger2
Search
funnelbit
April 20, 2015
560
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
dagger2
funnelbit
April 20, 2015
More Decks by funnelbit
See All by funnelbit
Hatena Engineer Seminar #9
funnelbit
5
7.5k
droidkaigi-2017-renovation
funnelbit
10
11k
Dart
funnelbit
0
300
BottomBarAndSnackBar
funnelbit
0
550
Dagger2 Optional bindings
funnelbit
0
620
WearableRecyclerView
funnelbit
1
850
QucikSettingsTileAPI
funnelbit
0
390
Mobile Vision
funnelbit
0
490
AwarenessAPI
funnelbit
0
170
Featured
See All Featured
RailsConf 2023
tenderlove
30
1.5k
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
10
1.3k
The Curious Case for Waylosing
cassininazir
1
500
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
16
2.2k
Designing for Performance
lara
611
70k
Amusing Abliteration
ianozsvald
1
290
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
141
35k
Visual Storytelling: How to be a Superhuman Communicator
reverentgeek
2
660
Odyssey Design
rkendrick25
PRO
2
800
Building an army of robots
kneath
306
46k
Fireside Chat
paigeccino
43
4k
Groundhog Day: Seeking Process in Gaming for Health
codingconduct
0
340
Transcript
%BHHFS JEGVOOFMCJU
ࣗݾհ w JEGVOOFMCJU ଜɹྋ w גࣜձࣾͯͳ w ΞϓϦέʔγϣϯΤϯδχΞ w
ڈ͔ΒΞϓϦ։ൃΛ࢝Ίͨ
%BHHFS
%BHHFS w IUUQTHJUIVCDPNHPPHMFEBHHFS w %*ίϯςφ w 4RVBSF͕։ൃͯͨ͠%BHHFSͷHPPHMFGPSL w ਖ਼ࣜ൛ ͍ͭઌϦϦʔε
w ։ൃ൛ͷ4/"14)05
%BHHFSͷϝϦοτ w ίϯύΠϧ࣌ʹίʔυੜ͠ґଘղܾ w KBWBYJOKFDU"OOPUBUJPOΛ༻ w ։ൃ͕׆ൃ
%BHHFS ༻ྫ
ߏΠϝʔδ .PEVMF &OUSZ.BOBHFS "DUJWJUZ &OUSZ.BOBHFS "QQMJDBUJPO $PNQPOFOU "1*$MJFOU
௨৴෦ public class BkumaFormalServiceProvider implements BkumaServiceProvider { … @Override public
BkumaService getService() { OkHttpClient client = new OkHttpClient(); RestAdapter restAdapter = new RestAdapter.Builder() .setClient(new OkClient(client)) .setEndpoint(BkumaService.END_POINT) .build(); return restAdapter.create(BkumaService.class); } …
.PEVMF͔Β*OKFDU @Module public class BkumaModule { private final BkumaService mBkumaService;
public BkumaModule(BkumaGirlsApplication application) { mBkumaService = new BkumaFormalServiceProvider(application .getApplicationContext()).getService(); @Provides @Singleton EntryManager provideEntryManager() { return new EntryManager(mBkumaService); } … public class MainActivity extends ActionBarActivity { @Inject EntryManager mEntryManager; @Override protected void onCreate(Bundle savedInstanceState) { … ((BkumaGirlsApplication)getApplication()).component() .inject(this); } … ௨৴෦
$PNQPOFOUΛ࡞Δ public class BKUMAGirlsApplication extends Application { @Singleton @Component(modules =
BkumaModule.class) public interface ApplicationComponent { void inject(MainActivity mainActivity); } private ApplicationComponent mComponent; @Override public void onCreate() { mComponent = DaggerBKUMAGirlsApplication_ApplicationComponent.builder() .bkumaModule(new BkumaModule(this)) .build(); } public ApplicationComponent component() { return mComponent; } }
%BHHFS ༻ྫ ςετ
.PEVMF ςετ @Module public class BkumaTestModule { private final BkumaService
mBkumaService; … public BkumaTestModule(InstrumentationTestCase instrumentationTestCase) { mBkumaService = new BkumaMockServiceProvider(mInstrumentationTestCase .getInstrumentation().getContext()).getService(); } @Provides EntryManager provideEntryManager() { return new EntryManager(mBkumaService); } … 5FTU༻ #LVNB4FSWJDF
௨৴෦ʢςετʣ @Override public BkumaService getService() { RestAdapter restAdapter = new
RestAdapter .Builder() .setEndpoint(BkumaService.END_POINT) .build(); MockRestAdapter mockRestAdapter = MockRestAdapter.from(restAdapter); mockRestAdapter.setDelay(0); …(ଓ͖·͢) 5FTU༻.PDL
௨৴෦ʢςετʣ … BkumaService bkumaService = new BkumaService() { @Override public
void getTopEntries(@Query("limit") int limit, Callback<List<EntryResponse>> callback) { callback.success( TestUtils.createDummyEntry(mContext, limit), createDummyJsonResponse() ); } }); return mockRestAdapter.create( BkumaService.class, bkumaService ); %VNNZ 3FTQPOTF
*OKFDU ςετ public class BkumaEntryManagerTest extends InstrumentationTestCase { … @Inject
EntryManager mEntryManager; … public testGetEntries() { assertEquals( "ΤϯτϦऔಘͰ͖͍ͯΔ", false, mEntryManager.getEntries().isEmpty()); } }
·ͱΊ w ςελϒϧͳίʔυ͕࡞Γ͍͢ w *OTUBODFཧ͕͘͢͠ͳΔ w "DUJWJUZͷ࠶ੜ࣌ͳͲʹޮ͍ͯ͘Δ
͋Γ͕ͱ͏͍͟͝·ͨ͠