You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by kk...@apache.org on 2015/11/07 15:50:47 UTC
svn commit: r1713138 -
/tomcat/tc6.0.x/trunk/test/org/apache/tomcat/util/http/TestCookies.java
Author: kkolinko
Date: Sat Nov 7 14:50:47 2015
New Revision: 1713138
URL: http://svn.apache.org/viewvc?rev=1713138&view=rev
Log:
Convert test class to JUnit 4
Modified:
tomcat/tc6.0.x/trunk/test/org/apache/tomcat/util/http/TestCookies.java
Modified: tomcat/tc6.0.x/trunk/test/org/apache/tomcat/util/http/TestCookies.java
URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/test/org/apache/tomcat/util/http/TestCookies.java?rev=1713138&r1=1713137&r2=1713138&view=diff
==============================================================================
--- tomcat/tc6.0.x/trunk/test/org/apache/tomcat/util/http/TestCookies.java (original)
+++ tomcat/tc6.0.x/trunk/test/org/apache/tomcat/util/http/TestCookies.java Sat Nov 7 14:50:47 2015
@@ -15,38 +15,13 @@
* limitations under the License.
*/
-package org.apache.tomcat.util.http;
+package org.apache.tomcat.util.http;
-import org.apache.tomcat.util.http.Cookies;
-import org.apache.tomcat.util.http.ServerCookie;
+import org.junit.Test;
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-import junit.textui.TestRunner;
-
-import java.lang.Exception;
-
-
-public class TestCookies extends TestCase {
- public static void main( String args[] ) {
- TestRunner.run(suite());
- }
- public static Test suite() {
- TestSuite suite = new TestSuite();
- suite.addTest(new TestSuite(TestCookies.class));
- return suite;
- }
-/*
- int i = 10000000;
- // These tests are not really representative
- while (i-- > 0) {
- test("session=1234567890;name=\"John Q. Public\";");
- }
-// runtests();
- }
- */
-
+public class TestCookies {
+
+ @Test
public void testCookies() throws Exception {
test("foo=bar; a=b", "foo", "bar", "a", "b");
test("foo=bar;a=b", "foo", "bar", "a", "b");
@@ -84,10 +59,10 @@ public class TestCookies extends TestCas
// Last character is an escape character
test("$Version=1;foo=b'ar;$Domain=\"apache.org\";$Port=8080;a=\"b\\\"", "foo", "b'ar");
test("$Version=1;foo=b'ar;$Domain=\"apache.org\";$Port=8080;a=\"b\\", "foo", "b'ar");
-
+
// A token cannot be quoted with ' chars - they should be treated as part of the value
test("$Version=\"1\"; foo='bar'; $Path=/path; $Domain=\"localhost\"", "foo", "'bar'");
-
+
// wrong, path should not have '/' JVK
test("$Version=1;foo=\"bar\";$Path=/examples;a=b; ; ", "foo", "bar", "a", "b");
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org