aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNeil Fuller <nfuller@google.com>2014-08-06 13:22:11 +0100
committerNeil Fuller <nfuller@google.com>2014-08-06 13:25:53 +0100
commit807414ac6a58b2a4227b9511e630479370923e25 (patch)
treebf6a084be4f72afa9172d000a6c76fcaea58b56d
parentfbe29149493fffeae3c025da3776a6739a1732ae (diff)
downloadokhttp-807414ac6a58b2a4227b9511e630479370923e25.tar.gz
Fix knock-ons from upstream okhttp pull #1011
Commit 5093c4f8bd7be79d7c7cd3e00945190105ed9aab broke ResponseCacheTest. The test was asserting a string using a copy of the old broken implementation. The test now just uses HttpDate, which now has its own tests. This test fix will pushed upstream to OkHttp. Change-Id: Ie298ef660d9355f46df05523bb7945dfa0b15034
-rw-r--r--okhttp-tests/src/test/java/com/squareup/okhttp/internal/http/ResponseCacheTest.java10
1 files changed, 2 insertions, 8 deletions
diff --git a/okhttp-tests/src/test/java/com/squareup/okhttp/internal/http/ResponseCacheTest.java b/okhttp-tests/src/test/java/com/squareup/okhttp/internal/http/ResponseCacheTest.java
index 1cbd654..efec789 100644
--- a/okhttp-tests/src/test/java/com/squareup/okhttp/internal/http/ResponseCacheTest.java
+++ b/okhttp-tests/src/test/java/com/squareup/okhttp/internal/http/ResponseCacheTest.java
@@ -956,7 +956,7 @@ public final class ResponseCacheTest {
connection.setIfModifiedSince(since.getTime());
assertEquals("A", readAscii(connection));
RecordedRequest request = server.takeRequest();
- assertTrue(request.getHeaders().contains("If-Modified-Since: " + formatDate(since)));
+ assertTrue(request.getHeaders().contains("If-Modified-Since: " + HttpDate.format(since)));
}
@Test public void clientSuppliedConditionWithoutCachedResult() throws Exception {
@@ -1337,13 +1337,7 @@ public final class ResponseCacheTest {
* future.
*/
private String formatDate(long delta, TimeUnit timeUnit) {
- return formatDate(new Date(System.currentTimeMillis() + timeUnit.toMillis(delta)));
- }
-
- private String formatDate(Date date) {
- DateFormat rfc1123 = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss zzz", Locale.US);
- rfc1123.setTimeZone(TimeZone.getTimeZone("GMT"));
- return rfc1123.format(date);
+ return HttpDate.format(new Date(System.currentTimeMillis() + timeUnit.toMillis(delta)));
}
private void addRequestBodyIfNecessary(String requestMethod, HttpURLConnection invalidate)