@Test public void givenNoHelperFileWasStored_whenCheckForCachedEntry_thenReturnsAnAbsentOptional() throws Exception { final CacheLogger testCacheLogger = initializeCacheLoggerWithTestValues(); final Optional<String> optionalLocalFileNameOfTheCachedResource = testCacheLogger.checkForCachedEntry(new URL(TEST_REMOTE_URL_AS_STRING)); assertThat(optionalLocalFileNameOfTheCachedResource, equalTo(Optional.<String>absent())); }
final @NonNull Optional<String> checkForCachedEntry(@NonNull URL remoteURL) { checkNotNull(remoteURL, "The remote URL must not be null"); if (hasBeenAlreadyFinalized) return Optional.absent(); if (remoteURLToLocalFileNameMap.containsKey(remoteURL)) if (new File(cacheDirectoryPath, remoteURLToLocalFileNameMap.get(remoteURL)).exists()) return Optional.of(remoteURLToLocalFileNameMap.get(remoteURL)); return Optional.absent(); }
CacheLogger { final @NonNull Optional<String> checkForCachedEntry(@NonNull URL remoteURL) { checkNotNull(remoteURL, "The remote URL must not be null"); if (hasBeenAlreadyFinalized) return Optional.absent(); if (remoteURLToLocalFileNameMap.containsKey(remoteURL)) if (new File(cacheDirectoryPath, remoteURLToLocalFileNameMap.get(remoteURL)).exists()) return Optional.of(remoteURLToLocalFileNameMap.get(remoteURL)); return Optional.absent(); } }
CacheLogger { final @NonNull Optional<String> checkForCachedEntry(@NonNull URL remoteURL) { checkNotNull(remoteURL, "The remote URL must not be null"); if (hasBeenAlreadyFinalized) return Optional.absent(); if (remoteURLToLocalFileNameMap.containsKey(remoteURL)) if (new File(cacheDirectoryPath, remoteURLToLocalFileNameMap.get(remoteURL)).exists()) return Optional.of(remoteURLToLocalFileNameMap.get(remoteURL)); return Optional.absent(); } CacheLogger(@NonNull String cacheDirectoryPath, int daysTillConsideredFresh); }
CacheLogger { final @NonNull Optional<String> checkForCachedEntry(@NonNull URL remoteURL) { checkNotNull(remoteURL, "The remote URL must not be null"); if (hasBeenAlreadyFinalized) return Optional.absent(); if (remoteURLToLocalFileNameMap.containsKey(remoteURL)) if (new File(cacheDirectoryPath, remoteURLToLocalFileNameMap.get(remoteURL)).exists()) return Optional.of(remoteURLToLocalFileNameMap.get(remoteURL)); return Optional.absent(); } CacheLogger(@NonNull String cacheDirectoryPath, int daysTillConsideredFresh);  }
CacheLogger { final @NonNull Optional<String> checkForCachedEntry(@NonNull URL remoteURL) { checkNotNull(remoteURL, "The remote URL must not be null"); if (hasBeenAlreadyFinalized) return Optional.absent(); if (remoteURLToLocalFileNameMap.containsKey(remoteURL)) if (new File(cacheDirectoryPath, remoteURLToLocalFileNameMap.get(remoteURL)).exists()) return Optional.of(remoteURLToLocalFileNameMap.get(remoteURL)); return Optional.absent(); } CacheLogger(@NonNull String cacheDirectoryPath, int daysTillConsideredFresh);  static final int HOURS_PER_DAY; static final int MINUTES_PER_HOUR; static final int SEC_TO_MILLISEC; static final String LINE_SEPARATOR; }