poi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j...@apache.org
Subject svn commit: r784284 [2/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...
Date Fri, 12 Jun 2009 21:53:20 GMT
Modified: poi/trunk/src/testcases/org/apache/poi/poifs/filesystem/TestPOIFSDocumentPath.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/poifs/filesystem/TestPOIFSDocumentPath.java?rev=784284&r1=784283&r2=784284&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/poifs/filesystem/TestPOIFSDocumentPath.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/poifs/filesystem/TestPOIFSDocumentPath.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,23 @@
    See the License for the specific language governing permissions and
    limitations under the License.
 ==================================================================== */
-        
 
 package org.apache.poi.poifs.filesystem;
 
-import junit.framework.*;
+import junit.framework.TestCase;
 
 /**
  * Class to test POIFSDocumentPath functionality
  *
  * @author Marc Johnson
  */
+public final class TestPOIFSDocumentPath extends TestCase {
 
-public class TestPOIFSDocumentPath
-    extends TestCase
-{
-
-    /**
-     * Constructor TestPOIFSDocumentPath
-     *
-     * @param name
-     */
-
-    public TestPOIFSDocumentPath(String name)
-    {
-        super(name);
-    }
 
     /**
      * Test default constructor
      */
-
-    public void testDefaultConstructor()
-    {
+    public void testDefaultConstructor() {
         POIFSDocumentPath path = new POIFSDocumentPath();
 
         assertEquals(0, path.length());
@@ -56,9 +39,7 @@
     /**
      * Test full path constructor
      */
-
-    public void testFullPathConstructor()
-    {
+    public void testFullPathConstructor() {
         String[] components =
         {
             "foo", "bar", "foobar", "fubar"
@@ -125,9 +106,7 @@
     /**
      * Test relative path constructor
      */
-
-    public void testRelativePathConstructor()
-    {
+    public void testRelativePathConstructor() {
         String[] initialComponents =
         {
             "a", "b", "c"
@@ -216,9 +195,7 @@
     /**
      * test equality
      */
-
-    public void testEquality()
-    {
+    public void testEquality() {
         POIFSDocumentPath   a1    = new POIFSDocumentPath();
         POIFSDocumentPath   a2    = new POIFSDocumentPath(null);
         POIFSDocumentPath   a3    = new POIFSDocumentPath(new String[ 0 ]);
@@ -318,17 +295,4 @@
             }
         }
     }
-
-    /**
-     * main method to run the unit tests
-     *
-     * @param ignored_args
-     */
-
-    public static void main(String [] ignored_args)
-    {
-        System.out.println(
-            "Testing org.apache.poi.poifs.eventfilesystem.POIFSDocumentPath");
-        junit.textui.TestRunner.run(TestPOIFSDocumentPath.class);
-    }
 }

Modified: poi/trunk/src/testcases/org/apache/poi/poifs/property/TestDirectoryProperty.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/poifs/property/TestDirectoryProperty.java?rev=784284&r1=784283&r2=784284&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/poifs/property/TestDirectoryProperty.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/poifs/property/TestDirectoryProperty.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,63 +14,39 @@
    See the License for the specific language governing permissions and
    limitations under the License.
 ==================================================================== */
-        
 
 package org.apache.poi.poifs.property;
 
-import java.io.*;
-
-import java.util.*;
-
-import junit.framework.*;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Iterator;
+import java.util.List;
 
-import org.apache.poi.poifs.common.POIFSConstants;
+import junit.framework.TestCase;
 
 /**
  * Class to test DirectoryProperty functionality
  *
  * @author Marc Johnson
  */
-
-public class TestDirectoryProperty
-    extends TestCase
-{
+public final class TestDirectoryProperty extends TestCase {
     private DirectoryProperty _property;
     private byte[]            _testblock;
 
     /**
-     * Constructor TestDirectoryProperty
-     *
-     * @param name
-     */
-
-    public TestDirectoryProperty(String name)
-    {
-        super(name);
-    }
-
-    /**
      * Test constructing DirectoryProperty
-     *
-     * @exception IOException
      */
-
-    public void testConstructor()
-        throws IOException
-    {
+    public void testConstructor() throws IOException {
         createBasicDirectoryProperty();
         verifyProperty();
     }
 
     /**
      * Test pre-write functionality
-     *
-     * @exception IOException
      */
-
-    public void testPreWrite()
-        throws IOException
-    {
+    public void testPreWrite() throws IOException {
         createBasicDirectoryProperty();
         _property.preWrite();
 
@@ -119,9 +94,7 @@
         }
     }
 
-    private void verifyChildren(int count)
-        throws IOException
-    {
+    private void verifyChildren(int count) {
         Iterator iter     = _property.getChildren();
         List     children = new ArrayList();
 
@@ -175,8 +148,7 @@
         }
     }
 
-    private void createBasicDirectoryProperty()
-    {
+    private void createBasicDirectoryProperty() {
         String name = "MyDirectory";
 
         _property  = new DirectoryProperty(name);
@@ -209,9 +181,7 @@
         }
     }
 
-    private void verifyProperty()
-        throws IOException
-    {
+    private void verifyProperty() throws IOException {
         ByteArrayOutputStream stream = new ByteArrayOutputStream(512);
 
         _property.writeData(stream);
@@ -225,15 +195,7 @@
         }
     }
 
-    /**
-     * Test addChild
-     *
-     * @exception IOException
-     */
-
-    public void testAddChild()
-        throws IOException
-    {
+    public void testAddChild() throws IOException {
         createBasicDirectoryProperty();
         _property.addChild(new LocalProperty(1));
         _property.addChild(new LocalProperty(2));
@@ -260,15 +222,7 @@
         _property.addChild(new LocalProperty(3));
     }
 
-    /**
-     * Test deleteChild
-     *
-     * @exception IOException
-     */
-
-    public void testDeleteChild()
-        throws IOException
-    {
+    public void testDeleteChild() throws IOException {
         createBasicDirectoryProperty();
         Property p1 = new LocalProperty(1);
 
@@ -288,15 +242,7 @@
         _property.addChild(new LocalProperty(1));
     }
 
-    /**
-     * Test changeName
-     *
-     * @exception IOException
-     */
-
-    public void testChangeName()
-        throws IOException
-    {
+    public void testChangeName() throws IOException {
         createBasicDirectoryProperty();
         Property p1           = new LocalProperty(1);
         String   originalName = p1.getName();
@@ -314,15 +260,7 @@
         assertTrue(_property.changeName(p1, originalName));
     }
 
-    /**
-     * Test reading constructor
-     *
-     * @exception IOException
-     */
-
-    public void testReadingConstructor()
-        throws IOException
-    {
+    public void testReadingConstructor() throws IOException {
         byte[] input =
         {
             ( byte ) 0x42, ( byte ) 0x00, ( byte ) 0x6F, ( byte ) 0x00,
@@ -362,7 +300,7 @@
         verifyReadingProperty(0, input, 0, "Boot Entry");
     }
 
-    private void verifyReadingProperty(int index, byte [] input, int offset,
+    private static void verifyReadingProperty(int index, byte [] input, int offset,
                                        String name)
         throws IOException
     {
@@ -385,17 +323,4 @@
         assertEquals(name, property.getName());
         assertTrue(!property.getChildren().hasNext());
     }
-
-    /**
-     * main method to run the unit tests
-     *
-     * @param ignored_args
-     */
-
-    public static void main(String [] ignored_args)
-    {
-        System.out.println(
-            "Testing org.apache.poi.poifs.property.DirectoryProperty");
-        junit.textui.TestRunner.run(TestDirectoryProperty.class);
-    }
 }

Modified: poi/trunk/src/testcases/org/apache/poi/poifs/property/TestDocumentProperty.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/poifs/property/TestDocumentProperty.java?rev=784284&r1=784283&r2=784284&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/poifs/property/TestDocumentProperty.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/poifs/property/TestDocumentProperty.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,49 +14,22 @@
    See the License for the specific language governing permissions and
    limitations under the License.
 ==================================================================== */
-        
 
 package org.apache.poi.poifs.property;
 
-import java.io.*;
-
-import java.util.*;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
 
-import junit.framework.*;
-
-import org.apache.poi.poifs.property.DocumentProperty;
+import junit.framework.TestCase;
 
 /**
  * Class to test DocumentProperty functionality
  *
  * @author Marc Johnson
  */
+public final class TestDocumentProperty extends TestCase {
 
-public class TestDocumentProperty
-    extends TestCase
-{
-
-    /**
-     * Constructor TestDocumentProperty
-     *
-     * @param name
-     */
-
-    public TestDocumentProperty(String name)
-    {
-        super(name);
-    }
-
-    /**
-     * Test constructing DocumentPropertys
-     *
-     * @exception IOException
-     */
-
-    public void testConstructor()
-        throws IOException
-    {
-
+    public void testConstructor() throws IOException {
         // test with short name, small file
         verifyProperty("foo", 1234);
 
@@ -71,15 +43,7 @@
         verifyProperty("A.really.long.long.long.name123", 4096);
     }
 
-    /**
-     * Test reading constructor
-     *
-     * @exception IOException
-     */
-
-    public void testReadingConstructor()
-        throws IOException
-    {
+    public void testReadingConstructor() throws IOException {
         byte[] input =
         {
             ( byte ) 0x52, ( byte ) 0x00, ( byte ) 0x6F, ( byte ) 0x00,
@@ -217,14 +181,11 @@
 
         verifyReadingProperty(1, input, 128, "Workbook");
         verifyReadingProperty(2, input, 256, "\005SummaryInformation");
-        verifyReadingProperty(3, input, 384,
-                              "\005DocumentSummaryInformation");
+        verifyReadingProperty(3, input, 384, "\005DocumentSummaryInformation");
     }
 
-    private void verifyReadingProperty(int index, byte [] input, int offset,
-                                       String name)
-        throws IOException
-    {
+    private void verifyReadingProperty(int index, byte[] input, int offset, String name)
+			throws IOException {
         DocumentProperty      property = new DocumentProperty(index, input,
                                              offset);
         ByteArrayOutputStream stream   = new ByteArrayOutputStream(128);
@@ -244,9 +205,7 @@
         assertEquals(name, property.getName());
     }
 
-    private void verifyProperty(String name, int size)
-        throws IOException
-    {
+    private void verifyProperty(String name, int size) throws IOException {
         DocumentProperty property = new DocumentProperty(name, size);
 
         if (size >= 4096)
@@ -309,17 +268,4 @@
                          output[ j ]);
         }
     }
-
-    /**
-     * main method to run the unit tests
-     *
-     * @param ignored_args
-     */
-
-    public static void main(String [] ignored_args)
-    {
-        System.out.println(
-            "Testing org.apache.poi.poifs.property.DocumentProperty");
-        junit.textui.TestRunner.run(TestDocumentProperty.class);
-    }
 }

Modified: poi/trunk/src/testcases/org/apache/poi/poifs/property/TestPropertyFactory.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/poifs/property/TestPropertyFactory.java?rev=784284&r1=784283&r2=784284&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/poifs/property/TestPropertyFactory.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/poifs/property/TestPropertyFactory.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,15 +14,14 @@
    See the License for the specific language governing permissions and
    limitations under the License.
 ==================================================================== */
-        
 
 package org.apache.poi.poifs.property;
 
-import java.io.*;
-
-import java.util.*;
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.util.List;
 
-import junit.framework.*;
+import junit.framework.TestCase;
 
 import org.apache.poi.poifs.storage.RawDataBlock;
 
@@ -32,31 +30,9 @@
  *
  * @author Marc Johnson
  */
+public final class TestPropertyFactory extends TestCase {
 
-public class TestPropertyFactory
-    extends TestCase
-{
-
-    /**
-     * Constructor TestPropertyFactory
-     *
-     * @param name
-     */
-
-    public TestPropertyFactory(String name)
-    {
-        super(name);
-    }
-
-    /**
-     * Test executing convertToProperties
-     *
-     * @exception IOException
-     */
-
-    public void testConvertToProperties()
-        throws IOException
-    {
+    public void testConvertToProperties() throws IOException {
 
         // real data from a real file!
         byte[]               testdata =
@@ -2223,17 +2199,4 @@
             }
         }
     }
-
-    /**
-     * main method to run the unit tests
-     *
-     * @param ignored_args
-     */
-
-    public static void main(String [] ignored_args)
-    {
-        System.out
-            .println("Testing org.apache.poi.poifs.property.PropertyFactory");
-        junit.textui.TestRunner.run(TestPropertyFactory.class);
-    }
 }

Modified: poi/trunk/src/testcases/org/apache/poi/poifs/property/TestPropertyTable.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/poifs/property/TestPropertyTable.java?rev=784284&r1=784283&r2=784284&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/poifs/property/TestPropertyTable.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/poifs/property/TestPropertyTable.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,15 +14,16 @@
    See the License for the specific language governing permissions and
    limitations under the License.
 ==================================================================== */
-        
 
 package org.apache.poi.poifs.property;
 
-import java.io.*;
-
-import java.util.*;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.util.Iterator;
 
-import junit.framework.*;
+import junit.framework.AssertionFailedError;
+import junit.framework.TestCase;
 
 import org.apache.poi.poifs.common.POIFSConstants;
 import org.apache.poi.poifs.storage.BlockAllocationTableReader;
@@ -34,21 +34,7 @@
  *
  * @author Marc Johnson
  */
-
-public class TestPropertyTable
-    extends TestCase
-{
-
-    /**
-     * Constructor TestPropertyTable
-     *
-     * @param name
-     */
-
-    public TestPropertyTable(String name)
-    {
-        super(name);
-    }
+public final class TestPropertyTable extends TestCase {
 
     /**
      * Test PropertyTable
@@ -65,13 +51,8 @@
      * the output (including the preWrite phase first), and comparing
      * it against a real property table extracted from a file known to
      * be acceptable to Excel.
-     *
-     * @exception IOException
      */
-
-    public void testWriterPropertyTable()
-        throws IOException
-    {
+    public void testWriterPropertyTable() throws IOException {
 
         // create the PropertyTable
         PropertyTable    table    = new PropertyTable();
@@ -105,6 +86,7 @@
         ByteArrayOutputStream stream    = new ByteArrayOutputStream(512);
         byte[]                testblock =
         {
+        		// TODO - put this raw data in a better format
             ( byte ) 0x52, ( byte ) 0x00, ( byte ) 0x6f, ( byte ) 0x00,
             ( byte ) 0x6f, ( byte ) 0x00, ( byte ) 0x74, ( byte ) 0x00,
             ( byte ) 0x20, ( byte ) 0x00, ( byte ) 0x45, ( byte ) 0x00,
@@ -2622,6 +2604,9 @@
             child = ( Property ) iter.next();
             ++count;
         }
+        if (child == null) {
+        	throw new AssertionFailedError("no children found");
+        }
         assertEquals(1, count);
         assertTrue(child.isDirectory());
         iter  = (( DirectoryProperty ) child).getChildren();
@@ -2633,17 +2618,4 @@
         }
         assertEquals(35, count);
     }
-
-    /**
-     * main method to run the unit tests
-     *
-     * @param ignored_args
-     */
-
-    public static void main(String [] ignored_args)
-    {
-        System.out
-            .println("Testing org.apache.poi.poifs.property.PropertyTable");
-        junit.textui.TestRunner.run(TestPropertyTable.class);
-    }
 }

Modified: poi/trunk/src/testcases/org/apache/poi/poifs/property/TestRootProperty.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/poifs/property/TestRootProperty.java?rev=784284&r1=784283&r2=784284&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/poifs/property/TestRootProperty.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/poifs/property/TestRootProperty.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,15 +14,13 @@
    See the License for the specific language governing permissions and
    limitations under the License.
 ==================================================================== */
-        
 
 package org.apache.poi.poifs.property;
 
-import java.io.*;
-
-import java.util.*;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
 
-import junit.framework.*;
+import junit.framework.TestCase;
 
 import org.apache.poi.poifs.common.POIFSConstants;
 
@@ -32,33 +29,12 @@
  *
  * @author Marc Johnson
  */
-
-public class TestRootProperty
-    extends TestCase
-{
+public final class TestRootProperty extends TestCase {
     private RootProperty _property;
     private byte[]       _testblock;
 
-    /**
-     * Constructor TestRootProperty
-     *
-     * @param name
-     */
 
-    public TestRootProperty(String name)
-    {
-        super(name);
-    }
-
-    /**
-     * Test constructing RootProperty
-     *
-     * @exception IOException
-     */
-
-    public void testConstructor()
-        throws IOException
-    {
+    public void testConstructor() throws IOException {
         createBasicRootProperty();
         verifyProperty();
     }
@@ -105,9 +81,7 @@
         }
     }
 
-    private void verifyProperty()
-        throws IOException
-    {
+    private void verifyProperty() throws IOException {
         ByteArrayOutputStream stream = new ByteArrayOutputStream(512);
 
         _property.writeData(stream);
@@ -121,12 +95,7 @@
         }
     }
 
-    /**
-     * test setSize
-     */
-
-    public void testSetSize()
-    {
+    public void testSetSize() {
         for (int j = 0; j < 10; j++)
         {
             createBasicRootProperty();
@@ -136,15 +105,7 @@
         }
     }
 
-    /**
-     * Test reading constructor
-     *
-     * @exception IOException
-     */
-
-    public void testReadingConstructor()
-        throws IOException
-    {
+    public void testReadingConstructor() throws IOException {
         byte[] input =
         {
             ( byte ) 0x52, ( byte ) 0x00, ( byte ) 0x6F, ( byte ) 0x00,
@@ -184,10 +145,8 @@
         verifyReadingProperty(0, input, 0, "Root Entry", "{00020820-0000-0000-C000-000000000046}");
     }
 
-    private void verifyReadingProperty(int index, byte [] input, int offset,
-                                       String name, String sClsId)
-        throws IOException
-    {
+    private void verifyReadingProperty(int index, byte[] input, int offset, String name,
+			String sClsId) throws IOException {
         RootProperty          property = new RootProperty(index, input,
                                              offset);
         ByteArrayOutputStream stream   = new ByteArrayOutputStream(128);
@@ -208,17 +167,4 @@
         assertTrue(!property.getChildren().hasNext());
         assertEquals(property.getStorageClsid().toString(), sClsId);
     }
-
-    /**
-     * main method to run the unit tests
-     *
-     * @param ignored_args
-     */
-
-    public static void main(String [] ignored_args)
-    {
-        System.out
-            .println("Testing org.apache.poi.poifs.property.RootProperty");
-        junit.textui.TestRunner.run(TestRootProperty.class);
-    }
 }

Modified: poi/trunk/src/testcases/org/apache/poi/poifs/storage/TestBATBlock.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/poifs/storage/TestBATBlock.java?rev=784284&r1=784283&r2=784284&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/poifs/storage/TestBATBlock.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/poifs/storage/TestBATBlock.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,49 +14,29 @@
    See the License for the specific language governing permissions and
    limitations under the License.
 ==================================================================== */
-        
 
 package org.apache.poi.poifs.storage;
 
-import java.io.*;
-
-import java.util.*;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.util.Arrays;
 
-import junit.framework.*;
+import junit.framework.TestCase;
 
 /**
  * Class to test BATBlock functionality
  *
  * @author Marc Johnson
  */
-
-public class TestBATBlock
-    extends TestCase
-{
-
-    /**
-     * Constructor TestBATBlock
-     *
-     * @param name
-     */
-
-    public TestBATBlock(String name)
-    {
-        super(name);
-    }
+public final class TestBATBlock extends TestCase {
 
     /**
      * Test the createBATBlocks method. The test involves setting up
      * various arrays of int's and ensuring that the correct number of
      * BATBlocks is created for each array, and that the data from
      * each array is correctly written to the BATBlocks.
-     *
-     * @exception IOException
      */
-
-    public void testCreateBATBlocks()
-        throws IOException
-    {
+    public void testCreateBATBlocks() throws IOException {
 
         // test 0 length array (basic sanity)
         BATBlock[] rvalue = BATBlock.createBATBlocks(createTestArray(0));
@@ -85,8 +64,7 @@
         verifyContents(rvalue, 129);
     }
 
-    private int [] createTestArray(int count)
-    {
+    private static int[] createTestArray(int count) {
         int[] rvalue = new int[ count ];
 
         for (int j = 0; j < count; j++)
@@ -96,9 +74,7 @@
         return rvalue;
     }
 
-    private void verifyContents(BATBlock [] blocks, int entries)
-        throws IOException
-    {
+    private static void verifyContents(BATBlock[] blocks, int entries) throws IOException {
         byte[] expected = new byte[ 512 * blocks.length ];
 
         Arrays.fill(expected, ( byte ) 0xFF);
@@ -127,16 +103,7 @@
         }
     }
 
-    /**
-     * test createXBATBlocks
-     *
-     * @exception IOException
-     */
-
-    public void testCreateXBATBlocks()
-        throws IOException
-    {
-
+    public void testCreateXBATBlocks() throws IOException {
         // test 0 length array (basic sanity)
         BATBlock[] rvalue = BATBlock.createXBATBlocks(createTestArray(0), 1);
 
@@ -168,10 +135,8 @@
         verifyXBATContents(rvalue, 255, 1);
     }
 
-    private void verifyXBATContents(BATBlock [] blocks, int entries,
-                                    int start_block)
-        throws IOException
-    {
+    private static void verifyXBATContents(BATBlock[] blocks, int entries, int start_block)
+			throws IOException {
         byte[] expected = new byte[ 512 * blocks.length ];
 
         Arrays.fill(expected, ( byte ) 0xFF);
@@ -220,20 +185,9 @@
         }
     }
 
-    /**
-     * test calculateXBATStorageRequirements
-     */
-
-    public void testCalculateXBATStorageRequirements()
-    {
-        int[] blockCounts  =
-        {
-            0, 1, 127, 128
-        };
-        int[] requirements =
-        {
-            0, 1, 1, 2
-        };
+    public void testCalculateXBATStorageRequirements() {
+        int[] blockCounts = { 0, 1, 127, 128 };
+        int[] requirements = { 0, 1, 1, 2 };
 
         for (int j = 0; j < blockCounts.length; j++)
         {
@@ -243,42 +197,13 @@
         }
     }
 
-    /**
-     * test entriesPerBlock
-     */
-
-    public void testEntriesPerBlock()
-    {
+    public void testEntriesPerBlock() {
         assertEquals(128, BATBlock.entriesPerBlock());
     }
-
-    /**
-     * test entriesPerXBATBlock
-     */
-
-    public void testEntriesPerXBATBlock()
-    {
+    public void testEntriesPerXBATBlock() {
         assertEquals(127, BATBlock.entriesPerXBATBlock());
     }
-
-    /**
-     * test getXBATChainOffset
-     */
-
-    public void testGetXBATChainOffset()
-    {
+    public void testGetXBATChainOffset() {
         assertEquals(508, BATBlock.getXBATChainOffset());
     }
-
-    /**
-     * main method to run the unit tests
-     *
-     * @param ignored_args
-     */
-
-    public static void main(String [] ignored_args)
-    {
-        System.out.println("Testing org.apache.poi.poifs.storage.BATBlock");
-        junit.textui.TestRunner.run(TestBATBlock.class);
-    }
 }

Modified: poi/trunk/src/testcases/org/apache/poi/poifs/storage/TestBlockAllocationTableReader.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/poifs/storage/TestBlockAllocationTableReader.java?rev=784284&r1=784283&r2=784284&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/poifs/storage/TestBlockAllocationTableReader.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/poifs/storage/TestBlockAllocationTableReader.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,15 +14,13 @@
    See the License for the specific language governing permissions and
    limitations under the License.
 ==================================================================== */
-        
 
 package org.apache.poi.poifs.storage;
 
-import java.io.*;
-
-import java.util.*;
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
 
-import junit.framework.*;
+import junit.framework.TestCase;
 
 import org.apache.poi.poifs.common.POIFSConstants;
 import org.apache.poi.util.LittleEndian;
@@ -34,36 +31,18 @@
  *
  * @author Marc Johnson
  */
-
-public class TestBlockAllocationTableReader
-    extends TestCase
-{
-
-    /**
-     * Constructor TestBlockAllocationTableReader
-     *
-     * @param name
-     */
-
-    public TestBlockAllocationTableReader(String name)
-    {
-        super(name);
-    }
+public final class TestBlockAllocationTableReader extends TestCase {
 
     /**
      * Test small block allocation table constructor
-     *
-     * @exception IOException
      */
-
-    public void testSmallBATConstructor()
-        throws IOException
-    {
+    public void testSmallBATConstructor() throws IOException {
 
         // need to create an array of raw blocks containing the SBAT,
         // and a small document block list
         byte[]               sbat_data =
         {
+        		// TODO - put this raw data in a better format
             ( byte ) 0xFF, ( byte ) 0xFF, ( byte ) 0xFF, ( byte ) 0xFF,
             ( byte ) 0xFF, ( byte ) 0xFF, ( byte ) 0xFF, ( byte ) 0xFF,
             ( byte ) 0xFF, ( byte ) 0xFF, ( byte ) 0xFF, ( byte ) 0xFF,
@@ -1160,28 +1139,20 @@
         }
     }
 
-    /**
-     * Test reading constructor
-     *
-     * @exception IOException
-     */
-
-    public void testReadingConstructor()
-        throws IOException
-    {
+    public void testReadingConstructor() throws IOException {
 
         // create a document, minus the header block, and use that to
         // create a RawDataBlockList. The document will exist entire
         // of BATBlocks and XBATBlocks
-        // 
+        //
         // we will create two XBAT blocks, which will encompass 128
         // BAT blocks between them, and two extra BAT blocks which
         // will be in the block array passed to the constructor. This
         // makes a total of 130 BAT blocks, which will encompass
         // 16,640 blocks, for a file size of some 8.5 megabytes.
-        // 
+        //
         // Naturally, we'll fake that out ...
-        // 
+        //
         // map of blocks:
         // block 0: xbat block 0
         // block 1: xbat block 1
@@ -1229,18 +1200,10 @@
         }
     }
 
-    /**
-     * Test fetchBlocks
-     *
-     * @exception IOException
-     */
-
-    public void testFetchBlocks()
-        throws IOException
-    {
+    public void testFetchBlocks() throws IOException {
 
         // strategy:
-        // 
+        //
         // 1. set up a single BAT block from which to construct a
         // BAT. create nonsense blocks in the raw data block list
         // corresponding to the indices in the BAT block.
@@ -1350,17 +1313,4 @@
             }
         }
     }
-
-    /**
-     * main method to run the unit tests
-     *
-     * @param ignored_args
-     */
-
-    public static void main(String [] ignored_args)
-    {
-        System.out.println(
-            "Testing org.apache.poi.poifs.storage.BlockAllocationTableReader");
-        junit.textui.TestRunner.run(TestBlockAllocationTableReader.class);
-    }
 }

Modified: poi/trunk/src/testcases/org/apache/poi/poifs/storage/TestBlockAllocationTableWriter.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/poifs/storage/TestBlockAllocationTableWriter.java?rev=784284&r1=784283&r2=784284&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/poifs/storage/TestBlockAllocationTableWriter.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/poifs/storage/TestBlockAllocationTableWriter.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,15 +14,14 @@
    See the License for the specific language governing permissions and
    limitations under the License.
 ==================================================================== */
-        
 
 package org.apache.poi.poifs.storage;
 
-import java.io.*;
-
-import java.util.*;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.util.Arrays;
 
-import junit.framework.*;
+import junit.framework.TestCase;
 
 import org.apache.poi.poifs.common.POIFSConstants;
 import org.apache.poi.util.LittleEndian;
@@ -34,28 +32,9 @@
  *
  * @author Marc Johnson
  */
+public final class TestBlockAllocationTableWriter extends TestCase {
 
-public class TestBlockAllocationTableWriter
-    extends TestCase
-{
-
-    /**
-     * Constructor TestBlockAllocationTableWriter
-     *
-     * @param name
-     */
-
-    public TestBlockAllocationTableWriter(String name)
-    {
-        super(name);
-    }
-
-    /**
-     * Test the allocateSpace method.
-     */
-
-    public void testAllocateSpace()
-    {
+    public void testAllocateSpace() {
         BlockAllocationTableWriter table         =
             new BlockAllocationTableWriter();
         int[]                      blockSizes    =
@@ -71,15 +50,7 @@
         }
     }
 
-    /**
-     * Test the createBlocks method
-     *
-     * @exception IOException
-     */
-
-    public void testCreateBlocks()
-        throws IOException
-    {
+    public void testCreateBlocks() {
         BlockAllocationTableWriter table = new BlockAllocationTableWriter();
 
         table.allocateSpace(127);
@@ -117,13 +88,8 @@
 
     /**
      * Test content produced by BlockAllocationTableWriter
-     *
-     * @exception IOException
      */
-
-    public void testProduct()
-        throws IOException
-    {
+    public void testProduct() throws IOException {
         BlockAllocationTableWriter table = new BlockAllocationTableWriter();
 
         for (int k = 1; k <= 22; k++)
@@ -168,28 +134,16 @@
         }
     }
 
-    private void verifyBlocksCreated(BlockAllocationTableWriter table,
-                                     int count)
-        throws IOException
-    {
+    private static void verifyBlocksCreated(BlockAllocationTableWriter table, int count){
         ByteArrayOutputStream stream = new ByteArrayOutputStream();
 
-        table.writeBlocks(stream);
+        try {
+			table.writeBlocks(stream);
+		} catch (IOException e) {
+			throw new RuntimeException(e);
+		}
         byte[] output = stream.toByteArray();
 
         assertEquals(count * 512, output.length);
     }
-
-    /**
-     * main method to run the unit tests
-     *
-     * @param ignored_args
-     */
-
-    public static void main(String [] ignored_args)
-    {
-        System.out.println(
-            "Testing org.apache.poi.poifs.storage.BlockAllocationTableWriter");
-        junit.textui.TestRunner.run(TestBlockAllocationTableWriter.class);
-    }
 }

Modified: poi/trunk/src/testcases/org/apache/poi/poifs/storage/TestBlockListImpl.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/poifs/storage/TestBlockListImpl.java?rev=784284&r1=784283&r2=784284&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/poifs/storage/TestBlockListImpl.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/poifs/storage/TestBlockListImpl.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,15 +14,16 @@
    See the License for the specific language governing permissions and
    limitations under the License.
 ==================================================================== */
-        
 
 package org.apache.poi.poifs.storage;
 
-import java.io.*;
-
-import java.util.*;
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
 
-import junit.framework.*;
+import junit.framework.TestCase;
 
 import org.apache.poi.util.LittleEndian;
 import org.apache.poi.util.LittleEndianConsts;
@@ -33,31 +33,9 @@
  *
  * @author Marc Johnson
  */
+public final class TestBlockListImpl extends TestCase {
 
-public class TestBlockListImpl
-    extends TestCase
-{
-
-    /**
-     * Constructor TestBlockListImpl
-     *
-     * @param name
-     */
-
-    public TestBlockListImpl(String name)
-    {
-        super(name);
-    }
-
-    /**
-     * test zap method
-     *
-     * @exception IOException
-     */
-
-    public void testZap()
-        throws IOException
-    {
+    public void testZap() throws IOException {
         BlockListImpl list = new BlockListImpl();
 
         // verify that you can zap anything
@@ -92,15 +70,7 @@
         }
     }
 
-    /**
-     * test remove method
-     *
-     * @exception IOException
-     */
-
-    public void testRemove()
-        throws IOException
-    {
+    public void testRemove() throws IOException {
         BlockListImpl  list   = new BlockListImpl();
         RawDataBlock[] blocks = new RawDataBlock[ 5 ];
         byte[]         data   = new byte[ 512 * 5 ];
@@ -159,15 +129,7 @@
         }
     }
 
-    /**
-     * test setBAT
-     *
-     * @exception IOException
-     */
-
-    public void testSetBAT()
-        throws IOException
-    {
+    public void testSetBAT() throws IOException {
         BlockListImpl list = new BlockListImpl();
 
         list.setBAT(null);
@@ -182,18 +144,10 @@
         }
     }
 
-    /**
-     * Test fetchBlocks
-     *
-     * @exception IOException
-     */
-
-    public void testFetchBlocks()
-        throws IOException
-    {
+    public void testFetchBlocks() throws IOException {
 
         // strategy:
-        // 
+        //
         // 1. set up a single BAT block from which to construct a
         // BAT. create nonsense blocks in the raw data block list
         // corresponding to the indices in the BAT block.
@@ -310,17 +264,4 @@
             }
         }
     }
-
-    /**
-     * main method to run the unit tests
-     *
-     * @param ignored_args
-     */
-
-    public static void main(String [] ignored_args)
-    {
-        System.out
-            .println("Testing org.apache.poi.poifs.storage.BlockListImpl");
-        junit.textui.TestRunner.run(TestBlockListImpl.class);
-    }
 }

Modified: poi/trunk/src/testcases/org/apache/poi/poifs/storage/TestHeaderBlockReader.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/poifs/storage/TestHeaderBlockReader.java?rev=784284&r1=784283&r2=784284&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/poifs/storage/TestHeaderBlockReader.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/poifs/storage/TestHeaderBlockReader.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,49 +14,22 @@
    See the License for the specific language governing permissions and
    limitations under the License.
 ==================================================================== */
-        
 
 package org.apache.poi.poifs.storage;
 
-import java.io.*;
-
-import java.util.*;
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
 
-import junit.framework.*;
-
-import org.apache.poi.util.LittleEndian;
-import org.apache.poi.util.LittleEndianConsts;
+import junit.framework.TestCase;
 
 /**
  * Class to test HeaderBlockReader functionality
  *
  * @author Marc Johnson
  */
+public final class TestHeaderBlockReader extends TestCase {
 
-public class TestHeaderBlockReader
-    extends TestCase
-{
-
-    /**
-     * Constructor TestHeaderBlockReader
-     *
-     * @param name
-     */
-
-    public TestHeaderBlockReader(String name)
-    {
-        super(name);
-    }
-
-    /**
-     * Test creating a HeaderBlockReader
-     *
-     * @exception IOException
-     */
-
-    public void testConstructors()
-        throws IOException
-    {
+    public void testConstructors() throws IOException {
         byte[]            content =
         {
             ( byte ) 0xD0, ( byte ) 0xCF, ( byte ) 0x11, ( byte ) 0xE0,
@@ -231,17 +203,4 @@
             content[ index ] = ( byte ) (content[ index ] + 1);
         }
     }
-
-    /**
-     * main method to run the unit tests
-     *
-     * @param ignored_args
-     */
-
-    public static void main(String [] ignored_args)
-    {
-        System.out.println(
-            "Testing org.apache.poi.poifs.storage.HeaderBlockReader");
-        junit.textui.TestRunner.run(TestHeaderBlockReader.class);
-    }
 }

Modified: poi/trunk/src/testcases/org/apache/poi/poifs/storage/TestHeaderBlockWriter.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/poifs/storage/TestHeaderBlockWriter.java?rev=784284&r1=784283&r2=784284&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/poifs/storage/TestHeaderBlockWriter.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/poifs/storage/TestHeaderBlockWriter.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,15 +14,14 @@
    See the License for the specific language governing permissions and
    limitations under the License.
 ==================================================================== */
-        
 
 package org.apache.poi.poifs.storage;
 
-import java.io.*;
-
-import java.util.*;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
 
-import junit.framework.*;
+import junit.framework.TestCase;
 
 import org.apache.poi.util.LittleEndian;
 import org.apache.poi.util.LittleEndianConsts;
@@ -33,38 +31,19 @@
  *
  * @author Marc Johnson
  */
-
-public class TestHeaderBlockWriter
-    extends TestCase
-{
-
-    /**
-     * Constructor TestHeaderBlockWriter
-     *
-     * @param name
-     */
-
-    public TestHeaderBlockWriter(String name)
-    {
-        super(name);
-    }
+public final class TestHeaderBlockWriter extends TestCase {
 
     /**
      * Test creating a HeaderBlockWriter
-     *
-     * @exception IOException
      */
-
-    public void testConstructors()
-        throws IOException
-    {
+    public void testConstructors() throws IOException {
         HeaderBlockWriter     block  = new HeaderBlockWriter();
         ByteArrayOutputStream output = new ByteArrayOutputStream(512);
 
         block.writeBlocks(output);
         byte[] copy     = output.toByteArray();
         byte[] expected =
-        {
+        {   // TODO - put this raw data in a better format
             ( byte ) 0xD0, ( byte ) 0xCF, ( byte ) 0x11, ( byte ) 0xE0,
             ( byte ) 0xA1, ( byte ) 0xB1, ( byte ) 0x1A, ( byte ) 0xE1,
             ( byte ) 0x00, ( byte ) 0x00, ( byte ) 0x00, ( byte ) 0x00,
@@ -213,13 +192,8 @@
 
     /**
      * Test setting the SBAT start block
-     *
-     * @exception IOException
      */
-
-    public void testSetSBATStart()
-        throws IOException
-    {
+    public void testSetSBATStart() throws IOException {
         HeaderBlockWriter block = new HeaderBlockWriter();
 
         block.setSBATStart(0x01234567);
@@ -368,13 +342,8 @@
 
     /**
      * test setPropertyStart and getPropertyStart
-     *
-     * @exception IOException
      */
-
-    public void testSetPropertyStart()
-        throws IOException
-    {
+    public void testSetPropertyStart() throws IOException {
         HeaderBlockWriter block = new HeaderBlockWriter();
 
         block.setPropertyStart(0x01234567);
@@ -524,13 +493,8 @@
     /**
      * test setting the BAT blocks; also tests getBATCount,
      * getBATArray, getXBATCount
-     *
-     * @exception IOException
      */
-
-    public void testSetBATBlocks()
-        throws IOException
-    {
+    public void testSetBATBlocks() throws IOException {
 
         // first, a small set of blocks
         HeaderBlockWriter block = new HeaderBlockWriter();
@@ -1009,17 +973,4 @@
         assertEquals("XBAT End of chain", -2,
                      LittleEndian.getInt(copy, offset));
     }
-
-    /**
-     * main method to run the unit tests
-     *
-     * @param ignored_args
-     */
-
-    public static void main(String [] ignored_args)
-    {
-        System.out.println(
-            "Testing org.apache.poi.poifs.storage.HeaderBlockWriter");
-        junit.textui.TestRunner.run(TestHeaderBlockWriter.class);
-    }
 }

Modified: poi/trunk/src/testcases/org/apache/poi/poifs/storage/TestPropertyBlock.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/poifs/storage/TestPropertyBlock.java?rev=784284&r1=784283&r2=784284&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/poifs/storage/TestPropertyBlock.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/poifs/storage/TestPropertyBlock.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,48 +14,24 @@
    See the License for the specific language governing permissions and
    limitations under the License.
 ==================================================================== */
-        
 
 package org.apache.poi.poifs.storage;
 
-import java.io.*;
-
-import java.util.*;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
 
-import junit.framework.*;
-
-import org.apache.poi.poifs.property.Property;
+import junit.framework.TestCase;
 
 /**
  * Class to test PropertyBlock functionality
  *
  * @author Marc Johnson
  */
+public final class TestPropertyBlock extends TestCase {
 
-public class TestPropertyBlock
-    extends TestCase
-{
-
-    /**
-     * Constructor TestPropertyBlock
-     *
-     * @param name
-     */
-
-    public TestPropertyBlock(String name)
-    {
-        super(name);
-    }
-
-    /**
-     * Test constructing PropertyBlocks
-     *
-     * @exception IOException
-     */
-
-    public void testCreatePropertyBlocks()
-        throws IOException
-    {
+    public void testCreatePropertyBlocks() {
 
         // test with 0 properties
         List            properties = new ArrayList();
@@ -178,7 +153,7 @@
         verifyCorrect(blocks, testblock);
     }
 
-    private void setDefaultBlock(byte [] testblock, int j)
+    private static void setDefaultBlock(byte [] testblock, int j)
     {
         int base  = j * 128;
         int index = 0;
@@ -204,15 +179,16 @@
         }
     }
 
-    private void verifyCorrect(BlockWritable [] blocks, byte [] testblock)
-        throws IOException
-    {
+    private static void verifyCorrect(BlockWritable[] blocks, byte[] testblock) {
         ByteArrayOutputStream stream = new ByteArrayOutputStream(512
                                            * blocks.length);
 
-        for (int j = 0; j < blocks.length; j++)
-        {
-            blocks[ j ].writeBlocks(stream);
+        for (int j = 0; j < blocks.length; j++) {
+            try {
+				blocks[ j ].writeBlocks(stream);
+			} catch (IOException e) {
+				throw new RuntimeException(e);
+			}
         }
         byte[] output = stream.toByteArray();
 
@@ -223,17 +199,4 @@
                          output[ j ]);
         }
     }
-
-    /**
-     * main method to run the unit tests
-     *
-     * @param ignored_args
-     */
-
-    public static void main(String [] ignored_args)
-    {
-        System.out
-            .println("Testing org.apache.poi.poifs.storage.PropertyBlock");
-        junit.textui.TestRunner.run(TestPropertyBlock.class);
-    }
 }

Modified: poi/trunk/src/testcases/org/apache/poi/poifs/storage/TestRawDataBlock.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/poifs/storage/TestRawDataBlock.java?rev=784284&r1=784283&r2=784284&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/poifs/storage/TestRawDataBlock.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/poifs/storage/TestRawDataBlock.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,235 +14,212 @@
    See the License for the specific language governing permissions and
    limitations under the License.
 ==================================================================== */
-        
 
 package org.apache.poi.poifs.storage;
 
-import java.io.*;
-import java.util.Random;
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.InputStream;
 import java.lang.reflect.Field;
+import java.util.Random;
 
-import org.apache.poi.util.DummyPOILogger;
+import junit.framework.TestCase;
 
-import junit.framework.*;
+import org.apache.poi.util.DummyPOILogger;
 
 /**
  * Class to test RawDataBlock functionality
  *
  * @author Marc Johnson
  */
-
-public class TestRawDataBlock
-    extends TestCase
-{
+public final class TestRawDataBlock extends TestCase {
 	static {
-        // We always want to use our own
-        //  logger
-        System.setProperty(
-        		"org.apache.poi.util.POILogger",
-        		"org.apache.poi.util.DummyPOILogger"
-        );
+		// We always want to use our own
+		//  logger
+		System.setProperty(
+				"org.apache.poi.util.POILogger",
+				"org.apache.poi.util.DummyPOILogger"
+		);
 	}
 
-    /**
-     * Constructor TestRawDataBlock
-     *
-     * @param name
-     */
-    public TestRawDataBlock(String name)
-    {
-        super(name);
-    }
-
-    /**
-     * Test creating a normal RawDataBlock
-     *
-     * @exception IOException
-     */
-
-    public void testNormalConstructor()
-        throws IOException
-    {
-        byte[] data = new byte[ 512 ];
-
-        for (int j = 0; j < 512; j++)
-        {
-            data[ j ] = ( byte ) j;
-        }
-        RawDataBlock block = new RawDataBlock(new ByteArrayInputStream(data));
-
-        assertTrue("Should not be at EOF", !block.eof());
-        byte[] out_data = block.getData();
-
-        assertEquals("Should be same length", data.length, out_data.length);
-        for (int j = 0; j < 512; j++)
-        {
-            assertEquals("Should be same value at offset " + j, data[ j ],
-                         out_data[ j ]);
-        }
-    }
-
-    /**
-     * Test creating an empty RawDataBlock
-     *
-     * @exception IOException
-     */
-
-    public void testEmptyConstructor()
-        throws IOException
-    {
-        byte[]       data  = new byte[ 0 ];
-        RawDataBlock block = new RawDataBlock(new ByteArrayInputStream(data));
-
-        assertTrue("Should be at EOF", block.eof());
-        try
-        {
-            block.getData();
-        }
-        catch (IOException ignored)
-        {
-
-            // as expected
-        }
-    }
-
-    /**
-     * Test creating a short RawDataBlock
-     * Will trigger a warning, but no longer an IOException,
-     *  as people seem to have "valid" truncated files
-     */
-    public void testShortConstructor() throws Exception
-    {
-        // Get the logger to be used
-        DummyPOILogger logger = new DummyPOILogger();
-        Field fld = RawDataBlock.class.getDeclaredField("log");
-        fld.setAccessible(true);
-        fld.set(null, logger);
-        assertEquals(0, logger.logged.size());
-        
-        // Test for various data sizes
-        for (int k = 1; k <= 512; k++)
-        {
-            byte[] data = new byte[ k ];
-
-            for (int j = 0; j < k; j++)
-            {
-                data[ j ] = ( byte ) j;
-            }
-            RawDataBlock block = null;
-            
-            logger.reset();
-            assertEquals(0, logger.logged.size());
-            
-            // Have it created
-            block = new RawDataBlock(new ByteArrayInputStream(data));
-            assertNotNull(block);
-            
-            // Check for the warning is there for <512
-            if(k < 512) {
-	            assertEquals(
-	            		"Warning on " + k + " byte short block",
-	            		1, logger.logged.size()
-	            );
-	
-	            // Build the expected warning message, and check
-	            String bts = k + " byte";
-	            if(k > 1) {
-	            	bts += "s";
-	            }
-	            
-	            assertEquals(
-	            		"7 - Unable to read entire block; "+bts+" read before EOF; expected 512 bytes. Your document was either written by software that ignores the spec, or has been truncated!", 
-	            		(String)(logger.logged.get(0))
-	            );
-            } else {
-            	assertEquals(0, logger.logged.size());
-            }
-        }
-    }
-    
-    /**
-     * Tests that when using a slow input stream, which
-     *  won't return a full block at a time, we don't
-     *  incorrectly think that there's not enough data
-     */
-    public void testSlowInputStream() throws Exception {
-        // Get the logger to be used
-        DummyPOILogger logger = new DummyPOILogger();
-        Field fld = RawDataBlock.class.getDeclaredField("log");
-        fld.setAccessible(true);
-        fld.set(null, logger);
-        assertEquals(0, logger.logged.size());
-        
-        // Test for various ok data sizes
-        for (int k = 1; k < 512; k++) {
-            byte[] data = new byte[ 512 ];
-            for (int j = 0; j < data.length; j++) {
-                data[j] = (byte) j;
-            }
-            
-            // Shouldn't complain, as there is enough data,
-            //  even if it dribbles through
-            RawDataBlock block = 
-            	new RawDataBlock(new SlowInputStream(data, k));
-            assertFalse(block.eof());
-        }
-        
-        // But if there wasn't enough data available, will
-        //  complain
-        for (int k = 1; k < 512; k++) {
-            byte[] data = new byte[ 511 ];
-            for (int j = 0; j < data.length; j++) {
-                data[j] = (byte) j;
-            }
-            
-            logger.reset();
-            assertEquals(0, logger.logged.size());
-            
-            // Should complain, as there isn't enough data
-            RawDataBlock block = 
-            	new RawDataBlock(new SlowInputStream(data, k));
-            assertNotNull(block);
-            assertEquals(
-            		"Warning on " + k + " byte short block",
-            		1, logger.logged.size()
-            );
-        }
-    }
-    
-    /**
-     * An input stream which will return a maximum of
-     *  a given number of bytes to read, and often claims
-     *  not to have any data
-     */
-    public static class SlowInputStream extends InputStream {
-    	private Random rnd = new Random();
-    	private byte[] data;
-    	private int chunkSize;
-    	private int pos = 0;
-    	
-    	public SlowInputStream(byte[] data, int chunkSize) {
-    		this.chunkSize = chunkSize;
-    		this.data = data;
-    	}
-    	
-    	/**
-    	 * 75% of the time, claim there's no data available
-    	 */
-    	private boolean claimNoData() {
-    		if(rnd.nextFloat() < 0.25f) {
-    			return false;
-    		}
-    		return true;
-    	}
-    	
-		public int read() throws IOException {
+	/**
+	 * Test creating a normal RawDataBlock
+	 */
+	public void testNormalConstructor() throws IOException {
+		byte[] data = new byte[ 512 ];
+
+		for (int j = 0; j < 512; j++)
+		{
+			data[ j ] = ( byte ) j;
+		}
+		RawDataBlock block = new RawDataBlock(new ByteArrayInputStream(data));
+
+		assertTrue("Should not be at EOF", !block.eof());
+		byte[] out_data = block.getData();
+
+		assertEquals("Should be same length", data.length, out_data.length);
+		for (int j = 0; j < 512; j++)
+		{
+			assertEquals("Should be same value at offset " + j, data[ j ],
+						 out_data[ j ]);
+		}
+	}
+
+	/**
+	 * Test creating an empty RawDataBlock
+	 */
+	public void testEmptyConstructor() throws IOException {
+		byte[]	   data  = new byte[ 0 ];
+		RawDataBlock block = new RawDataBlock(new ByteArrayInputStream(data));
+
+		assertTrue("Should be at EOF", block.eof());
+		try
+		{
+			block.getData();
+		}
+		catch (IOException ignored)
+		{
+
+			// as expected
+		}
+	}
+
+	/**
+	 * Test creating a short RawDataBlock
+	 * Will trigger a warning, but no longer an IOException,
+	 *  as people seem to have "valid" truncated files
+	 */
+	public void testShortConstructor() throws Exception {
+		// Get the logger to be used
+		DummyPOILogger logger = new DummyPOILogger();
+		Field fld = RawDataBlock.class.getDeclaredField("log");
+		fld.setAccessible(true);
+		fld.set(null, logger);
+		assertEquals(0, logger.logged.size());
+
+		// Test for various data sizes
+		for (int k = 1; k <= 512; k++)
+		{
+			byte[] data = new byte[ k ];
+
+			for (int j = 0; j < k; j++)
+			{
+				data[ j ] = ( byte ) j;
+			}
+			RawDataBlock block = null;
+
+			logger.reset();
+			assertEquals(0, logger.logged.size());
+
+			// Have it created
+			block = new RawDataBlock(new ByteArrayInputStream(data));
+			assertNotNull(block);
+
+			// Check for the warning is there for <512
+			if(k < 512) {
+				assertEquals(
+						"Warning on " + k + " byte short block",
+						1, logger.logged.size()
+				);
+
+				// Build the expected warning message, and check
+				String bts = k + " byte";
+				if(k > 1) {
+					bts += "s";
+				}
+
+				assertEquals(
+						"7 - Unable to read entire block; "+bts+" read before EOF; expected 512 bytes. Your document was either written by software that ignores the spec, or has been truncated!",
+						(String)(logger.logged.get(0))
+				);
+			} else {
+				assertEquals(0, logger.logged.size());
+			}
+		}
+	}
+
+	/**
+	 * Tests that when using a slow input stream, which
+	 *  won't return a full block at a time, we don't
+	 *  incorrectly think that there's not enough data
+	 */
+	public void testSlowInputStream() throws Exception {
+		// Get the logger to be used
+		DummyPOILogger logger = new DummyPOILogger();
+		Field fld = RawDataBlock.class.getDeclaredField("log");
+		fld.setAccessible(true);
+		fld.set(null, logger);
+		assertEquals(0, logger.logged.size());
+
+		// Test for various ok data sizes
+		for (int k = 1; k < 512; k++) {
+			byte[] data = new byte[ 512 ];
+			for (int j = 0; j < data.length; j++) {
+				data[j] = (byte) j;
+			}
+
+			// Shouldn't complain, as there is enough data,
+			//  even if it dribbles through
+			RawDataBlock block =
+				new RawDataBlock(new SlowInputStream(data, k));
+			assertFalse(block.eof());
+		}
+
+		// But if there wasn't enough data available, will
+		//  complain
+		for (int k = 1; k < 512; k++) {
+			byte[] data = new byte[ 511 ];
+			for (int j = 0; j < data.length; j++) {
+				data[j] = (byte) j;
+			}
+
+			logger.reset();
+			assertEquals(0, logger.logged.size());
+
+			// Should complain, as there isn't enough data
+			RawDataBlock block =
+				new RawDataBlock(new SlowInputStream(data, k));
+			assertNotNull(block);
+			assertEquals(
+					"Warning on " + k + " byte short block",
+					1, logger.logged.size()
+			);
+		}
+	}
+
+	/**
+	 * An input stream which will return a maximum of
+	 *  a given number of bytes to read, and often claims
+	 *  not to have any data
+	 */
+	public static class SlowInputStream extends InputStream {
+		private Random rnd = new Random();
+		private byte[] data;
+		private int chunkSize;
+		private int pos = 0;
+
+		public SlowInputStream(byte[] data, int chunkSize) {
+			this.chunkSize = chunkSize;
+			this.data = data;
+		}
+
+		/**
+		 * 75% of the time, claim there's no data available
+		 */
+		private boolean claimNoData() {
+			if(rnd.nextFloat() < 0.25f) {
+				return false;
+			}
+			return true;
+		}
+
+		public int read() {
 			if(pos >= data.length) {
 				return -1;
 			}
 			int ret = data[pos];
 			pos++;
-			
+
 			if(ret < 0) ret += 256;
 			return ret;
 		}
@@ -253,7 +229,7 @@
 		 *  size, whichever is lower.
 		 * Quite often will simply claim to have no data
 		 */
-		public int read(byte[] b, int off, int len) throws IOException {
+		public int read(byte[] b, int off, int len) {
 			// Keep the length within the chunk size
 			if(len > chunkSize) {
 				len = chunkSize;
@@ -261,40 +237,26 @@
 			// Don't read off the end of the data
 			if(pos + len > data.length) {
 				len = data.length - pos;
-				
+
 				// Spot when we're out of data
 				if(len == 0) {
 					return -1;
 				}
 			}
-			
+
 			// 75% of the time, claim there's no data
 			if(claimNoData()) {
 				return 0;
 			}
-			
+
 			// Copy, and return what we read
 			System.arraycopy(data, pos, b, off, len);
 			pos += len;
 			return len;
 		}
 
-		public int read(byte[] b) throws IOException {
+		public int read(byte[] b) {
 			return read(b, 0, b.length);
 		}
-		
-    }
-
-    /**
-     * main method to run the unit tests
-     *
-     * @param ignored_args
-     */
-
-    public static void main(String [] ignored_args)
-    {
-        System.out
-            .println("Testing org.apache.poi.poifs.storage.RawDataBlock");
-        junit.textui.TestRunner.run(TestRawDataBlock.class);
-    }
+	}
 }

Modified: poi/trunk/src/testcases/org/apache/poi/poifs/storage/TestRawDataBlockList.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/poifs/storage/TestRawDataBlockList.java?rev=784284&r1=784283&r2=784284&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/poifs/storage/TestRawDataBlockList.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/poifs/storage/TestRawDataBlockList.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,27 +14,24 @@
    See the License for the specific language governing permissions and
    limitations under the License.
 ==================================================================== */
-        
 
 package org.apache.poi.poifs.storage;
 
-import java.io.*;
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
 import java.lang.reflect.Field;
 
+import junit.framework.TestCase;
+
 import org.apache.poi.poifs.common.POIFSConstants;
 import org.apache.poi.util.DummyPOILogger;
 
-import junit.framework.*;
-
 /**
  * Class to test RawDataBlockList functionality
  *
  * @author Marc Johnson
  */
-
-public class TestRawDataBlockList
-    extends TestCase
-{
+public final class TestRawDataBlockList extends TestCase {
 	static {
         // We always want to use our own
         //  logger
@@ -46,23 +42,9 @@
 	}
 
     /**
-     * Constructor TestRawDataBlockList
-     *
-     * @param name
-     */
-    public TestRawDataBlockList(String name)
-    {
-        super(name);
-    }
-
-    /**
      * Test creating a normal RawDataBlockList
-     *
-     * @exception IOException
      */
-    public void testNormalConstructor()
-        throws IOException
-    {
+    public void testNormalConstructor() throws IOException {
         byte[] data = new byte[ 2560 ];
 
         for (int j = 0; j < 2560; j++)
@@ -74,29 +56,22 @@
 
     /**
      * Test creating an empty RawDataBlockList
-     *
-     * @exception IOException
      */
-
-    public void testEmptyConstructor()
-        throws IOException
-    {
+    public void testEmptyConstructor() throws IOException {
         new RawDataBlockList(new ByteArrayInputStream(new byte[ 0 ]), POIFSConstants.BIG_BLOCK_SIZE);
     }
 
     /**
      * Test creating a short RawDataBlockList
      */
-
-    public void testShortConstructor() throws Exception
-    {
+    public void testShortConstructor() throws Exception {
         // Get the logger to be used
         DummyPOILogger logger = new DummyPOILogger();
         Field fld = RawDataBlock.class.getDeclaredField("log");
         fld.setAccessible(true);
         fld.set(null, logger);
         assertEquals(0, logger.logged.size());
-        
+
         // Test for various short sizes
         for (int k = 2049; k < 2560; k++)
         {
@@ -113,17 +88,4 @@
             assertEquals(1, logger.logged.size());
         }
     }
-
-    /**
-     * main method to run the unit tests
-     *
-     * @param ignored_args
-     */
-
-    public static void main(String [] ignored_args)
-    {
-        System.out
-            .println("Testing org.apache.poi.poifs.storage.RawDataBlockList");
-        junit.textui.TestRunner.run(TestRawDataBlockList.class);
-    }
 }

Modified: poi/trunk/src/testcases/org/apache/poi/poifs/storage/TestSmallBlockTableReader.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/poifs/storage/TestSmallBlockTableReader.java?rev=784284&r1=784283&r2=784284&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/poifs/storage/TestSmallBlockTableReader.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/poifs/storage/TestSmallBlockTableReader.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,15 +14,13 @@
    See the License for the specific language governing permissions and
    limitations under the License.
 ==================================================================== */
-        
 
 package org.apache.poi.poifs.storage;
 
-import java.io.*;
-
-import java.util.*;
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
 
-import junit.framework.*;
+import junit.framework.TestCase;
 
 import org.apache.poi.poifs.common.POIFSConstants;
 import org.apache.poi.poifs.property.PropertyTable;
@@ -34,35 +31,13 @@
  *
  * @author Marc Johnson
  */
+public final class TestSmallBlockTableReader extends TestCase {
 
-public class TestSmallBlockTableReader
-    extends TestCase
-{
-
-    /**
-     * Constructor TestSmallBlockTableReader
-     *
-     * @param name
-     */
-
-    public TestSmallBlockTableReader(String name)
-    {
-        super(name);
-    }
-
-    /**
-     * test reading constructor
-     *
-     * @exception IOException
-     */
-
-    public void testReadingConstructor()
-        throws IOException
-    {
+    public void testReadingConstructor() throws IOException {
 
         // first, we need the raw data blocks
         byte[]           raw_data_array =
-        {
+        {   // TODO - put this raw data in a better format
             ( byte ) 0x52, ( byte ) 0x00, ( byte ) 0x6F, ( byte ) 0x00,
             ( byte ) 0x6F, ( byte ) 0x00, ( byte ) 0x74, ( byte ) 0x00,
             ( byte ) 0x20, ( byte ) 0x00, ( byte ) 0x45, ( byte ) 0x00,
@@ -2130,17 +2105,4 @@
             SmallBlockTableReader.getSmallDocumentBlocks(data_blocks, root,
                 14);
     }
-
-    /**
-     * main method to run the unit tests
-     *
-     * @param ignored_args
-     */
-
-    public static void main(String [] ignored_args)
-    {
-        System.out.println(
-            "Testing org.apache.poi.poifs.storage.SmallBlockTableReader");
-        junit.textui.TestRunner.run(TestSmallBlockTableReader.class);
-    }
 }

Modified: poi/trunk/src/testcases/org/apache/poi/poifs/storage/TestSmallBlockTableWriter.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/poifs/storage/TestSmallBlockTableWriter.java?rev=784284&r1=784283&r2=784284&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/poifs/storage/TestSmallBlockTableWriter.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/poifs/storage/TestSmallBlockTableWriter.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,15 +14,15 @@
    See the License for the specific language governing permissions and
    limitations under the License.
 ==================================================================== */
-        
 
 package org.apache.poi.poifs.storage;
 
-import java.io.*;
-
-import java.util.*;
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
 
-import junit.framework.*;
+import junit.framework.TestCase;
 
 import org.apache.poi.poifs.filesystem.POIFSDocument;
 import org.apache.poi.poifs.property.PropertyTable;
@@ -34,32 +33,10 @@
  *
  * @author Marc Johnson
  */
+public final class TestSmallBlockTableWriter extends TestCase {
 
-public class TestSmallBlockTableWriter
-    extends TestCase
-{
-
-    /**
-     * Constructor TestSmallBlockTableWriter
-     *
-     * @param name
-     */
-
-    public TestSmallBlockTableWriter(String name)
-    {
-        super(name);
-    }
-
-    /**
-     * test writing constructor
-     *
-     * @exception IOException
-     */
-
-    public void testWritingConstructor()
-        throws IOException
-    {
-        List documents = new ArrayList();
+    public void testWritingConstructor() throws IOException {
+        List<POIFSDocument> documents = new ArrayList<POIFSDocument>();
 
         documents.add(
             new POIFSDocument(
@@ -113,17 +90,4 @@
         sbtw.setStartBlock(start_block);
         assertEquals(start_block, root.getStartBlock());
     }
-
-    /**
-     * main method to run the unit tests
-     *
-     * @param ignored_args
-     */
-
-    public static void main(String [] ignored_args)
-    {
-        System.out.println(
-            "Testing org.apache.poi.poifs.storage.SmallBlockTableWriter");
-        junit.textui.TestRunner.run(TestSmallBlockTableWriter.class);
-    }
 }

Modified: poi/trunk/src/testcases/org/apache/poi/poifs/storage/TestSmallDocumentBlockList.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/poifs/storage/TestSmallDocumentBlockList.java?rev=784284&r1=784283&r2=784284&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/poifs/storage/TestSmallDocumentBlockList.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/poifs/storage/TestSmallDocumentBlockList.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,44 +14,22 @@
    See the License for the specific language governing permissions and
    limitations under the License.
 ==================================================================== */
-        
 
 package org.apache.poi.poifs.storage;
 
-import java.io.*;
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
 
-import junit.framework.*;
+import junit.framework.TestCase;
 
 /**
  * Class to test SmallDocumentBlockList functionality
  *
  * @author Marc Johnson
  */
+public final class TestSmallDocumentBlockList extends TestCase {
 
-public class TestSmallDocumentBlockList
-    extends TestCase
-{
-
-    /**
-     * Constructor TestSmallDocumentBlockList
-     *
-     * @param name
-     */
-
-    public TestSmallDocumentBlockList(String name)
-    {
-        super(name);
-    }
-
-    /**
-     * Test creating a SmallDocumentBlockList
-     *
-     * @exception IOException
-     */
-
-    public void testConstructor()
-        throws IOException
-    {
+    public void testConstructor() throws IOException {
         byte[] data = new byte[ 2560 ];
 
         for (int j = 0; j < 2560; j++)
@@ -85,17 +62,4 @@
             // it better have thrown one!!
         }
     }
-
-    /**
-     * main method to run the unit tests
-     *
-     * @param ignored_args
-     */
-
-    public static void main(String [] ignored_args)
-    {
-        System.out.println(
-            "Testing org.apache.poi.poifs.storage.SmallDocumentBlockList");
-        junit.textui.TestRunner.run(TestSmallDocumentBlockList.class);
-    }
 }

Modified: poi/trunk/src/testcases/org/apache/poi/util/TestBinaryTree.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/util/TestBinaryTree.java?rev=784284&r1=784283&r2=784284&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/util/TestBinaryTree.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/util/TestBinaryTree.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,28 +27,9 @@
  *
  * @author Marc Johnson (mjohnson at apache dot org)
  */
+public final class TestBinaryTree extends TestCase {
 
-public class TestBinaryTree
-    extends TestCase
-{
-
-    /**
-     * constructor
-     *
-     * @param name
-     */
-
-    public TestBinaryTree(final String name)
-    {
-        super(name);
-    }
-
-    /**
-     * test size() method
-     */
-
-    public void testSize()
-    {
+    public void testSize() {
         Map m = new BinaryTree();
 
         assertEquals(0, m.size());
@@ -74,12 +54,7 @@
         }
     }
 
-    /**
-     * test IsEmpty() method
-     */
-
-    public void testIsEmpty()
-    {
+    public void testIsEmpty() {
         Map m = new BinaryTree();
 
         assertTrue(m.isEmpty());
@@ -118,12 +93,7 @@
         }
     }
 
-    /**
-     * test containsKey() method
-     */
-
-    public void testContainsKey()
-    {
+    public void testContainsKey() {
         Map m = new BinaryTree();
 
         try
@@ -166,12 +136,7 @@
         }
     }
 
-    /**
-     * test containsValue() method
-     */
-
-    public void testContainsValue()
-    {
+    public void testContainsValue() {
         Map           m       = new BinaryTree();
         LocalTestNode nodes[] = makeLocalNodes();
 
@@ -187,12 +152,7 @@
         }
     }
 
-    /**
-     * test get() method
-     */
-
-    public void testGet()
-    {
+    public void testGet() {
         Map m = new BinaryTree();
 
         try
@@ -236,12 +196,7 @@
         }
     }
 
-    /**
-     * test put() method
-     */
-
-    public void testPut()
-    {
+    public void testPut() {
         Map m = new BinaryTree();
 
         try
@@ -291,12 +246,7 @@
         }
     }
 
-    /**
-     * test remove() method
-     */
-
-    public void testRemove()
-    {
+    public void testRemove() {
         BinaryTree    m       = new BinaryTree();
         LocalTestNode nodes[] = makeLocalNodes();
 
@@ -350,12 +300,7 @@
         assertTrue(m.isEmpty());
     }
 
-    /**
-     * Method testPutAll
-     */
-
-    public void testPutAll()
-    {
+    public void testPutAll() {
         Map           m       = new BinaryTree();
         LocalTestNode nodes[] = makeLocalNodes();
 
@@ -419,12 +364,7 @@
         }
     }
 
-    /**
-     * test clear() method
-     */
-
-    public void testClear()
-    {
+    public void testClear() {
         Map           m       = new BinaryTree();
         LocalTestNode nodes[] = makeLocalNodes();
 
@@ -448,12 +388,7 @@
         }
     }
 
-    /**
-     * test keySet() method
-     */
-
-    public void testKeySet()
-    {
+    public void testKeySet() {
         testKeySet(new BinaryTree());
         Map           m       = new BinaryTree();
         LocalTestNode nodes[] = makeLocalNodes();
@@ -600,12 +535,7 @@
         assertTrue(m.size() == 0);
     }
 
-    /**
-     * test values() method
-     */
-
-    public void testValues()
-    {
+    public void testValues() {
         testValues(new BinaryTree());
         Map           m       = new BinaryTree();
         LocalTestNode nodes[] = makeLocalNodes();
@@ -741,12 +671,7 @@
         assertEquals(0, m.size());
     }
 
-    /**
-     * test entrySet() method
-     */
-
-    public void testEntrySet()
-    {
+    public void testEntrySet() {
         testEntrySet(new BinaryTree());
         Map           m       = new BinaryTree();
         LocalTestNode nodes[] = makeLocalNodes();
@@ -820,12 +745,7 @@
         }
     }
 
-    /**
-     * Method testEquals
-     */
-
-    public void testEquals()
-    {
+    public void testEquals() {
         Map           m       = new BinaryTree();
         LocalTestNode nodes[] = makeLocalNodes();
 
@@ -871,12 +791,7 @@
         assertEquals(m, m1);
     }
 
-    /**
-     * test hashCode() method
-     */
-
-    public void testHashCode()
-    {
+    public void testHashCode() {
         Map           m       = new BinaryTree();
         LocalTestNode nodes[] = makeLocalNodes();
 
@@ -893,12 +808,7 @@
         assertTrue(m.hashCode() == m1.hashCode());
     }
 
-    /**
-     * test constructors
-     */
-
-    public void testConstructors()
-    {
+    public void testConstructors() {
         BinaryTree m = new BinaryTree();
 
         assertTrue(m.isEmpty());
@@ -995,12 +905,7 @@
         }
     }
 
-    /**
-     * test getKeyForValue() method
-     */
-
-    public void testGetKeyForValue()
-    {
+    public void testGetKeyForValue() {
         BinaryTree m = new BinaryTree();
 
         try
@@ -1044,12 +949,7 @@
         }
     }
 
-    /**
-     * test removeValue() method
-     */
-
-    public void testRemoveValue()
-    {
+    public void testRemoveValue() {
         BinaryTree    m       = new BinaryTree();
         LocalTestNode nodes[] = makeLocalNodes();
 
@@ -1099,12 +999,7 @@
         assertTrue(m.isEmpty());
     }
 
-    /**
-     * test entrySetByValue() method
-     */
-
-    public void testEntrySetByValue()
-    {
+    public void testEntrySetByValue() {
         testEntrySetByValue(new BinaryTree());
         BinaryTree    m       = new BinaryTree();
         LocalTestNode nodes[] = makeLocalNodes();
@@ -1178,12 +1073,7 @@
         }
     }
 
-    /**
-     * test keySetByValue() method
-     */
-
-    public void testKeySetByValue()
-    {
+    public void testKeySetByValue() {
         testKeySetByValue(new BinaryTree());
         BinaryTree    m       = new BinaryTree();
         LocalTestNode nodes[] = makeLocalNodes();
@@ -1330,12 +1220,7 @@
         assertTrue(m.size() == 0);
     }
 
-    /**
-     * test valuesByValue() method
-     */
-
-    public void testValuesByValue()
-    {
+    public void testValuesByValue() {
         testValuesByValue(new BinaryTree());
         BinaryTree    m       = new BinaryTree();
         LocalTestNode nodes[] = makeLocalNodes();
@@ -1472,8 +1357,7 @@
     }
 
     /* ********** START helper methods ********** */
-    private void testKeySet(final Map m)
-    {
+    private static void testKeySet(final Map m) {
         Set s = m.keySet();
 
         assertEquals(m.size(), s.size());
@@ -1699,8 +1583,7 @@
         assertTrue(s.hashCode() == hs.hashCode());
     }
 
-    private void testKeySetByValue(final BinaryTree m)
-    {
+    private static void testKeySetByValue(final BinaryTree m) {
         Set s = m.keySetByValue();
 
         assertEquals(m.size(), s.size());
@@ -1922,8 +1805,7 @@
         assertTrue(s.hashCode() == hs.hashCode());
     }
 
-    private void testValues(Map m)
-    {
+    private static void testValues(Map m) {
         Collection s = m.values();
 
         assertEquals(m.size(), s.size());
@@ -2140,8 +2022,7 @@
         assertTrue(!hs.equals(s));
     }
 
-    private void testValuesByValue(BinaryTree m)
-    {
+    private static void testValuesByValue(BinaryTree m) {
         Collection s = m.valuesByValue();
 
         assertEquals(m.size(), s.size());
@@ -2325,8 +2206,7 @@
         assertTrue(!hs.equals(s));
     }
 
-    private void testEntrySet(Map m)
-    {
+    private static void testEntrySet(Map m) {
         Set s = m.entrySet();
 
         assertEquals(m.size(), s.size());
@@ -2539,8 +2419,7 @@
         assertTrue(s.hashCode() == hs.hashCode());
     }
 
-    private void testEntrySetByValue(BinaryTree m)
-    {
+    private static void testEntrySetByValue(BinaryTree m) {
         Set s = m.entrySetByValue();
 
         assertEquals(m.size(), s.size());
@@ -2763,17 +2642,4 @@
         }
         return nodes;
     }
-
-    /* **********  END  helper methods ********** */
-
-    /**
-     * Method main
-     *
-     * @param unused_args
-     */
-
-    public static void main(final String unused_args[])
-    {
-        junit.textui.TestRunner.run(TestBinaryTree.class);
-    }
 }

Modified: poi/trunk/src/testcases/org/apache/poi/util/TestBitField.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/util/TestBitField.java?rev=784284&r1=784283&r2=784284&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/util/TestBitField.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/util/TestBitField.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;
 
@@ -27,66 +25,32 @@
  * @author Marc Johnson
  * @author Glen Stampoultzis (gstamp@iprimus.com.au)
  */
-
-public class TestBitField
-    extends TestCase
-{
+public final class TestBitField extends TestCase {
     private static BitField bf_multi  = BitFieldFactory.getInstance(0x3F80);
     private static BitField bf_single = BitFieldFactory.getInstance(0x4000);
 
-    /**
-     * Constructor TestBitField
-     *
-     * @param name
-     */
-
-    public TestBitField(String name)
-    {
-        super(name);
-    }
-
-    /**
-     * test the getValue() method
-     */
-
-    public void testGetValue()
-    {
+    public void testGetValue() {
         assertEquals(bf_multi.getValue(-1), 127);
         assertEquals(bf_multi.getValue(0), 0);
         assertEquals(bf_single.getValue(-1), 1);
         assertEquals(bf_single.getValue(0), 0);
     }
 
-    /**
-     * test the getShortValue() method
-     */
-
-    public void testGetShortValue()
-    {
+    public void testGetShortValue() {
         assertEquals(bf_multi.getShortValue(( short ) -1), ( short ) 127);
         assertEquals(bf_multi.getShortValue(( short ) 0), ( short ) 0);
         assertEquals(bf_single.getShortValue(( short ) -1), ( short ) 1);
         assertEquals(bf_single.getShortValue(( short ) 0), ( short ) 0);
     }
 
-    /**
-     * test the getRawValue() method
-     */
-
-    public void testGetRawValue()
-    {
+    public void testGetRawValue() {
         assertEquals(bf_multi.getRawValue(-1), 0x3F80);
         assertEquals(bf_multi.getRawValue(0), 0);
         assertEquals(bf_single.getRawValue(-1), 0x4000);
         assertEquals(bf_single.getRawValue(0), 0);
     }
 
-    /**
-     * test the getShortRawValue() method
-     */
-
-    public void testGetShortRawValue()
-    {
+    public void testGetShortRawValue() {
         assertEquals(bf_multi.getShortRawValue(( short ) -1),
                      ( short ) 0x3F80);
         assertEquals(bf_multi.getShortRawValue(( short ) 0), ( short ) 0);
@@ -95,12 +59,7 @@
         assertEquals(bf_single.getShortRawValue(( short ) 0), ( short ) 0);
     }
 
-    /**
-     * test the isSet() method
-     */
-
-    public void testIsSet()
-    {
+    public void testIsSet() {
         assertTrue(!bf_multi.isSet(0));
         for (int j = 0x80; j <= 0x3F80; j += 0x80)
         {
@@ -110,12 +69,7 @@
         assertTrue(bf_single.isSet(0x4000));
     }
 
-    /**
-     * test the isAllSet() method
-     */
-
-    public void testIsAllSet()
-    {
+    public void testIsAllSet() {
         for (int j = 0; j < 0x3F80; j += 0x80)
         {
             assertTrue(!bf_multi.isAllSet(j));
@@ -125,12 +79,7 @@
         assertTrue(bf_single.isAllSet(0x4000));
     }
 
-    /**
-     * test the setValue() method
-     */
-
-    public void testSetValue()
-    {
+    public void testSetValue() {
         for (int j = 0; j < 128; j++)
         {
             assertEquals(bf_multi.getValue(bf_multi.setValue(0, j)), j);
@@ -149,12 +98,7 @@
         assertEquals(bf_single.setValue(0x4000, 2), 0);
     }
 
-    /**
-     * test the setShortValue() method
-     */
-
-    public void testSetShortValue()
-    {
+    public void testSetShortValue() {
         for (int j = 0; j < 128; j++)
         {
             assertEquals(bf_multi
@@ -181,8 +125,7 @@
                      ( short ) 0);
     }
 
-    public void testByte()
-    {
+    public void testByte() {
         assertEquals(1, BitFieldFactory.getInstance(1).setByteBoolean(( byte ) 0, true));
         assertEquals(2, BitFieldFactory.getInstance(2).setByteBoolean(( byte ) 0, true));
         assertEquals(4, BitFieldFactory.getInstance(4).setByteBoolean(( byte ) 0, true));
@@ -208,64 +151,34 @@
         assertEquals(false, BitFieldFactory.getInstance(0x40).isSet(clearedBit));
     }
 
-    /**
-     * test the clear() method
-     */
-
-    public void testClear()
-    {
+    public void testClear() {
         assertEquals(bf_multi.clear(-1), 0xFFFFC07F);
         assertEquals(bf_single.clear(-1), 0xFFFFBFFF);
     }
 
-    /**
-     * test the clearShort() method
-     */
-
-    public void testClearShort()
-    {
+    public void testClearShort() {
         assertEquals(bf_multi.clearShort(( short ) -1), ( short ) 0xC07F);
         assertEquals(bf_single.clearShort(( short ) -1), ( short ) 0xBFFF);
     }
 
-    /**
-     * test the set() method
-     */
-
-    public void testSet()
-    {
+    public void testSet() {
         assertEquals(bf_multi.set(0), 0x3F80);
         assertEquals(bf_single.set(0), 0x4000);
     }
 
-    /**
-     * test the setShort() method
-     */
-
-    public void testSetShort()
-    {
+    public void testSetShort() {
         assertEquals(bf_multi.setShort(( short ) 0), ( short ) 0x3F80);
         assertEquals(bf_single.setShort(( short ) 0), ( short ) 0x4000);
     }
 
-    /**
-     * test the setBoolean() method
-     */
-
-    public void testSetBoolean()
-    {
+    public void testSetBoolean() {
         assertEquals(bf_multi.set(0), bf_multi.setBoolean(0, true));
         assertEquals(bf_single.set(0), bf_single.setBoolean(0, true));
         assertEquals(bf_multi.clear(-1), bf_multi.setBoolean(-1, false));
         assertEquals(bf_single.clear(-1), bf_single.setBoolean(-1, false));
     }
 
-    /**
-     * test the setShortBoolean() method
-     */
-
-    public void testSetShortBoolean()
-    {
+    public void testSetShortBoolean() {
         assertEquals(bf_multi.setShort(( short ) 0),
                      bf_multi.setShortBoolean(( short ) 0, true));
         assertEquals(bf_single.setShort(( short ) 0),
@@ -275,16 +188,4 @@
         assertEquals(bf_single.clearShort(( short ) -1),
                      bf_single.setShortBoolean(( short ) -1, false));
     }
-
-    /**
-     * main method to run the unit tests
-     *
-     * @param ignored_args
-     */
-
-    public static void main(String [] ignored_args)
-    {
-        System.out.println("Testing util.BitField functionality");
-        junit.textui.TestRunner.run(TestBitField.class);
-    }
 }



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


Mime
View raw message