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:38:40 UTC

[tomcat] branch 10.0.x updated: Expand tests

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

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


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

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

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

diff --git a/test/jakarta/servlet/http/TestCookie.java b/test/jakarta/servlet/http/TestCookie.java
index 353004e..40182ab 100644
--- a/test/jakarta/servlet/http/TestCookie.java
+++ b/test/jakarta/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