Revision: f39b8fdfc5b8
Author:   Dhanji R. Prasanna <[email protected]>
Date:     Wed May 21 20:30:59 2014 UTC
Log:      Review comments

http://code.google.com/p/google-guice/source/detail?r=f39b8fdfc5b8

Modified:
/extensions/servlet/test/com/google/inject/servlet/ContinuingHttpServletRequestTest.java

=======================================
--- /extensions/servlet/test/com/google/inject/servlet/ContinuingHttpServletRequestTest.java Wed May 21 03:35:11 2014 UTC +++ /extensions/servlet/test/com/google/inject/servlet/ContinuingHttpServletRequestTest.java Wed May 21 20:30:59 2014 UTC
@@ -23,13 +23,15 @@

 import junit.framework.TestCase;

-import java.util.Arrays;
-
 import javax.servlet.http.Cookie;
 import javax.servlet.http.HttpServletRequest;

 public class ContinuingHttpServletRequestTest extends TestCase {

+  private static final String TEST_VALUE_1 = "testValue1";
+  private static final String TEST_VALUE_2 = "testValue2";
+ private static final int DEFAULT_MAX_AGE = new Cookie("", "").getMaxAge();
+
   public void testReturnNullCookiesIfDelegateHasNoNull() {
     HttpServletRequest delegate = createMock(HttpServletRequest.class);
     expect(delegate.getCookies()).andStubReturn(null);
@@ -43,7 +45,7 @@

   public void testReturnDelegateCookies() {
     Cookie[] cookies = new Cookie[]{
-        new Cookie("testName1", "testValue1"),
+        new Cookie("testName1", TEST_VALUE_1),
         new Cookie("testName2", "testValue2")
     };
     HttpServletRequest delegate = createMock(HttpServletRequest.class);
@@ -67,6 +69,11 @@
     } catch (AssertionFailedError e) {
       // Expected.
     }
+
+    // Verify that they remain equal to the original values.
+ assertEquals(TEST_VALUE_1, continuingRequest.getCookies()[0].getValue()); + assertEquals(TEST_VALUE_2, continuingRequest.getCookies()[1].getValue()); + assertEquals(DEFAULT_MAX_AGE, continuingRequest.getCookies()[1].getMaxAge());

     // Perform a snapshot of the snapshot.
ContinuingHttpServletRequest furtherContinuingRequest = new ContinuingHttpServletRequest(
@@ -82,11 +89,11 @@
     assertEquals(one.length, two.length);
     for (int i = 0; i < one.length; i++) {
       Cookie cookie = one[i];
-      assertCookiequality(cookie, two[i]);
+      assertCookieEquality(cookie, two[i]);
     }
   }

-  private static void assertCookiequality(Cookie one, Cookie two) {
+  private static void assertCookieEquality(Cookie one, Cookie two) {
     assertEquals(one.getName(), two.getName());
     assertEquals(one.getComment(), two.getComment());
     assertEquals(one.getDomain(), two.getDomain());

--
You received this message because you are subscribed to the Google Groups 
"google-guice-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/google-guice-dev.
For more options, visit https://groups.google.com/d/optout.

Reply via email to