@Test public void storeImpression_readErrors_notifiesError() { when(storageClient.read(any(CampaignImpressionsParser.class))) .thenReturn(Maybe.error(new IOException())); TestSubscriber<Object> subscriber = impressionStorageClient.storeImpression(campaignImpression).toFlowable().test(); subscriber.assertError(IOException.class); }
public Completable storeImpression(CampaignImpression impression) { return getAllImpressions() .defaultIfEmpty(EMPTY_IMPRESSIONS) .flatMapCompletable( storedImpressions -> { CampaignImpressionList appendedImpressions = appendImpression(storedImpressions, impression); return storageClient .write(appendedImpressions) .doOnComplete(() -> initInMemCache(appendedImpressions)); }); }
ImpressionStorageClient { public Completable storeImpression(CampaignImpression impression) { return getAllImpressions() .defaultIfEmpty(EMPTY_IMPRESSIONS) .flatMapCompletable( storedImpressions -> { CampaignImpressionList appendedImpressions = appendImpression(storedImpressions, impression); return storageClient .write(appendedImpressions) .doOnComplete(() -> initInMemCache(appendedImpressions)); }); } }
ImpressionStorageClient { public Completable storeImpression(CampaignImpression impression) { return getAllImpressions() .defaultIfEmpty(EMPTY_IMPRESSIONS) .flatMapCompletable( storedImpressions -> { CampaignImpressionList appendedImpressions = appendImpression(storedImpressions, impression); return storageClient .write(appendedImpressions) .doOnComplete(() -> initInMemCache(appendedImpressions)); }); } @Inject  ImpressionStorageClient(@ImpressionStore ProtoStorageClient storageClient); }
ImpressionStorageClient { public Completable storeImpression(CampaignImpression impression) { return getAllImpressions() .defaultIfEmpty(EMPTY_IMPRESSIONS) .flatMapCompletable( storedImpressions -> { CampaignImpressionList appendedImpressions = appendImpression(storedImpressions, impression); return storageClient .write(appendedImpressions) .doOnComplete(() -> initInMemCache(appendedImpressions)); }); } @Inject  ImpressionStorageClient(@ImpressionStore ProtoStorageClient storageClient); Completable storeImpression(CampaignImpression impression); Maybe<CampaignImpressionList> getAllImpressions(); Single<Boolean> isImpressed(CampaignProto.ThickContent content); Completable clearImpressions(FetchEligibleCampaignsResponse response); }
ImpressionStorageClient { public Completable storeImpression(CampaignImpression impression) { return getAllImpressions() .defaultIfEmpty(EMPTY_IMPRESSIONS) .flatMapCompletable( storedImpressions -> { CampaignImpressionList appendedImpressions = appendImpression(storedImpressions, impression); return storageClient .write(appendedImpressions) .doOnComplete(() -> initInMemCache(appendedImpressions)); }); } @Inject  ImpressionStorageClient(@ImpressionStore ProtoStorageClient storageClient); Completable storeImpression(CampaignImpression impression); Maybe<CampaignImpressionList> getAllImpressions(); Single<Boolean> isImpressed(CampaignProto.ThickContent content); Completable clearImpressions(FetchEligibleCampaignsResponse response);  }