You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cactus-dev@jakarta.apache.org by vm...@apache.org on 2002/02/09 15:48:50 UTC

cvs commit: jakarta-cactus/src/sample/share/org/apache/cactus/sample/unit TestServletTestCase1_InterceptorServletTestCase.java TestServletTestCase2.java TestServletTestCase4.java TestServletTestCase5.java TestServletTestCase_Authentication.java

vmassol     02/02/09 06:48:50

  Modified:    docs/framework/xdocs changes.xml
               src/sample/share/org/apache/cactus/sample
                        TestSampleBodyTag.java TestSampleServlet.java
                        TestSampleTag.java
               src/sample/share/org/apache/cactus/sample/unit
                        TestServletTestCase1_InterceptorServletTestCase.java
                        TestServletTestCase2.java TestServletTestCase4.java
                        TestServletTestCase5.java
                        TestServletTestCase_Authentication.java
  Log:
  Cactus now supports JDK 1.4. Actually the only change made to support it was to use the assertXXX() methods of JUnit instead of the assert() one, which is now a reserved keyword in JDK 1.4.
  
  Revision  Changes    Path
  1.81      +6 -0      jakarta-cactus/docs/framework/xdocs/changes.xml
  
  Index: changes.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-cactus/docs/framework/xdocs/changes.xml,v
  retrieving revision 1.80
  retrieving revision 1.81
  diff -u -r1.80 -r1.81
  --- changes.xml	3 Feb 2002 11:36:41 -0000	1.80
  +++ changes.xml	9 Feb 2002 14:48:49 -0000	1.81
  @@ -87,6 +87,12 @@
       </devs>
   
       <release version="1.3 in CVS">
  +      <action dev="VMA" type="add">
  +        Cactus now supports JDK 1.4. Actually the only change made to support it
  +        was to use the <code>assertXXX()</code> methods of JUnit instead of
  +        the <code>assert()</code> one, which is now a reserved keyword in
  +        JDK 1.4.
  +      </action>
         <action dev="VMA" type="update">
           Updated coding conventions and added target to Ant build file for
           automatic checking of conventions using
  
  
  
  1.5       +3 -3      jakarta-cactus/src/sample/share/org/apache/cactus/sample/TestSampleBodyTag.java
  
  Index: TestSampleBodyTag.java
  ===================================================================
  RCS file: /home/cvs/jakarta-cactus/src/sample/share/org/apache/cactus/sample/TestSampleBodyTag.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- TestSampleBodyTag.java	2 Feb 2002 17:54:37 -0000	1.4
  +++ TestSampleBodyTag.java	9 Feb 2002 14:48:50 -0000	1.5
  @@ -67,7 +67,7 @@
    *
    * @author <a href="mailto:nick@eblox.com">Nciholas Lesiecki</a>
    *
  - * @version $Id: TestSampleBodyTag.java,v 1.4 2002/02/02 17:54:37 vmassol Exp $
  + * @version $Id: TestSampleBodyTag.java,v 1.5 2002/02/09 14:48:50 vmassol Exp $
    */
   public class TestSampleBodyTag extends JspTestCase
   {
  @@ -160,10 +160,10 @@
       {
           String content = theResponse.getText();
   
  -        assert("Response should have contained the [" +
  +        assertTrue("Response should have contained the [" +
               "replacement is now replacement] string",
               content.indexOf("replacement is now replacement") > -1);
  -        assert("Response should have contained the [" +
  +        assertTrue("Response should have contained the [" +
               "replacement_replacement] string", content.indexOf("replacement") > -1);
       }
   
  
  
  
  1.17      +11 -11    jakarta-cactus/src/sample/share/org/apache/cactus/sample/TestSampleServlet.java
  
  Index: TestSampleServlet.java
  ===================================================================
  RCS file: /home/cvs/jakarta-cactus/src/sample/share/org/apache/cactus/sample/TestSampleServlet.java,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- TestSampleServlet.java	7 Feb 2002 22:59:56 -0000	1.16
  +++ TestSampleServlet.java	9 Feb 2002 14:48:50 -0000	1.17
  @@ -70,7 +70,7 @@
    *
    * @author <a href="mailto:vmassol@apache.org">Vincent Massol</a>
    *
  - * @version $Id: TestSampleServlet.java,v 1.16 2002/02/07 22:59:56 vmassol Exp $
  + * @version $Id: TestSampleServlet.java,v 1.17 2002/02/09 14:48:50 vmassol Exp $
    */
   public class TestSampleServlet extends ServletTestCase
   {
  @@ -178,7 +178,7 @@
           SampleServlet servlet = new SampleServlet();
           servlet.setSessionVariable(request);
   
  -        assert(session != null);
  +        assertNotNull(session);
           assertEquals("value_setSessionVariable",
               session.getAttribute("name_setSessionVariable"));
       }
  @@ -217,8 +217,8 @@
           SampleServlet servlet = new SampleServlet();
           Hashtable params = servlet.getRequestParameters(request);
   
  -        assert(params.get("param1") != null);
  -        assert(params.get("param2") != null);
  +        assertNotNull(params.get("param1"));
  +        assertNotNull(params.get("param2"));
           assertEquals("value1", params.get("param1"));
           assertEquals("value2", params.get("param2"));
       }
  @@ -272,8 +272,8 @@
           SampleServlet servlet = new SampleServlet();
           Hashtable cookies = servlet.getRequestCookies(request);
   
  -        assert("Cannot find [testcookie] cookie in request",
  -            cookies.get("testcookie") != null);
  +        assertNotNull("Cannot find [testcookie] cookie in request",
  +            cookies.get("testcookie"));
           assertEquals("thisisacookie", cookies.get("testcookie"));
       }
   
  @@ -297,10 +297,10 @@
           SampleServlet servlet = new SampleServlet();
           Hashtable cookies = servlet.getRequestCookies(request);
   
  -        assert(cookies.get("testcookie1") != null);
  +        assertNotNull(cookies.get("testcookie1"));
           assertEquals("cookie1", cookies.get("testcookie1"));
   
  -        assert(cookies.get("testcookie2") != null);
  +        assertNotNull(cookies.get("testcookie2"));
           assertEquals("cookie2", cookies.get("testcookie2"));
       }
   
  @@ -373,7 +373,7 @@
       {
           Cookie cookie = theResponse.getCookie("responsecookie");
   
  -        assert("Cannot find [responsecookie]", cookie != null);
  +        assertNotNull("Cannot find [responsecookie]", cookie);
           assertEquals("responsecookie", cookie.getName());
   
           // Some servers may encode the cookie value (ex: the latest
  @@ -413,7 +413,7 @@
           // different Servlet engine return different text ! For example some
           // return the JSP comment, other do not, ...
           // Thus, we only test for a match of "Hello !"
  -        assert("Text missing 'Hello !' : [" + theResponse.getText() + "]",
  +        assertTrue("Text missing 'Hello !' : [" + theResponse.getText() + "]",
               theResponse.getText().indexOf("Hello !") > 0);
       }
   
  @@ -444,7 +444,7 @@
           // different Servlet engine return different text ! For example some
           // return the JSP comment, other do not, ...
           // Thus, we only test for a match of "Hello !"
  -        assert("Text missing 'Hello !' : [" + theResponse.getText() + "]",
  +        assertTrue("Text missing 'Hello !' : [" + theResponse.getText() + "]",
               theResponse.getText().indexOf("Hello !") > 0);
       }
   
  
  
  
  1.4       +2 -2      jakarta-cactus/src/sample/share/org/apache/cactus/sample/TestSampleTag.java
  
  Index: TestSampleTag.java
  ===================================================================
  RCS file: /home/cvs/jakarta-cactus/src/sample/share/org/apache/cactus/sample/TestSampleTag.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- TestSampleTag.java	2 Feb 2002 17:54:37 -0000	1.3
  +++ TestSampleTag.java	9 Feb 2002 14:48:50 -0000	1.4
  @@ -66,7 +66,7 @@
    *
    * @author <a href="mailto:nick@eblox.com">Nicholas Lesiecki</a>
    *
  - * @version $Id: TestSampleTag.java,v 1.3 2002/02/02 17:54:37 vmassol Exp $
  + * @version $Id: TestSampleTag.java,v 1.4 2002/02/09 14:48:50 vmassol Exp $
    */
   public class TestSampleTag extends JspTestCase
   {
  @@ -217,7 +217,7 @@
       {
           String target = theResponse.getText();
           boolean containsMessage = target.indexOf("This tag has a parent. <BR>") > 0;
  -        assert(!containsMessage);
  +        assertTrue(!containsMessage);
       }
   
       //--------------------------------------------------------------------------
  
  
  
  1.11      +2 -2      jakarta-cactus/src/sample/share/org/apache/cactus/sample/unit/TestServletTestCase1_InterceptorServletTestCase.java
  
  Index: TestServletTestCase1_InterceptorServletTestCase.java
  ===================================================================
  RCS file: /home/cvs/jakarta-cactus/src/sample/share/org/apache/cactus/sample/unit/TestServletTestCase1_InterceptorServletTestCase.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- TestServletTestCase1_InterceptorServletTestCase.java	2 Feb 2002 17:54:37 -0000	1.10
  +++ TestServletTestCase1_InterceptorServletTestCase.java	9 Feb 2002 14:48:50 -0000	1.11
  @@ -67,7 +67,7 @@
    *
    * @author <a href="mailto:vmassol@apache.org">Vincent Massol</a>
    *
  - * @version $Id: TestServletTestCase1_InterceptorServletTestCase.java,v 1.10 2002/02/02 17:54:37 vmassol Exp $
  + * @version $Id: TestServletTestCase1_InterceptorServletTestCase.java,v 1.11 2002/02/09 14:48:50 vmassol Exp $
    * @see TestServletTestCase1
    */
   public class TestServletTestCase1_InterceptorServletTestCase
  @@ -124,7 +124,7 @@
               // and contains the text "test serializable exception", then
               // the test is ok.
               if (this.getCurrentTestMethod().equals("testExceptionSerializable")) {
  -                assert(e.instanceOf(
  +                assertTrue(e.instanceOf(
                       TestServletTestCase1_ExceptionSerializable.class));
   
                   assertEquals("test serializable exception", e.getMessage());
  
  
  
  1.25      +10 -10    jakarta-cactus/src/sample/share/org/apache/cactus/sample/unit/TestServletTestCase2.java
  
  Index: TestServletTestCase2.java
  ===================================================================
  RCS file: /home/cvs/jakarta-cactus/src/sample/share/org/apache/cactus/sample/unit/TestServletTestCase2.java,v
  retrieving revision 1.24
  retrieving revision 1.25
  diff -u -r1.24 -r1.25
  --- TestServletTestCase2.java	2 Feb 2002 17:54:37 -0000	1.24
  +++ TestServletTestCase2.java	9 Feb 2002 14:48:50 -0000	1.25
  @@ -86,7 +86,7 @@
    *
    * @author <a href="mailto:vmassol@apache.org">Vincent Massol</a>
    *
  - * @version $Id: TestServletTestCase2.java,v 1.24 2002/02/02 17:54:37 vmassol Exp $
  + * @version $Id: TestServletTestCase2.java,v 1.25 2002/02/09 14:48:50 vmassol Exp $
    */
   public class TestServletTestCase2 extends ServletTestCase
   {
  @@ -141,8 +141,8 @@
        */
       public void testNoAutomaticSessionCreation()
       {
  -        assert("A valid session has been found when no session should exist",
  -            session == null);
  +        assertNull("A valid session has been found when no session should exist",
  +            session);
       }
   
       //-------------------------------------------------------------------------
  @@ -222,7 +222,7 @@
               }
           }
   
  -        assert("[testparam] not found in parameter names", found);
  +        assertTrue("[testparam] not found in parameter names", found);
       }
   
       //-------------------------------------------------------------------------
  @@ -372,13 +372,13 @@
           String[] results1 = theResponse.getTextAsArray();
           String[] results2 = theResponse.getTextAsArray();
   
  -        assert("Should have returned 3 lines of text but returned [" +
  +        assertTrue("Should have returned 3 lines of text but returned [" +
               results1.length + "]", results1.length == 3);
           assertEquals("<html><head/>", results1[0]);
           assertEquals("<body>A GET request</body>", results1[1]);
           assertEquals("</html>", results1[2]);
   
  -        assert("Should have returned 3 lines of text but returned [" +
  +        assertTrue("Should have returned 3 lines of text but returned [" +
               results2.length + "]", results2.length == 3);
           assertEquals("<html><head/>", results2[0]);
           assertEquals("<body>A GET request</body>", results2[1]);
  @@ -438,7 +438,7 @@
           throws IOException
       {
           String result = theResponse.getText();
  -        assert("Page not found, got [" + result + "]",
  +        assertTrue("Page not found, got [" + result + "]",
               result.indexOf("Hello !") > 0);
       }
   
  @@ -478,7 +478,7 @@
           throws IOException
       {
           String result = theResponse.getText();
  -        assert("Page not found, got [" + result + "]",
  +        assertTrue("Page not found, got [" + result + "]",
               result.indexOf("Hello !") > 0);
       }
   
  @@ -497,7 +497,7 @@
   
           Vector logs = ((ServletContextWrapper) context).getLogs();
           assertEquals("Found more than one log message", logs.size(), 1);
  -        assert("Cannot find expected log message : [" + message + "]",
  +        assertTrue("Cannot find expected log message : [" + message + "]",
               logs.contains("some test log"));
       }
   
  @@ -598,7 +598,7 @@
               assertNull("Should have been null", pathTranslated);
           } else {
               assertNotNull("Should not be null", pathTranslated);
  -            assert("Should end with [" + nativePathInfo + "] but got [" +
  +            assertTrue("Should end with [" + nativePathInfo + "] but got [" +
                   pathTranslated + "] instead",
                   pathTranslated.endsWith(nativePathInfo));
           }
  
  
  
  1.10      +3 -3      jakarta-cactus/src/sample/share/org/apache/cactus/sample/unit/TestServletTestCase4.java
  
  Index: TestServletTestCase4.java
  ===================================================================
  RCS file: /home/cvs/jakarta-cactus/src/sample/share/org/apache/cactus/sample/unit/TestServletTestCase4.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- TestServletTestCase4.java	2 Feb 2002 17:54:37 -0000	1.9
  +++ TestServletTestCase4.java	9 Feb 2002 14:48:50 -0000	1.10
  @@ -71,7 +71,7 @@
    *
    * @author <a href="mailto:vmassol@apache.org">Vincent Massol</a>
    *
  - * @version $Id: TestServletTestCase4.java,v 1.9 2002/02/02 17:54:37 vmassol Exp $
  + * @version $Id: TestServletTestCase4.java,v 1.10 2002/02/09 14:48:50 vmassol Exp $
    */
   public class TestServletTestCase4 extends ServletTestCase
   {
  @@ -243,7 +243,7 @@
           assertEquals(80, request.getServerPort());
           assertEquals("/catalog", request.getContextPath());
           assertEquals("/help/feedback.jsp", request.getServletPath());
  -        assert(request.getPathInfo() == null);
  +        assertNull(request.getPathInfo());
       }
   
       //-------------------------------------------------------------------------
  @@ -274,7 +274,7 @@
           assertEquals(80, request.getServerPort());
           assertEquals("/catalog", request.getContextPath());
           assertEquals("/help/feedback.jsp", request.getServletPath());
  -        assert(request.getPathInfo() == null);
  +        assertNull(request.getPathInfo());
           assertEquals("PARAM1=param1&PARAM2=&PARAM3=param3",
               request.getQueryString());
           assertEquals(request.getParameter("PARAM1"), "param1");
  
  
  
  1.8       +2 -2      jakarta-cactus/src/sample/share/org/apache/cactus/sample/unit/TestServletTestCase5.java
  
  Index: TestServletTestCase5.java
  ===================================================================
  RCS file: /home/cvs/jakarta-cactus/src/sample/share/org/apache/cactus/sample/unit/TestServletTestCase5.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- TestServletTestCase5.java	2 Feb 2002 17:54:37 -0000	1.7
  +++ TestServletTestCase5.java	9 Feb 2002 14:48:50 -0000	1.8
  @@ -75,7 +75,7 @@
    *
    * @author <a href="mailto:vmassol@apache.org">Vincent Massol</a>
    *
  - * @version $Id: TestServletTestCase5.java,v 1.7 2002/02/02 17:54:37 vmassol Exp $
  + * @version $Id: TestServletTestCase5.java,v 1.8 2002/02/09 14:48:50 vmassol Exp $
    */
   public class TestServletTestCase5
       extends TestServletTestCase5_InterceptorServletTestCase
  @@ -120,7 +120,7 @@
       public void testTearDown() throws Exception
       {
           // Provoke an exception
  -        assert(false);
  +        fail("provoked error");
       }
   
       /**
  
  
  
  1.3       +2 -2      jakarta-cactus/src/sample/share/org/apache/cactus/sample/unit/TestServletTestCase_Authentication.java
  
  Index: TestServletTestCase_Authentication.java
  ===================================================================
  RCS file: /home/cvs/jakarta-cactus/src/sample/share/org/apache/cactus/sample/unit/TestServletTestCase_Authentication.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- TestServletTestCase_Authentication.java	2 Feb 2002 17:54:37 -0000	1.2
  +++ TestServletTestCase_Authentication.java	9 Feb 2002 14:48:50 -0000	1.3
  @@ -71,7 +71,7 @@
    *
    * @author <a href="mailto:vmassol@apache.org">Vincent Massol</a>
    *
  - * @version $Id: TestServletTestCase_Authentication.java,v 1.2 2002/02/02 17:54:37 vmassol Exp $
  + * @version $Id: TestServletTestCase_Authentication.java,v 1.3 2002/02/09 14:48:50 vmassol Exp $
    */
   public class TestServletTestCase_Authentication extends ServletTestCase
   {
  @@ -125,7 +125,7 @@
       {
           assertEquals("testuser", request.getUserPrincipal().getName());
           assertEquals("testuser", request.getRemoteUser());
  -        assert("User not in 'test' role", request.isUserInRole("test"));
  +        assertTrue("User not in 'test' role", request.isUserInRole("test"));
       }
   
   }
  
  
  

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>