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 2012/03/05 20:49:12 UTC

svn commit: r1297202 - in /tomcat/trunk/test/org/apache/catalina/core: TestStandardContext.java TestStandardWrapper.java

Author: markt
Date: Mon Mar  5 19:49:12 2012
New Revision: 1297202

URL: http://svn.apache.org/viewvc?rev=1297202&view=rev
Log:
Fix remaining failing unit tests now error pages are available.

Modified:
    tomcat/trunk/test/org/apache/catalina/core/TestStandardContext.java
    tomcat/trunk/test/org/apache/catalina/core/TestStandardWrapper.java

Modified: tomcat/trunk/test/org/apache/catalina/core/TestStandardContext.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/catalina/core/TestStandardContext.java?rev=1297202&r1=1297201&r2=1297202&view=diff
==============================================================================
--- tomcat/trunk/test/org/apache/catalina/core/TestStandardContext.java (original)
+++ tomcat/trunk/test/org/apache/catalina/core/TestStandardContext.java Mon Mar  5 19:49:12 2012
@@ -43,7 +43,6 @@ import javax.servlet.http.HttpServletRes
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotSame;
-import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 
@@ -154,12 +153,13 @@ public class TestStandardContext extends
         tomcat.addWebapp("", root.getAbsolutePath());
 
         tomcat.start();
-        ByteChunk result;
+        ByteChunk result = new ByteChunk();
 
         // Check filter and servlet aren't called
-        result = getUrl("http://localhost:" + getPort() +
-                "/bug49922/foo");
-        assertNull(result.toString());
+        int rc = getUrl("http://localhost:" + getPort() +
+                "/bug49922/foo", result, null);
+        assertEquals(HttpServletResponse.SC_NOT_FOUND, rc);
+        assertTrue(result.getLength() > 0);
 
         // Check extension mapping works
         result = getUrl("http://localhost:" + getPort() + "/foo.do");

Modified: tomcat/trunk/test/org/apache/catalina/core/TestStandardWrapper.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/catalina/core/TestStandardWrapper.java?rev=1297202&r1=1297201&r2=1297202&view=diff
==============================================================================
--- tomcat/trunk/test/org/apache/catalina/core/TestStandardWrapper.java (original)
+++ tomcat/trunk/test/org/apache/catalina/core/TestStandardWrapper.java Mon Mar  5 19:49:12 2012
@@ -45,7 +45,6 @@ import javax.servlet.http.HttpServletRes
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertTrue;
 
 import org.junit.Test;
@@ -113,7 +112,7 @@ public class TestStandardWrapper extends
                 "/testStandardWrapper/securityAnnotationsWebXmlPriority",
                 bc, null, null);
 
-        assertNull(bc.toString());
+        assertTrue(bc.getLength() > 0);
         assertEquals(403, rc);
     }
 
@@ -163,7 +162,7 @@ public class TestStandardWrapper extends
         rc = getUrl("http://localhost:" + getPort() + "/",
                 bc, null, null);
 
-        assertNull(bc.toString());
+        assertTrue(bc.getLength() > 0);
         assertEquals(403, rc);
     }
 
@@ -182,9 +181,11 @@ public class TestStandardWrapper extends
         rc = getUrl("http://localhost:" + getPort() + "/protected.jsp",
                 bc, null, null);
 
-        assertNull(bc.toString());
+        assertTrue(bc.getLength() > 0);
         assertEquals(403, rc);
 
+        bc.recycle();
+
         rc = getUrl("http://localhost:" + getPort() + "/unprotected.jsp",
                 bc, null, null);
 
@@ -213,7 +214,7 @@ public class TestStandardWrapper extends
         rc = getUrl("http://localhost:" + getPort() + "/", bc, null, null);
 
         if (useCreateServlet) {
-            assertNull(bc.toString());
+            assertTrue(bc.getLength() > 0);
             assertEquals(403, rc);
         } else {
             assertEquals("OK", bc.toString());
@@ -270,7 +271,7 @@ public class TestStandardWrapper extends
             assertEquals("OK", bc.toString());
             assertEquals(200, rc);
         } else {
-            assertNull(bc.toString());
+            assertTrue(bc.getLength() > 0);
             assertEquals(403, rc);
         }
     }



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