@Test public void isImpressed_ifExperimentNotImpressed_isFalse() { TestSubscriber<Boolean> subscriber = impressionStorageClient.isImpressed(experimentalCampaign).toFlowable().test(); assertThat(subscriber.getEvents().get(0)).containsExactly(false); }
public Single<Boolean> isImpressed(CampaignProto.ThickContent content) { String campaignId = content.getPayloadCase().equals(CampaignProto.ThickContent.PayloadCase.VANILLA_PAYLOAD) ? content.getVanillaPayload().getCampaignId() : content.getExperimentalPayload().getCampaignId(); return getAllImpressions() .map(CampaignImpressionList::getAlreadySeenCampaignsList) .flatMapObservable(Observable::fromIterable) .map(CampaignImpression::getCampaignId) .contains(campaignId); }
ImpressionStorageClient { public Single<Boolean> isImpressed(CampaignProto.ThickContent content) { String campaignId = content.getPayloadCase().equals(CampaignProto.ThickContent.PayloadCase.VANILLA_PAYLOAD) ? content.getVanillaPayload().getCampaignId() : content.getExperimentalPayload().getCampaignId(); return getAllImpressions() .map(CampaignImpressionList::getAlreadySeenCampaignsList) .flatMapObservable(Observable::fromIterable) .map(CampaignImpression::getCampaignId) .contains(campaignId); } }
ImpressionStorageClient { public Single<Boolean> isImpressed(CampaignProto.ThickContent content) { String campaignId = content.getPayloadCase().equals(CampaignProto.ThickContent.PayloadCase.VANILLA_PAYLOAD) ? content.getVanillaPayload().getCampaignId() : content.getExperimentalPayload().getCampaignId(); return getAllImpressions() .map(CampaignImpressionList::getAlreadySeenCampaignsList) .flatMapObservable(Observable::fromIterable) .map(CampaignImpression::getCampaignId) .contains(campaignId); } @Inject  ImpressionStorageClient(@ImpressionStore ProtoStorageClient storageClient); }
ImpressionStorageClient { public Single<Boolean> isImpressed(CampaignProto.ThickContent content) { String campaignId = content.getPayloadCase().equals(CampaignProto.ThickContent.PayloadCase.VANILLA_PAYLOAD) ? content.getVanillaPayload().getCampaignId() : content.getExperimentalPayload().getCampaignId(); return getAllImpressions() .map(CampaignImpressionList::getAlreadySeenCampaignsList) .flatMapObservable(Observable::fromIterable) .map(CampaignImpression::getCampaignId) .contains(campaignId); } @Inject  ImpressionStorageClient(@ImpressionStore ProtoStorageClient storageClient); Completable storeImpression(CampaignImpression impression); Maybe<CampaignImpressionList> getAllImpressions(); Single<Boolean> isImpressed(CampaignProto.ThickContent content); Completable clearImpressions(FetchEligibleCampaignsResponse response); }
ImpressionStorageClient { public Single<Boolean> isImpressed(CampaignProto.ThickContent content) { String campaignId = content.getPayloadCase().equals(CampaignProto.ThickContent.PayloadCase.VANILLA_PAYLOAD) ? content.getVanillaPayload().getCampaignId() : content.getExperimentalPayload().getCampaignId(); return getAllImpressions() .map(CampaignImpressionList::getAlreadySeenCampaignsList) .flatMapObservable(Observable::fromIterable) .map(CampaignImpression::getCampaignId) .contains(campaignId); } @Inject  ImpressionStorageClient(@ImpressionStore ProtoStorageClient storageClient); Completable storeImpression(CampaignImpression impression); Maybe<CampaignImpressionList> getAllImpressions(); Single<Boolean> isImpressed(CampaignProto.ThickContent content); Completable clearImpressions(FetchEligibleCampaignsResponse response);  }