vmassol     2004/03/24 09:06:57

  Modified:    framework/src/test/share/org/apache/cactus/util TestAll.java
  Added:       framework/src/test/share/org/apache/cactus/util
                        TestIoUtil.java
  Log:
  added IoUtil unit test
  
  Revision  Changes    Path
  1.6       +3 -2      
jakarta-cactus/framework/src/test/share/org/apache/cactus/util/TestAll.java
  
  Index: TestAll.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-cactus/framework/src/test/share/org/apache/cactus/util/TestAll.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- TestAll.java      16 Mar 2004 21:45:02 -0000      1.5
  +++ TestAll.java      24 Mar 2004 17:06:57 -0000      1.6
  @@ -43,7 +43,8 @@
           suite.addTestSuite(TestCookieUtil.class);
           suite.addTestSuite(TestUniqueGenerator.class);
           suite.addTestSuite(TestTestCaseImplementChecker.class);
  -
  +        suite.addTestSuite(TestIoUtil.class);
  +        
           return suite;
       }
   }
  
  
  
  1.1                  
jakarta-cactus/framework/src/test/share/org/apache/cactus/util/TestIoUtil.java
  
  Index: TestIoUtil.java
  ===================================================================
  /* 
   * ========================================================================
   * 
   * Copyright 2004 The Apache Software Foundation.
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   * 
   *   http://www.apache.org/licenses/LICENSE-2.0
   * 
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   * 
   * ========================================================================
   */
  package org.apache.cactus.util;
  
  import java.io.IOException;
  
  import org.apache.tools.ant.filters.StringInputStream;
  
  import junit.framework.TestCase;
  
  /**
   * Unit tests for the [EMAIL PROTECTED] IoUtil} class.
   *
   * @version $Id: TestIoUtil.java,v 1.1 2004/03/24 17:06:57 vmassol Exp $
   */
  public class TestIoUtil extends TestCase
  {
      /**
       * Verify that the <code>getText()</code> method reads properly all bytes 
       * from an input stream.
       * 
       * @exception IOException on error
       */
      public void testGetTextOk() throws IOException
      {
          String expected = 
              "<html><head/>\n<body>A GET request</body>\n</html>\n";
          StringInputStream in = new StringInputStream(expected);
  
          String result = IoUtil.getText(in);
  
          assertEquals(expected, result);
      }
  
      /**
       * Verify that the <code>getText()</code> method works when the input 
       * stream does not contain any data.
       * 
       * @exception IOException on error
       */
      public void testGetTextEmpty() throws IOException
      {
          StringInputStream in = new StringInputStream("");
  
          String result = IoUtil.getText(in);
  
          assertEquals("", result);
      }
  }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to