hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r1571360 - /httpcomponents/httpclient/trunk/httpclient-cache/src/test/java/org/apache/http/impl/client/cache/TestResponseCachingPolicy.java
Date Mon, 24 Feb 2014 17:22:51 GMT
Author: sebb
Date: Mon Feb 24 17:22:50 2014
New Revision: 1571360

URL: http://svn.apache.org/r1571360
Log:
Remove unnecessary duplicate field setup and rename variable to avoid hiding

Modified:
    httpcomponents/httpclient/trunk/httpclient-cache/src/test/java/org/apache/http/impl/client/cache/TestResponseCachingPolicy.java

Modified: httpcomponents/httpclient/trunk/httpclient-cache/src/test/java/org/apache/http/impl/client/cache/TestResponseCachingPolicy.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient-cache/src/test/java/org/apache/http/impl/client/cache/TestResponseCachingPolicy.java?rev=1571360&r1=1571359&r2=1571360&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient-cache/src/test/java/org/apache/http/impl/client/cache/TestResponseCachingPolicy.java
(original)
+++ httpcomponents/httpclient/trunk/httpclient-cache/src/test/java/org/apache/http/impl/client/cache/TestResponseCachingPolicy.java
Mon Feb 24 17:22:50 2014
@@ -321,15 +321,15 @@ public class TestResponseCachingPolicy {
 
     @Test
     public void testIsGetWithout200Cacheable() {
-        HttpResponse response = new BasicHttpResponse(new BasicStatusLine(HTTP_1_1,
+        HttpResponse response404 = new BasicHttpResponse(new BasicStatusLine(HTTP_1_1,
                 HttpStatus.SC_NOT_FOUND, ""));
 
-        Assert.assertFalse(policy.isResponseCacheable("GET", response));
+        Assert.assertFalse(policy.isResponseCacheable("GET", response404));
 
-        response = new BasicHttpResponse(new BasicStatusLine(HTTP_1_1,
+        response404 = new BasicHttpResponse(new BasicStatusLine(HTTP_1_1,
                 HttpStatus.SC_GATEWAY_TIMEOUT, ""));
 
-        Assert.assertFalse(policy.isResponseCacheable("GET", response));
+        Assert.assertFalse(policy.isResponseCacheable("GET", response404));
     }
 
     @Test
@@ -435,8 +435,6 @@ public class TestResponseCachingPolicy {
 
     @Test
     public void testResponsesWithMultipleExpiresHeadersAreNotCacheable() {
-        final Date now = new Date();
-        final Date sixSecondsAgo = new Date(now.getTime() - 6 * 1000L);
         response.addHeader("Expires", DateUtils.formatDate(now));
         response.addHeader("Expires", DateUtils.formatDate(sixSecondsAgo));
         Assert.assertFalse(policy.isResponseCacheable("GET", response));
@@ -448,8 +446,6 @@ public class TestResponseCachingPolicy {
 
         request.setHeader("Authorization", "Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==");
         response.setHeader("Cache-Control", "public");
-        final Date now = new Date();
-        final Date sixSecondsAgo = new Date(now.getTime() - 6 * 1000L);
         response.addHeader("Expires", DateUtils.formatDate(now));
         response.addHeader("Expires", DateUtils.formatDate(sixSecondsAgo));
         Assert.assertFalse(policy.isResponseCacheable(request, response));
@@ -557,8 +553,6 @@ public class TestResponseCachingPolicy {
     @Test
     public void getsWithQueryParametersFrom1_0OriginsViaProxiesAreCacheableWithExpires()
{
         request = new BasicHttpRequest("GET", "/foo?s=bar");
-        final Date now = new Date();
-        final Date tenSecondsFromNow = new Date(now.getTime() + 10 * 1000L);
         response.setHeader("Date", DateUtils.formatDate(now));
         response.setHeader("Expires", DateUtils.formatDate(tenSecondsFromNow));
         response.setHeader("Via", "1.0 someproxy");
@@ -569,8 +563,6 @@ public class TestResponseCachingPolicy {
     public void getsWithQueryParametersFrom1_0OriginsViaProxiesCanNotBeCacheableEvenWithExpires()
{
         policy = new ResponseCachingPolicy(0, true, true, true);
         request = new BasicHttpRequest("GET", "/foo?s=bar");
-        final Date now = new Date();
-        final Date tenSecondsFromNow = new Date(now.getTime() + 10 * 1000L);
         response.setHeader("Date", DateUtils.formatDate(now));
         response.setHeader("Expires", DateUtils.formatDate(tenSecondsFromNow));
         response.setHeader("Via", "1.0 someproxy");



Mime
View raw message