From 730866f8804924f988be1f8ca387800e917493d1 Mon Sep 17 00:00:00 2001 From: Reinhard Pointner Date: Fri, 11 Mar 2016 21:26:36 +0000 Subject: [PATCH] Verify ETag handling works (even if it doesn't on TMDB servers at this point) --- test/net/filebot/web/TMDbClientTest.java | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/test/net/filebot/web/TMDbClientTest.java b/test/net/filebot/web/TMDbClientTest.java index 09af4fa9..56415002 100644 --- a/test/net/filebot/web/TMDbClientTest.java +++ b/test/net/filebot/web/TMDbClientTest.java @@ -1,17 +1,23 @@ package net.filebot.web; +import static net.filebot.CachedResource.*; import static org.junit.Assert.*; +import java.net.URL; +import java.time.Duration; import java.util.Arrays; import java.util.List; import java.util.Locale; -import net.filebot.web.TMDbClient.Artwork; -import net.filebot.web.TMDbClient.MovieInfo; - import org.junit.Ignore; import org.junit.Test; +import net.filebot.Cache; +import net.filebot.CacheType; +import net.filebot.CachedResource; +import net.filebot.web.TMDbClient.Artwork; +import net.filebot.web.TMDbClient.MovieInfo; + public class TMDbClientTest { TMDbClient tmdb = new TMDbClient("66308fb6e3fd850dde4c7d21df2e8306"); @@ -97,4 +103,13 @@ public class TMDbClientTest { } } + @Ignore + @Test + public void etag() throws Exception { + Cache cache = Cache.getCache("test", CacheType.Persistent); + Cache etagStorage = Cache.getCache("etag", CacheType.Persistent); + CachedResource resource = cache.bytes("http://devel.squid-cache.org/old_projects.html#etag", URL::new).fetch(fetchIfNoneMatch(etagStorage)).expire(Duration.ZERO); + assertArrayEquals(resource.get(), resource.get()); + } + }