### Question:
CampaignCacheClient { public Completable put(FetchEligibleCampaignsResponse fetchEligibleCampaignsResponse) { return storageClient .write(fetchEligibleCampaignsResponse) .doOnComplete(() -> cachedResponse = fetchEligibleCampaignsResponse); } @Inject  CampaignCacheClient(
      @CampaignCache ProtoStorageClient storageClient, Application application, Clock clock); Completable put(FetchEligibleCampaignsResponse fetchEligibleCampaignsResponse); Maybe<FetchEligibleCampaignsResponse> get();  }### Answer:
@Test public void put_noErrors_writesToStorage() { when(storageClient.write(fetchEligibleCampaignsResponse2)).thenReturn(fakeWrite); campaignCacheClient.put(fetchEligibleCampaignsResponse2).subscribe(); assertThat(wasWritten).isTrue(); }
@Test public void put_writeErrors_notifiesError() { when(storageClient.write(fetchEligibleCampaignsResponse2)) .thenReturn(Completable.error(new IOException())); TestSubscriber<Object> subscriber = campaignCacheClient.put(fetchEligibleCampaignsResponse2).toFlowable().test(); subscriber.assertError(IOException.class); }