@Test public void getBlocking_firstTwoFileReadsFail_readsFileAndSetsCacheThreeTimes() throws Exception { doThrow(IO_EXCEPTION).when(mockStorageClient).read(); assertThat(cacheClient.getBlocking()).isNull(); assertThat(cacheClient.getBlocking()).isNull(); doReturn(configContainer).when(mockStorageClient).read(); for (int getCallIndex = 0; getCallIndex < 5; getCallIndex++) { assertThat(cacheClient.getBlocking()).isEqualTo(configContainer); } verify(mockStorageClient, times(3)).read(); }
@Nullable public ConfigContainer getBlocking() { return getBlocking(DISK_READ_TIMEOUT_IN_SECONDS); }
ConfigCacheClient { @Nullable public ConfigContainer getBlocking() { return getBlocking(DISK_READ_TIMEOUT_IN_SECONDS); } }
ConfigCacheClient { @Nullable public ConfigContainer getBlocking() { return getBlocking(DISK_READ_TIMEOUT_IN_SECONDS); } private  ConfigCacheClient(ExecutorService executorService, ConfigStorageClient storageClient); }
ConfigCacheClient { @Nullable public ConfigContainer getBlocking() { return getBlocking(DISK_READ_TIMEOUT_IN_SECONDS); } private  ConfigCacheClient(ExecutorService executorService, ConfigStorageClient storageClient); Task<ConfigContainer> putWithoutWaitingForDiskWrite(ConfigContainer configContainer); @Nullable ConfigContainer getBlocking(); Task<ConfigContainer> put(ConfigContainer configContainer); Task<ConfigContainer> put(
      ConfigContainer configContainer, boolean shouldUpdateInMemoryContainer); synchronized Task<ConfigContainer> get(); void clear(); static synchronized ConfigCacheClient getInstance(
      ExecutorService executorService, ConfigStorageClient storageClient); @VisibleForTesting static synchronized void clearInstancesForTest(); }
ConfigCacheClient { @Nullable public ConfigContainer getBlocking() { return getBlocking(DISK_READ_TIMEOUT_IN_SECONDS); } private  ConfigCacheClient(ExecutorService executorService, ConfigStorageClient storageClient); Task<ConfigContainer> putWithoutWaitingForDiskWrite(ConfigContainer configContainer); @Nullable ConfigContainer getBlocking(); Task<ConfigContainer> put(ConfigContainer configContainer); Task<ConfigContainer> put(
      ConfigContainer configContainer, boolean shouldUpdateInMemoryContainer); synchronized Task<ConfigContainer> get(); void clear(); static synchronized ConfigCacheClient getInstance(
      ExecutorService executorService, ConfigStorageClient storageClient); @VisibleForTesting static synchronized void clearInstancesForTest();  }