You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2021/11/18 19:42:03 UTC

[tomcat] branch 9.0.x updated: Expand tests

This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/9.0.x by this push:
     new dc07a52  Expand tests
dc07a52 is described below

commit dc07a5245698bdf0a8c44425ff9c5b11635133cb
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Thu Nov 18 19:36:18 2021 +0000

    Expand tests
---
 test/javax/servlet/http/TestCookie.java | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/test/javax/servlet/http/TestCookie.java b/test/javax/servlet/http/TestCookie.java
index 358f4b9..3331eb3 100644
--- a/test/javax/servlet/http/TestCookie.java
+++ b/test/javax/servlet/http/TestCookie.java
@@ -134,6 +134,29 @@ public class TestCookie {
         Cookie cookie = new Cookie("$Foo", null);
     }
 
+    @Test
+    public void testClone() {
+        Cookie a = new Cookie("a","a");
+        a.setComment("comment");
+        a.setDomain("domain");
+        a.setHttpOnly(true);
+        a.setMaxAge(123);
+        a.setPath("/path");
+        a.setSecure(true);
+
+        Cookie b = (Cookie) a.clone();
+
+        Assert.assertEquals("a", b.getName());
+        Assert.assertEquals("a", b.getValue());
+        Assert.assertEquals("comment", b.getComment());
+        Assert.assertEquals("domain", b.getDomain());
+        Assert.assertTrue(b.isHttpOnly());
+        Assert.assertEquals(123, b.getMaxAge());
+        Assert.assertEquals("/path", b.getPath());
+        Assert.assertTrue(b.getSecure());
+    }
+
+
     public static void checkCharInName(CookieNameValidator validator, BitSet allowed) {
         for (char ch = 0; ch < allowed.size(); ch++) {
             boolean expected = allowed.get(ch);

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org