@Test public void getFeed_empty() throws Exception { doReturn(Observable.<Feed>empty()).when(localSource).getFeed(anyString()); doReturn(Observable.just(new Feed())).when(remoteSource).getFeed(anyString()); api.getFeed("dev") .test() .awaitTerminalEvent() .assertValueCount(1); verify(localSource, times(1)).getFeed(anyString()); verify(remoteSource, times(1)).getFeed(anyString()); }
@Override public Observable<Feed> getFeed(@NonNull final String category) { return getFeed(category, false); }
Api implements DataSource { @Override public Observable<Feed> getFeed(@NonNull final String category) { return getFeed(category, false); } }
Api implements DataSource { @Override public Observable<Feed> getFeed(@NonNull final String category) { return getFeed(category, false); } @VisibleForTesting  Api(@NonNull AwesomeBlogsLocalSource localSource, @NonNull AwesomeBlogsRemoteSource remoteSource);  Api(@NonNull Context context,
               @NonNull Supplier<String> userAgentSupplier, @NonNull Supplier<String> deviceIdSupplier,
               @NonNull Supplier<String> fcmTokenSupplier, @NonNull Supplier<String> accessTokenSupplier, boolean loggable); }
Api implements DataSource { @Override public Observable<Feed> getFeed(@NonNull final String category) { return getFeed(category, false); } @VisibleForTesting  Api(@NonNull AwesomeBlogsLocalSource localSource, @NonNull AwesomeBlogsRemoteSource remoteSource);  Api(@NonNull Context context,
               @NonNull Supplier<String> userAgentSupplier, @NonNull Supplier<String> deviceIdSupplier,
               @NonNull Supplier<String> fcmTokenSupplier, @NonNull Supplier<String> accessTokenSupplier, boolean loggable); @Override Observable<Feed> getFeed(@NonNull final String category); Observable<Feed> getFeed(@NonNull final String category, final boolean forceRefresh); Observable<Pair<String, List<Entry>>> getFreshEntries(); Observable<Pair<String, Boolean>> getSilentRefresh(); Observable<Entry> getEntry(@NonNull String link); Observable<List<Entry>> getEntries(@NonNull String author); Observable<RealmResults<Read>> getHistory(); Observable<RealmResults<Entry>> search(@NonNull String keyword); Observable<Boolean> isRead(@NonNull String link); void markAsRead(@NonNull Entry entry, long readAt); Observable<RealmResults<Favorite>> getFavorites(); Observable<Boolean> isFavorite(@NonNull String link); void markAsFavorite(@NonNull Entry entry, long favoriteAt); void unMarkAsFavorite(@NonNull Entry entry); Observable<Date> getExpiryDate(@NonNull String category); void clearExpiryDate(@NonNull String category); }
Api implements DataSource { @Override public Observable<Feed> getFeed(@NonNull final String category) { return getFeed(category, false); } @VisibleForTesting  Api(@NonNull AwesomeBlogsLocalSource localSource, @NonNull AwesomeBlogsRemoteSource remoteSource);  Api(@NonNull Context context,
               @NonNull Supplier<String> userAgentSupplier, @NonNull Supplier<String> deviceIdSupplier,
               @NonNull Supplier<String> fcmTokenSupplier, @NonNull Supplier<String> accessTokenSupplier, boolean loggable); @Override Observable<Feed> getFeed(@NonNull final String category); Observable<Feed> getFeed(@NonNull final String category, final boolean forceRefresh); Observable<Pair<String, List<Entry>>> getFreshEntries(); Observable<Pair<String, Boolean>> getSilentRefresh(); Observable<Entry> getEntry(@NonNull String link); Observable<List<Entry>> getEntries(@NonNull String author); Observable<RealmResults<Read>> getHistory(); Observable<RealmResults<Entry>> search(@NonNull String keyword); Observable<Boolean> isRead(@NonNull String link); void markAsRead(@NonNull Entry entry, long readAt); Observable<RealmResults<Favorite>> getFavorites(); Observable<Boolean> isFavorite(@NonNull String link); void markAsFavorite(@NonNull Entry entry, long favoriteAt); void unMarkAsFavorite(@NonNull Entry entry); Observable<Date> getExpiryDate(@NonNull String category); void clearExpiryDate(@NonNull String category);  }