@Test public void storeImpression_noErrors_writesToStorage() { impressionStorageClient.storeImpression(campaignImpression).subscribe(); assertThat(wasWritten).isTrue(); }
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);  }