@Test public void should_return_github_launch_date_when_no_entry_in_cache() throws Exception { final String releasesId = "4968399"; ZonedDateTime modificationDate = gitHubLastUpdateCache.lastModificationOf(releasesId); assertThat(modificationDate).isEqualToIgnoringHours(ZonedDateTime.of(2008, 4, 10, 0, 0, 0, 0, ZoneId.of("GMT"))); }
public ZonedDateTime lastModificationOf(String uniqueKey) { final ZonedDateTime lastModification; if (cacheFileExists(uniqueKey)) { final JsonElement lastModificationDate = deserializeCachedFile(uniqueKey).get(LAST_MODIFIED_PROPERTY); lastModification = gson.fromJson(lastModificationDate, ZonedDateTime.class); } else { lastModification = ZonedDateTime.of(2008, 4, 10, 0, 0, 0, 0, ZoneId.of("GMT")); } return lastModification; }
GitHubLastUpdateCache { public ZonedDateTime lastModificationOf(String uniqueKey) { final ZonedDateTime lastModification; if (cacheFileExists(uniqueKey)) { final JsonElement lastModificationDate = deserializeCachedFile(uniqueKey).get(LAST_MODIFIED_PROPERTY); lastModification = gson.fromJson(lastModificationDate, ZonedDateTime.class); } else { lastModification = ZonedDateTime.of(2008, 4, 10, 0, 0, 0, 0, ZoneId.of("GMT")); } return lastModification; } }
GitHubLastUpdateCache { public ZonedDateTime lastModificationOf(String uniqueKey) { final ZonedDateTime lastModification; if (cacheFileExists(uniqueKey)) { final JsonElement lastModificationDate = deserializeCachedFile(uniqueKey).get(LAST_MODIFIED_PROPERTY); lastModification = gson.fromJson(lastModificationDate, ZonedDateTime.class); } else { lastModification = ZonedDateTime.of(2008, 4, 10, 0, 0, 0, 0, ZoneId.of("GMT")); } return lastModification; } GitHubLastUpdateCache(final Path cacheDirectory);  GitHubLastUpdateCache(final File cacheDirectory);  GitHubLastUpdateCache(); }
GitHubLastUpdateCache { public ZonedDateTime lastModificationOf(String uniqueKey) { final ZonedDateTime lastModification; if (cacheFileExists(uniqueKey)) { final JsonElement lastModificationDate = deserializeCachedFile(uniqueKey).get(LAST_MODIFIED_PROPERTY); lastModification = gson.fromJson(lastModificationDate, ZonedDateTime.class); } else { lastModification = ZonedDateTime.of(2008, 4, 10, 0, 0, 0, 0, ZoneId.of("GMT")); } return lastModification; } GitHubLastUpdateCache(final Path cacheDirectory);  GitHubLastUpdateCache(final File cacheDirectory);  GitHubLastUpdateCache(); ZonedDateTime lastModificationOf(String uniqueKey); T load(String uniqueKey, Class<T> type); boolean cacheFileExists(String uniqueKey); void store(T asset, String uniqueKey, ZonedDateTime dateTime); }
GitHubLastUpdateCache { public ZonedDateTime lastModificationOf(String uniqueKey) { final ZonedDateTime lastModification; if (cacheFileExists(uniqueKey)) { final JsonElement lastModificationDate = deserializeCachedFile(uniqueKey).get(LAST_MODIFIED_PROPERTY); lastModification = gson.fromJson(lastModificationDate, ZonedDateTime.class); } else { lastModification = ZonedDateTime.of(2008, 4, 10, 0, 0, 0, 0, ZoneId.of("GMT")); } return lastModification; } GitHubLastUpdateCache(final Path cacheDirectory);  GitHubLastUpdateCache(final File cacheDirectory);  GitHubLastUpdateCache(); ZonedDateTime lastModificationOf(String uniqueKey); T load(String uniqueKey, Class<T> type); boolean cacheFileExists(String uniqueKey); void store(T asset, String uniqueKey, ZonedDateTime dateTime);  }