### Question:
ImpressionStorageClient { public Maybe<CampaignImpressionList> getAllImpressions() { return cachedImpressionsMaybe .switchIfEmpty( storageClient.read(CampaignImpressionList.parser()).doOnSuccess(this::initInMemCache)) .doOnError(ignored -> clearInMemCache()); } @Inject  ImpressionStorageClient(@ImpressionStore ProtoStorageClient storageClient); Completable storeImpression(CampaignImpression impression); Maybe<CampaignImpressionList> getAllImpressions(); Single<Boolean> isImpressed(CampaignProto.ThickContent content); Completable clearImpressions(FetchEligibleCampaignsResponse response);  }### Answer:
@Test public void getAllImpressions_noErrors_returnsCampaignsList() { TestSubscriber<CampaignImpressionList> subscriber = impressionStorageClient.getAllImpressions().toFlowable().test(); assertThat(getPlainValues(subscriber)).containsExactly(campaignImpressionList); }
@Test public void getAllImpressions_readError_notifiesError() { when(storageClient.read(any(CampaignImpressionsParser.class))) .thenReturn(Maybe.error(new IOException())); TestSubscriber<CampaignImpressionList> subscriber = impressionStorageClient.getAllImpressions().toFlowable().test(); subscriber.assertError(IOException.class); }