@Test public void testRenderFromKeyNullEvents() { when(mDatafeed.fetchDistrict(DISTRICT_KEY)).thenReturn(Observable.just(mDistrict)); when(mDatafeed.fetchDistrictEvents("2015ne")).thenReturn(Observable.just(null)); DistrictListElement element = mRenderer.renderFromKey(DISTRICT_KEY, ModelType.DISTRICT, null); assertDistrictItem(element, 0, 2015, false); }
@WorkerThread @Override public @Nullable DistrictListElement renderFromKey(String key, ModelType type, RenderArgs args) { District district = mDatafeed.fetchDistrict(key).toBlocking().first(); if (district == null) { return null; } List<Event> events = mDatafeed.fetchDistrictEvents(key).toBlocking().first(); RenderArgs newArgs = new RenderArgs(events != null ? events.size() : 0, args != null && args.showMyTba); return renderFromModel(district, newArgs); }
DistrictRenderer implements ModelRenderer<District, DistrictRenderer.RenderArgs> { @WorkerThread @Override public @Nullable DistrictListElement renderFromKey(String key, ModelType type, RenderArgs args) { District district = mDatafeed.fetchDistrict(key).toBlocking().first(); if (district == null) { return null; } List<Event> events = mDatafeed.fetchDistrictEvents(key).toBlocking().first(); RenderArgs newArgs = new RenderArgs(events != null ? events.size() : 0, args != null && args.showMyTba); return renderFromModel(district, newArgs); } }
DistrictRenderer implements ModelRenderer<District, DistrictRenderer.RenderArgs> { @WorkerThread @Override public @Nullable DistrictListElement renderFromKey(String key, ModelType type, RenderArgs args) { District district = mDatafeed.fetchDistrict(key).toBlocking().first(); if (district == null) { return null; } List<Event> events = mDatafeed.fetchDistrictEvents(key).toBlocking().first(); RenderArgs newArgs = new RenderArgs(events != null ? events.size() : 0, args != null && args.showMyTba); return renderFromModel(district, newArgs); } @Inject  DistrictRenderer(APICache datafeed); }
DistrictRenderer implements ModelRenderer<District, DistrictRenderer.RenderArgs> { @WorkerThread @Override public @Nullable DistrictListElement renderFromKey(String key, ModelType type, RenderArgs args) { District district = mDatafeed.fetchDistrict(key).toBlocking().first(); if (district == null) { return null; } List<Event> events = mDatafeed.fetchDistrictEvents(key).toBlocking().first(); RenderArgs newArgs = new RenderArgs(events != null ? events.size() : 0, args != null && args.showMyTba); return renderFromModel(district, newArgs); } @Inject  DistrictRenderer(APICache datafeed); @WorkerThread @Override @Nullable DistrictListElement renderFromKey(String key, ModelType type, RenderArgs args); @WorkerThread @Override @Nullable DistrictListElement renderFromModel(District district, RenderArgs args); }
DistrictRenderer implements ModelRenderer<District, DistrictRenderer.RenderArgs> { @WorkerThread @Override public @Nullable DistrictListElement renderFromKey(String key, ModelType type, RenderArgs args) { District district = mDatafeed.fetchDistrict(key).toBlocking().first(); if (district == null) { return null; } List<Event> events = mDatafeed.fetchDistrictEvents(key).toBlocking().first(); RenderArgs newArgs = new RenderArgs(events != null ? events.size() : 0, args != null && args.showMyTba); return renderFromModel(district, newArgs); } @Inject  DistrictRenderer(APICache datafeed); @WorkerThread @Override @Nullable DistrictListElement renderFromKey(String key, ModelType type, RenderArgs args); @WorkerThread @Override @Nullable DistrictListElement renderFromModel(District district, RenderArgs args);  }