You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@poi.apache.org by jo...@apache.org on 2009/06/12 23:53:20 UTC

svn commit: r784284 [3/3] - in /poi/trunk/src: ooxml/testcases/org/apache/poi/openxml4j/opc/compliance/ ooxml/testcases/org/apache/poi/xssf/eventusermodel/ ooxml/testcases/org/apache/poi/xssf/usermodel/ scratchpad/testcases/org/apache/poi/hdf/model/ sc...

Modified: poi/trunk/src/testcases/org/apache/poi/util/TestByteField.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/util/TestByteField.java?rev=784284&r1=784283&r2=784284&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/util/TestByteField.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/util/TestByteField.java Fri Jun 12 21:53:17 2009
@@ -15,46 +15,27 @@
    See the License for the specific language governing permissions and
    limitations under the License.
 ==================================================================== */
-        
 
 package org.apache.poi.util;
 
-import junit.framework.*;
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
 
-import java.io.*;
+import junit.framework.TestCase;
 
 /**
  * Title:        Unit test for ByteField class
  * Description:  Unit test for ByteField class
  * @author       Marc Johnson (mjohnson at apache dot org)
  */
+public final class TestByteField extends TestCase {
 
-public class TestByteField
-    extends TestCase
-{
-
-    /**
-     * Constructor
-     *
-     * @param name
-     */
-
-    public TestByteField(String name)
-    {
-        super(name);
-    }
-
-    static private final byte[] _test_array =
+    private static final byte[] _test_array =
     {
         Byte.MIN_VALUE, ( byte ) -1, ( byte ) 0, ( byte ) 1, Byte.MAX_VALUE
     };
 
-    /**
-     * Test constructors.
-     */
-
-    public void testConstructors()
-    {
+    public void testConstructors() {
         try
         {
             new ByteField(-1);
@@ -114,12 +95,7 @@
         }
     }
 
-    /**
-     * Test set() methods
-     */
-
-    public void testSet()
-    {
+    public void testSet() {
         ByteField field = new ByteField(0);
         byte[]    array = new byte[ 1 ];
 
@@ -134,12 +110,7 @@
         }
     }
 
-    /**
-     * Test readFromBytes
-     */
-
-    public void testReadFromBytes()
-    {
+    public void testReadFromBytes() {
         ByteField field = new ByteField(1);
         byte[]    array = new byte[ 1 ];
 
@@ -162,15 +133,7 @@
         }
     }
 
-    /**
-     * Test readFromStream
-     *
-     * @exception IOException
-     */
-
-    public void testReadFromStream()
-        throws IOException
-    {
+    public void testReadFromStream() throws IOException {
         ByteField field  = new ByteField(0);
         byte[]    buffer = new byte[ _test_array.length ];
 
@@ -184,12 +147,7 @@
         }
     }
 
-    /**
-     * test writeToBytes
-     */
-
-    public void testWriteToBytes()
-    {
+    public void testWriteToBytes() {
         ByteField field = new ByteField(0);
         byte[]    array = new byte[ 1 ];
 
@@ -200,16 +158,4 @@
             assertEquals("testing ", _test_array[ j ], array[ 0 ]);
         }
     }
-
-    /**
-     * Main
-     *
-     * @param ignored_args
-     */
-
-    public static void main(String [] ignored_args)
-    {
-        System.out.println("Testing util.ByteField functionality");
-        junit.textui.TestRunner.run(TestByteField.class);
-    }
 }

Modified: poi/trunk/src/testcases/org/apache/poi/util/TestIntList.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/util/TestIntList.java?rev=784284&r1=784283&r2=784284&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/util/TestIntList.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/util/TestIntList.java Fri Jun 12 21:53:17 2009
@@ -1,4 +1,3 @@
-
 /* ====================================================================
    Licensed to the Apache Software Foundation (ASF) under one or more
    contributor license agreements.  See the NOTICE file distributed with
@@ -15,39 +14,19 @@
    See the License for the specific language governing permissions and
    limitations under the License.
 ==================================================================== */
-        
 
 package org.apache.poi.util;
 
-import junit.framework.*;
+import junit.framework.TestCase;
 
 /**
  * Class to test IntList
  *
  * @author Marc Johnson
  */
+public final class TestIntList extends TestCase {
 
-public class TestIntList
-    extends TestCase
-{
-
-    /**
-     * Constructor TestIntList
-     *
-     * @param name
-     */
-
-    public TestIntList(String name)
-    {
-        super(name);
-    }
-
-    /**
-     * test the various IntListconstructors
-     */
-
-    public void testConstructors()
-    {
+    public void testConstructors() {
         IntList list = new IntList();
 
         assertTrue(list.isEmpty());
@@ -61,12 +40,7 @@
         assertTrue(list3.isEmpty());
     }
 
-    /**
-     * test the add method
-     */
-
-    public void testAdd()
-    {
+    public void testAdd() {
         IntList list      = new IntList();
         int[]   testArray =
         {
@@ -144,12 +118,7 @@
         }
     }
 
-    /**
-     * test the addAll method
-     */
-
-    public void testAddAll()
-    {
+    public void testAddAll() {
         IntList list = new IntList();
 
         for (int j = 0; j < 5; j++)
@@ -223,12 +192,7 @@
         assertEquals(list.get(4), empty.get(14));
     }
 
-    /**
-     * test the clear method
-     */
-
-    public void testClear()
-    {
+    public void testClear() {
         IntList list = new IntList();
 
         for (int j = 0; j < 500; j++)
@@ -249,12 +213,7 @@
         }
     }
 
-    /**
-     * test the contains method
-     */
-
-    public void testContains()
-    {
+    public void testContains() {
         IntList list = new IntList();
 
         for (int j = 0; j < 1000; j += 2)
@@ -274,12 +233,7 @@
         }
     }
 
-    /**
-     * test the containsAll method
-     */
-
-    public void testContainsAll()
-    {
+    public void testContainsAll() {
         IntList list = new IntList();
 
         assertTrue(list.containsAll(list));
@@ -299,12 +253,7 @@
         assertTrue(!list.containsAll(list2));
     }
 
-    /**
-     * test the equals method
-     */
-
-    public void testEquals()
-    {
+    public void testEquals() {
         IntList list = new IntList();
 
         assertEquals(list, list);
@@ -328,12 +277,7 @@
         assertTrue(!list2.equals(list));
     }
 
-    /**
-     * test the get method
-     */
-
-    public void testGet()
-    {
+    public void testGet() {
         IntList list = new IntList();
 
         for (int j = 0; j < 1000; j++)
@@ -360,12 +304,7 @@
         }
     }
 
-    /**
-     * test the indexOf method
-     */
-
-    public void testIndexOf()
-    {
+    public void testIndexOf() {
         IntList list = new IntList();
 
         for (int j = 0; j < 1000; j++)
@@ -385,12 +324,7 @@
         }
     }
 
-    /**
-     * test the isEmpty method
-     */
-
-    public void testIsEmpty()
-    {
+    public void testIsEmpty() {
         IntList list1 = new IntList();
         IntList list2 = new IntList(1000);
         IntList list3 = new IntList(list1);
@@ -412,12 +346,7 @@
         assertTrue(list3.isEmpty());
     }
 
-    /**
-     * test the lastIndexOf method
-     */
-
-    public void testLastIndexOf()
-    {
+    public void testLastIndexOf() {
         IntList list = new IntList();
 
         for (int j = 0; j < 1000; j++)
@@ -437,12 +366,7 @@
         }
     }
 
-    /**
-     * test the remove method
-     */
-
-    public void testRemove()
-    {
+    public void testRemove() {
         IntList list = new IntList();
 
         for (int j = 0; j < 1000; j++)
@@ -475,12 +399,7 @@
         }
     }
 
-    /**
-     * test the removeValue method
-     */
-
-    public void testRemoveValue()
-    {
+    public void testRemoveValue() {
         IntList list = new IntList();
 
         for (int j = 0; j < 1000; j++)
@@ -498,12 +417,7 @@
         }
     }
 
-    /**
-     * test the removeAll method
-     */
-
-    public void testRemoveAll()
-    {
+    public void testRemoveAll() {
         IntList list = new IntList();
 
         for (int j = 0; j < 1000; j++)
@@ -535,12 +449,7 @@
         assertTrue(listCopy.isEmpty());
     }
 
-    /**
-     * test the retainAll method
-     */
-
-    public void testRetainAll()
-    {
+    public void testRetainAll() {
         IntList list = new IntList();
 
         for (int j = 0; j < 1000; j++)
@@ -572,12 +481,7 @@
         assertTrue(listCopy.isEmpty());
     }
 
-    /**
-     * test the set method
-     */
-
-    public void testSet()
-    {
+    public void testSet() {
         IntList list = new IntList();
 
         for (int j = 0; j < 1000; j++)
@@ -605,12 +509,7 @@
         }
     }
 
-    /**
-     * test the size method
-     */
-
-    public void testSize()
-    {
+    public void testSize() {
         IntList list = new IntList();
 
         for (int j = 0; j < 1000; j++)
@@ -627,12 +526,7 @@
         }
     }
 
-    /**
-     * test the toArray method
-     */
-
-    public void testToArray()
-    {
+    public void testToArray() {
         IntList list = new IntList();
 
         for (int j = 0; j < 1000; j++)
@@ -672,16 +566,4 @@
             assertEquals(a5[ j ], list.get(j));
         }
     }
-
-    /**
-     * main method to run the unit tests
-     *
-     * @param unused_args
-     */
-
-    public static void main(String [] unused_args)
-    {
-        System.out.println("Testing util.IntList functionality");
-        junit.textui.TestRunner.run(TestIntList.class);
-    }
 }

Modified: poi/trunk/src/testcases/org/apache/poi/util/TestIntegerField.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/util/TestIntegerField.java?rev=784284&r1=784283&r2=784284&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/util/TestIntegerField.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/util/TestIntegerField.java Fri Jun 12 21:53:17 2009
@@ -1,4 +1,3 @@
-
 /* ====================================================================
    Licensed to the Apache Software Foundation (ASF) under one or more
    contributor license agreements.  See the NOTICE file distributed with
@@ -15,46 +14,27 @@
    See the License for the specific language governing permissions and
    limitations under the License.
 ==================================================================== */
-        
 
 package org.apache.poi.util;
 
-import junit.framework.*;
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
 
-import java.io.*;
+import junit.framework.TestCase;
 
 /**
  * Test IntegerField code
  *
  * @author  Marc Johnson (mjohnson at apache dot org)
  */
+public final class TestIntegerField extends TestCase {
 
-public class TestIntegerField
-    extends TestCase
-{
-
-    /**
-     * Constructor
-     *
-     * @param name
-     */
-
-    public TestIntegerField(String name)
-    {
-        super(name);
-    }
-
-    static private final int[] _test_array =
+    private static final int[] _test_array =
     {
         Integer.MIN_VALUE, -1, 0, 1, Integer.MAX_VALUE
     };
 
-    /**
-     * Test constructors.
-     */
-
-    public void testConstructors()
-    {
+    public void testConstructors() {
         try
         {
             new IntegerField(-1);
@@ -117,12 +97,7 @@
         }
     }
 
-    /**
-     * Test set() methods
-     */
-
-    public void testSet()
-    {
+    public void testSet() {
         IntegerField field = new IntegerField(0);
         byte[]       array = new byte[ 4 ];
 
@@ -147,12 +122,7 @@
         }
     }
 
-    /**
-     * Test readFromBytes
-     */
-
-    public void testReadFromBytes()
-    {
+    public void testReadFromBytes() {
         IntegerField field = new IntegerField(1);
         byte[]       array = new byte[ 4 ];
 
@@ -178,15 +148,7 @@
         }
     }
 
-    /**
-     * Test readFromStream
-     *
-     * @exception IOException
-     */
-
-    public void testReadFromStream()
-        throws IOException
-    {
+    public void testReadFromStream() throws IOException {
         IntegerField field  = new IntegerField(0);
         byte[]       buffer = new byte[ _test_array.length * 4 ];
 
@@ -206,12 +168,7 @@
         }
     }
 
-    /**
-     * test writeToBytes
-     */
-
-    public void testWriteToBytes()
-    {
+    public void testWriteToBytes() {
         IntegerField field = new IntegerField(0);
         byte[]       array = new byte[ 4 ];
 
@@ -228,16 +185,4 @@
             assertEquals("testing ", _test_array[ j ], val);
         }
     }
-
-    /**
-     * Main
-     *
-     * @param args
-     */
-
-    public static void main(String [] args)
-    {
-        System.out.println("Testing util.IntegerField functionality");
-        junit.textui.TestRunner.run(TestIntegerField.class);
-    }
 }

Modified: poi/trunk/src/testcases/org/apache/poi/util/TestPOILogFactory.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/util/TestPOILogFactory.java?rev=784284&r1=784283&r2=784284&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/util/TestPOILogFactory.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/util/TestPOILogFactory.java Fri Jun 12 21:53:17 2009
@@ -1,4 +1,3 @@
-
 /* ====================================================================
    Licensed to the Apache Software Foundation (ASF) under one or more
    contributor license agreements.  See the NOTICE file distributed with
@@ -15,43 +14,23 @@
    See the License for the specific language governing permissions and
    limitations under the License.
 ==================================================================== */
-        
 
 package org.apache.poi.util;
 
 import junit.framework.TestCase;
 
-import java.io.IOException;
-
 /**
  * @author Marc Johnson (mjohnson at apache dot org)
  * @author Glen Stampoultzis (glens at apache.org)
  * @author Nicola Ken Barozzi (nicolaken at apache.org)
  */
+public final class TestPOILogFactory extends TestCase {
 
-public class TestPOILogFactory
-        extends TestCase
-{
-    /**
-     * Creates new TestPOILogFactory
-     *
-     * @param name
-     */
-
-    public TestPOILogFactory( String name )
-    {
-        super( name );
-    }
 
     /**
      * test log creation
-     *
-     * @exception IOException
      */
-
-    public void testLog()
-            throws IOException
-    {
+    public void testLog() {
         //NKB Testing only that logging classes use gives no exception
         //    Since logging can be disabled, no checking of logging
         //    output is done.
@@ -72,16 +51,4 @@
         l2.log( POILogger.DEBUG, "testing cat org.apache.poi.hdf.*:DEBUG" );
 
     }
-
-    /**
-     * main method to run the unit tests
-     *
-     * @param ignored_args
-     */
-
-    public static void main( String[] ignored_args )
-    {
-        System.out.println( "Testing basic util.POILogFactory functionality" );
-        junit.textui.TestRunner.run( TestPOILogFactory.class );
-    }
 }

Modified: poi/trunk/src/testcases/org/apache/poi/util/TestPOILogger.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/util/TestPOILogger.java?rev=784284&r1=784283&r2=784284&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/util/TestPOILogger.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/util/TestPOILogger.java Fri Jun 12 21:53:17 2009
@@ -15,7 +15,6 @@
    See the License for the specific language governing permissions and
    limitations under the License.
 ==================================================================== */
-        
 
 package org.apache.poi.util;
 
@@ -28,31 +27,12 @@
  * @author Marc Johnson (mjohnson at apache dot org)
  * @author Nicola Ken Barozzi (nicolaken at apache.org)
  */
-
-public class TestPOILogger
-        extends TestCase
-{
-    /**
-     * Constructor TestPOILogger
-     *
-     *
-     * @param s
-     *
-     */
-
-    public TestPOILogger( String s )
-    {
-        super( s );
-    }
+public final class TestPOILogger extends TestCase {
 
     /**
      * Test different types of log output.
-     *
-     * @exception Exception
      */
-    public void testVariousLogTypes()
-            throws Exception
-    {
+    public void testVariousLogTypes() {
         //NKB Testing only that logging classes use gives no exception
         //    Since logging can be disabled, no checking of logging
         //    output is done.

Modified: poi/trunk/src/testcases/org/apache/poi/util/TestShortField.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/util/TestShortField.java?rev=784284&r1=784283&r2=784284&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/util/TestShortField.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/util/TestShortField.java Fri Jun 12 21:53:17 2009
@@ -1,4 +1,3 @@
-
 /* ====================================================================
    Licensed to the Apache Software Foundation (ASF) under one or more
    contributor license agreements.  See the NOTICE file distributed with
@@ -15,7 +14,6 @@
    See the License for the specific language governing permissions and
    limitations under the License.
 ==================================================================== */
-        
 
 package org.apache.poi.util;
 
@@ -28,34 +26,15 @@
  *
  * @author  Marc Johnson (mjohnson at apache dot org)
  */
+public final class TestShortField extends TestCase {
 
-public class TestShortField
-    extends TestCase
-{
-
-    /**
-     * Constructor
-     *
-     * @param name
-     */
-
-    public TestShortField(String name)
-    {
-        super(name);
-    }
-
-    static private final short[] _test_array =
+    private static final short[] _test_array =
     {
         Short.MIN_VALUE, ( short ) -1, ( short ) 0, ( short ) 1,
         Short.MAX_VALUE
     };
 
-    /**
-     * Test constructors.
-     */
-
-    public void testConstructors()
-    {
+    public void testConstructors() {
         try
         {
             new ShortField(-1);
@@ -116,12 +95,7 @@
         }
     }
 
-    /**
-     * Test set() methods
-     */
-
-    public void testSet()
-    {
+    public void testSet() {
         ShortField field = new ShortField(0);
         byte[]     array = new byte[ 2 ];
 
@@ -140,12 +114,7 @@
         }
     }
 
-    /**
-     * Test readFromBytes
-     */
-
-    public void testReadFromBytes()
-    {
+    public void testReadFromBytes() {
         ShortField field = new ShortField(1);
         byte[]     array = new byte[ 2 ];
 
@@ -169,15 +138,7 @@
         }
     }
 
-    /**
-     * Test readFromStream
-     *
-     * @exception IOException
-     */
-
-    public void testReadFromStream()
-        throws IOException
-    {
+    public void testReadFromStream() throws IOException {
         ShortField field  = new ShortField(0);
         byte[]     buffer = new byte[ _test_array.length * 2 ];
 
@@ -195,12 +156,7 @@
         }
     }
 
-    /**
-     * test writeToBytes
-     */
-
-    public void testWriteToBytes()
-    {
+    public void testWriteToBytes() {
         ShortField field = new ShortField(0);
         byte[]     array = new byte[ 2 ];
 
@@ -215,16 +171,4 @@
             assertEquals("testing ", _test_array[ j ], val);
         }
     }
-
-    /**
-     * Main
-     *
-     * @param args
-     */
-
-    public static void main(String [] args)
-    {
-        System.out.println("Testing util.ShortField functionality");
-        junit.textui.TestRunner.run(TestShortField.class);
-    }
 }

Modified: poi/trunk/src/testcases/org/apache/poi/util/TestShortList.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/util/TestShortList.java?rev=784284&r1=784283&r2=784284&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/util/TestShortList.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/util/TestShortList.java Fri Jun 12 21:53:17 2009
@@ -1,4 +1,3 @@
-
 /* ====================================================================
    Licensed to the Apache Software Foundation (ASF) under one or more
    contributor license agreements.  See the NOTICE file distributed with
@@ -15,39 +14,19 @@
    See the License for the specific language governing permissions and
    limitations under the License.
 ==================================================================== */
-        
 
 package org.apache.poi.util;
 
-import junit.framework.*;
+import junit.framework.TestCase;
 
 /**
  * Class to test ShortList
  *
  * @author Marc Johnson
  */
+public final class TestShortList extends TestCase {
 
-public class TestShortList
-    extends TestCase
-{
-
-    /**
-     * Constructor TestShortList
-     *
-     * @param name
-     */
-
-    public TestShortList(String name)
-    {
-        super(name);
-    }
-
-    /**
-     * test the various ShortListconstructors
-     */
-
-    public void testConstructors()
-    {
+    public void testConstructors() {
         ShortList list = new ShortList();
 
         assertTrue(list.isEmpty());
@@ -61,12 +40,7 @@
         assertTrue(list3.isEmpty());
     }
 
-    /**
-     * test the add method
-     */
-
-    public void testAdd()
-    {
+    public void testAdd() {
         ShortList list      = new ShortList();
         short[]   testArray =
         {
@@ -144,12 +118,7 @@
         }
     }
 
-    /**
-     * test the addAll method
-     */
-
-    public void testAddAll()
-    {
+    public void testAddAll() {
         ShortList list = new ShortList();
 
         for (short j = 0; j < 5; j++)
@@ -223,12 +192,7 @@
         assertEquals(list.get(4), empty.get(14));
     }
 
-    /**
-     * test the clear method
-     */
-
-    public void testClear()
-    {
+    public void testClear() {
         ShortList list = new ShortList();
 
         for (short j = 0; j < 500; j++)
@@ -249,12 +213,7 @@
         }
     }
 
-    /**
-     * test the contains method
-     */
-
-    public void testContains()
-    {
+    public void testContains() {
         ShortList list = new ShortList();
 
         for (short j = 0; j < 1000; j += 2)
@@ -274,12 +233,7 @@
         }
     }
 
-    /**
-     * test the containsAll method
-     */
-
-    public void testContainsAll()
-    {
+    public void testContainsAll() {
         ShortList list = new ShortList();
 
         assertTrue(list.containsAll(list));
@@ -299,12 +253,7 @@
         assertTrue(!list.containsAll(list2));
     }
 
-    /**
-     * test the equals method
-     */
-
-    public void testEquals()
-    {
+    public void testEquals() {
         ShortList list = new ShortList();
 
         assertEquals(list, list);
@@ -328,12 +277,7 @@
         assertTrue(!list2.equals(list));
     }
 
-    /**
-     * test the get method
-     */
-
-    public void testGet()
-    {
+    public void testGet() {
         ShortList list = new ShortList();
 
         for (short j = 0; j < 1000; j++)
@@ -360,12 +304,7 @@
         }
     }
 
-    /**
-     * test the indexOf method
-     */
-
-    public void testIndexOf()
-    {
+    public void testIndexOf() {
         ShortList list = new ShortList();
 
         for (short j = 0; j < 1000; j++)
@@ -385,12 +324,7 @@
         }
     }
 
-    /**
-     * test the isEmpty method
-     */
-
-    public void testIsEmpty()
-    {
+    public void testIsEmpty() {
         ShortList list1 = new ShortList();
         ShortList list2 = new ShortList(1000);
         ShortList list3 = new ShortList(list1);
@@ -412,12 +346,7 @@
         assertTrue(list3.isEmpty());
     }
 
-    /**
-     * test the lastIndexOf method
-     */
-
-    public void testLastIndexOf()
-    {
+    public void testLastIndexOf() {
         ShortList list = new ShortList();
 
         for (short j = 0; j < 1000; j++)
@@ -437,12 +366,7 @@
         }
     }
 
-    /**
-     * test the remove method
-     */
-
-    public void testRemove()
-    {
+    public void testRemove() {
         ShortList list = new ShortList();
 
         for (short j = 0; j < 1000; j++)
@@ -476,12 +400,7 @@
         }
     }
 
-    /**
-     * test the removeValue method
-     */
-
-    public void testRemoveValue()
-    {
+    public void testRemoveValue() {
         ShortList list = new ShortList();
 
         for (short j = 0; j < 1000; j++)
@@ -499,12 +418,7 @@
         }
     }
 
-    /**
-     * test the removeAll method
-     */
-
-    public void testRemoveAll()
-    {
+    public void testRemoveAll() {
         ShortList list = new ShortList();
 
         for (short j = 0; j < 1000; j++)
@@ -536,12 +450,7 @@
         assertTrue(listCopy.isEmpty());
     }
 
-    /**
-     * test the retainAll method
-     */
-
-    public void testRetainAll()
-    {
+    public void testRetainAll() {
         ShortList list = new ShortList();
 
         for (short j = 0; j < 1000; j++)
@@ -573,12 +482,7 @@
         assertTrue(listCopy.isEmpty());
     }
 
-    /**
-     * test the set method
-     */
-
-    public void testSet()
-    {
+    public void testSet() {
         ShortList list = new ShortList();
 
         for (short j = 0; j < 1000; j++)
@@ -606,12 +510,7 @@
         }
     }
 
-    /**
-     * test the size method
-     */
-
-    public void testSize()
-    {
+    public void testSize() {
         ShortList list = new ShortList();
 
         for (short j = 0; j < 1000; j++)
@@ -628,12 +527,7 @@
         }
     }
 
-    /**
-     * test the toArray method
-     */
-
-    public void testToArray()
-    {
+    public void testToArray() {
         ShortList list = new ShortList();
 
         for (short j = 0; j < 1000; j++)
@@ -673,16 +567,4 @@
             assertEquals(a5[ j ], list.get(j));
         }
     }
-
-    /**
-     * main method to run the unit tests
-     *
-     * @param unused_args
-     */
-
-    public static void main(String [] unused_args)
-    {
-        System.out.println("Testing util.ShortList functionality");
-        junit.textui.TestRunner.run(TestShortList.class);
-    }
 }

Modified: poi/trunk/src/testcases/org/apache/poi/util/TestStringUtil.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/util/TestStringUtil.java?rev=784284&r1=784283&r2=784284&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/util/TestStringUtil.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/util/TestStringUtil.java Fri Jun 12 21:53:17 2009
@@ -1,4 +1,3 @@
-
 /* ====================================================================
    Licensed to the Apache Software Foundation (ASF) under one or more
    contributor license agreements.  See the NOTICE file distributed with
@@ -15,13 +14,14 @@
    See the License for the specific language governing permissions and
    limitations under the License.
 ==================================================================== */
-        
-package org.apache.poi.util;
 
-import junit.framework.*;
+package org.apache.poi.util;
 
+import java.io.UnsupportedEncodingException;
 import java.text.NumberFormat;
 
+import junit.framework.TestCase;
+
 /**
  * Unit test for StringUtil
  *
@@ -29,26 +29,12 @@
  * @author  Glen Stampoultzis (glens at apache.org)
  * @author  Sergei Kozello (sergeikozello at mail.ru)
  */
-public class TestStringUtil
-        extends TestCase
-{
-    /**
-     * Creates new TestStringUtil
-     *
-     * @param name
-     */
-    public TestStringUtil( String name )
-    {
-        super( name );
-    }
-
-
+public final class TestStringUtil extends TestCase {
 
     /**
      * test getFromUnicodeHigh for symbols with code below and more 127
      */
-    public void testGetFromUnicodeHighSymbolsWithCodesMoreThan127()
-    {
+    public void testGetFromUnicodeHighSymbolsWithCodesMoreThan127() {
         byte[] test_data = new byte[]{0x22, 0x04,
                                       0x35, 0x04,
                                       0x41, 0x04,
@@ -65,13 +51,7 @@
                 StringUtil.getFromUnicodeLE( test_data ) );
     }
 
-
-
-    /**
-     * Test putCompressedUnicode
-     */
-    public void testPutCompressedUnicode() throws Exception
-    {
+    public void testPutCompressedUnicode() {
         byte[] output = new byte[100];
         byte[] expected_output =
                 {
@@ -79,7 +59,12 @@
                     (byte) 'o', (byte) ' ', (byte) 'W', (byte) 'o',
                     (byte) 'r', (byte) 'l', (byte) 'd', (byte) 0xAE
                 };
-        String input = new String( expected_output, StringUtil.getPreferredEncoding() );
+        String input;
+		try {
+			input = new String( expected_output, StringUtil.getPreferredEncoding() );
+		} catch (UnsupportedEncodingException e) {
+			throw new RuntimeException(e);
+		}
 
         StringUtil.putCompressedUnicode( input, output, 0 );
         for ( int j = 0; j < expected_output.length; j++ )
@@ -106,11 +91,7 @@
         }
     }
 
-    /**
-     * Test putUncompressedUnicode
-     */
-    public void testPutUncompressedUnicode()
-    {
+    public void testPutUncompressedUnicode() {
         byte[] output = new byte[100];
         String input = "Hello World";
         byte[] expected_output =
@@ -147,10 +128,7 @@
         }
     }
 
-
-    public void testFormat()
-            throws Exception
-    {
+    public void testFormat() {
         assertEquals( "This is a test " + fmt( 1.2345, 2, 2 ),
                 StringUtil.format( "This is a test %2.2", new Object[]
                 {
@@ -192,8 +170,7 @@
     }
 
 
-    private String fmt( double num, int minIntDigits, int maxFracDigitis )
-    {
+    private static String fmt(double num, int minIntDigits, int maxFracDigitis) {
         NumberFormat nf = NumberFormat.getInstance();
 
         if ( minIntDigits != -1 )
@@ -207,28 +184,5 @@
 
         return nf.format( num );
     }
-
-
-    /**
-     * main
-     *
-     * @param ignored_args
-     */
-    public static void main( String[] ignored_args )
-    {
-        System.out.println( "Testing util.StringUtil functionality" );
-        junit.textui.TestRunner.run( TestStringUtil.class );
-    }
-
-    /**
-     * @see junit.framework.TestCase#setUp()
-     */
-    protected void setUp() throws Exception
-    {
-        super.setUp();
-
-        // System.setProperty()
-    }
-
 }
 



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org