### Question:
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();  }### Answer:
@Test public void getBlocking_hasNoCachedValueAndFileReadTimesOut_returnsNull() throws Exception { when(mockStorageClient.read()).thenReturn(configContainer); ConfigContainer container = cacheClient.getBlocking( 0L); assertThat(container).isNull(); }
@Test public void getBlocking_hasNoCachedValueAndFileReadFails_returnsNull() throws Exception { when(mockStorageClient.read()).thenThrow(IO_EXCEPTION); ConfigContainer container = cacheClient.getBlocking(); assertThat(container).isNull(); }
@Test public void getBlocking_hasNoCachedValue_blocksOnFileReadAndReturnsFileContainer() throws Exception { when(mockStorageClient.read()).thenReturn(configContainer); ConfigContainer container = cacheClient.getBlocking(); assertThat(container).isEqualTo(configContainer); }
@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(); }