You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@poi.apache.org by ki...@apache.org on 2015/09/11 02:56:17 UTC

svn commit: r1702356 [1/2] - in /poi/trunk: ./ src/scratchpad/src/org/apache/poi/hslf/extractor/ src/scratchpad/testcases/org/apache/poi/hslf/extractor/ src/scratchpad/testcases/org/apache/poi/hwpf/ src/scratchpad/testcases/org/apache/poi/hwpf/converte...

Author: kiwiwings
Date: Fri Sep 11 00:56:16 2015
New Revision: 1702356

URL: http://svn.apache.org/r1702356
Log:
More forbidden apis fixes (added main-tests to the check)
and a few junit4 upgrades
... hopefully this doesn't crash the build again ... :|

to simulate the tests on jenkins on the local developer box, uncomment the UTC lines in the build.xml

Modified:
    poi/trunk/build.xml
    poi/trunk/src/scratchpad/src/org/apache/poi/hslf/extractor/PowerPointExtractor.java
    poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/extractor/TestExtractor.java
    poi/trunk/src/scratchpad/testcases/org/apache/poi/hwpf/AllHWPFTests.java
    poi/trunk/src/scratchpad/testcases/org/apache/poi/hwpf/converter/TestWordToFoConverter.java
    poi/trunk/src/scratchpad/testcases/org/apache/poi/hwpf/converter/TestWordToHtmlConverter.java
    poi/trunk/src/testcases/org/apache/poi/POITestCase.java
    poi/trunk/src/testcases/org/apache/poi/ddf/TestEscherDump.java
    poi/trunk/src/testcases/org/apache/poi/hpsf/basic/TestBasic.java
    poi/trunk/src/testcases/org/apache/poi/hssf/dev/TestBiffViewer.java
    poi/trunk/src/testcases/org/apache/poi/hssf/dev/TestEFBiffViewer.java
    poi/trunk/src/testcases/org/apache/poi/hssf/dev/TestFormulaViewer.java
    poi/trunk/src/testcases/org/apache/poi/hssf/dev/TestReSave.java
    poi/trunk/src/testcases/org/apache/poi/hssf/dev/TestRecordLister.java
    poi/trunk/src/testcases/org/apache/poi/hssf/extractor/TestOldExcelExtractor.java
    poi/trunk/src/testcases/org/apache/poi/hssf/model/AllModelTests.java
    poi/trunk/src/testcases/org/apache/poi/hssf/model/TestRowBlocksReader.java
    poi/trunk/src/testcases/org/apache/poi/hssf/record/TestSSTRecord.java
    poi/trunk/src/testcases/org/apache/poi/hssf/record/aggregates/AllRecordAggregateTests.java
    poi/trunk/src/testcases/org/apache/poi/hssf/record/aggregates/TestRowRecordsAggregate.java
    poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestOLE2Embeding.java
    poi/trunk/src/testcases/org/apache/poi/poifs/filesystem/TestNPOIFSMiniStore.java
    poi/trunk/src/testcases/org/apache/poi/poifs/property/AllPOIFSPropertyTests.java
    poi/trunk/src/testcases/org/apache/poi/poifs/property/TestDirectoryProperty.java
    poi/trunk/src/testcases/org/apache/poi/poifs/property/TestDocumentProperty.java
    poi/trunk/src/testcases/org/apache/poi/poifs/property/TestRootProperty.java
    poi/trunk/src/testcases/org/apache/poi/ss/usermodel/TestFractionFormat.java
    poi/trunk/src/testcases/org/apache/poi/util/TestHexDump.java
    poi/trunk/src/testcases/org/apache/poi/util/TestTempFile.java

Modified: poi/trunk/build.xml
URL: http://svn.apache.org/viewvc/poi/trunk/build.xml?rev=1702356&r1=1702355&r2=1702356&view=diff
==============================================================================
--- poi/trunk/build.xml (original)
+++ poi/trunk/build.xml Fri Sep 11 00:56:16 2015
@@ -1025,6 +1025,7 @@ under the License.
                 <syspropertyset refid="junit.properties"/>
                 <jvmarg value="-ea"/>
                 <jvmarg value="-Xmx256m"/>
+            	<!-- jvmarg value="-Duser.timezone=UTC"/ -->
                 <formatter type="plain"/>
                 <formatter type="xml"/>
                 <batchtest todir="${main.reports.test}">
@@ -1065,6 +1066,7 @@ under the License.
                 <classpath refid="test.scratchpad.classpath"/>
                 <syspropertyset refid="junit.properties"/>
                 <jvmarg value="-ea"/>
+            	<!-- jvmarg value="-Duser.timezone=UTC"/ -->
                 <!--
                   YK: ensure that JUnit has enough memory to run tests.
                   Without the line below tests fail on Mac OS X with jdk-1.6.26
@@ -1107,6 +1109,7 @@ under the License.
                   <syspropertyset refid="junit.properties"/>
               	  <jvmarg value="-Xmx768M"/>
                   <jvmarg value="-ea"/>
+              	  <!-- jvmarg value="-Duser.timezone=UTC"/ -->
                   <formatter type="plain"/>
                   <formatter type="xml"/>
                   <batchtest todir="${ooxml.reports.test}">
@@ -1747,8 +1750,8 @@ under the License.
         	<fileset dir="${main.output.dir}"/>
         	<fileset dir="${scratchpad.output.dir}"/>
         	<fileset dir="${ooxml.output.dir}"/>
-        	<!--
         	<fileset dir="${main.output.test.dir}"/>
+        	<!--
         	<fileset dir="${scratchpad.output.test.dir}"/>
         	<fileset dir="${ooxml.output.test.dir}"/>
         	-->

Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hslf/extractor/PowerPointExtractor.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/extractor/PowerPointExtractor.java?rev=1702356&r1=1702355&r2=1702356&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hslf/extractor/PowerPointExtractor.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hslf/extractor/PowerPointExtractor.java Fri Sep 11 00:56:16 2015
@@ -124,7 +124,7 @@ public final class PowerPointExtractor e
 	public PowerPointExtractor(DirectoryNode dir, POIFSFileSystem fs) throws IOException {
 		this(new HSLFSlideShowImpl(dir, fs));
 	}
-
+   
 	/**
 	 * Creates a PowerPointExtractor, from a HSLFSlideShow
 	 *

Modified: poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/extractor/TestExtractor.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/extractor/TestExtractor.java?rev=1702356&r1=1702355&r2=1702356&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/extractor/TestExtractor.java (original)
+++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/extractor/TestExtractor.java Fri Sep 11 00:56:16 2015
@@ -17,13 +17,18 @@
 
 package org.apache.poi.hslf.extractor;
 
+import static org.apache.poi.POITestCase.assertContains;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
 import java.io.ByteArrayOutputStream;
 import java.io.InputStream;
 import java.util.List;
 import java.util.Locale;
 
 import org.apache.poi.POIDataSamples;
-import org.apache.poi.POITestCase;
 import org.apache.poi.hslf.model.OLEShape;
 import org.apache.poi.hslf.usermodel.HSLFSlideShow;
 import org.apache.poi.hslf.usermodel.HSLFSlideShowImpl;
@@ -33,11 +38,14 @@ import org.apache.poi.poifs.filesystem.D
 import org.apache.poi.poifs.filesystem.NPOIFSFileSystem;
 import org.apache.poi.poifs.filesystem.POIFSFileSystem;
 import org.apache.poi.util.IOUtils;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
 
 /**
  * Tests that the extractor correctly gets the text out of our sample file
  */
-public final class TestExtractor extends POITestCase {
+public final class TestExtractor {
    /** Extractor primed on the 2 page basic test data */
    private PowerPointExtractor ppe;
    private static final String expectText = "This is a test title\nThis is a test subtitle\nThis is on page 1\nThis is the title on page 2\nThis is page two\nIt has several blocks of text\nNone of them have formatting\n";
@@ -47,15 +55,21 @@ public final class TestExtractor extends
    private static final String expectText2 = "Hello, World!!!\nI am just a poor boy\nThis is Times New Roman\nPlain Text \n";
    
    /** Where our embeded files live */
-   //private String pdirname;
    private static POIDataSamples slTests = POIDataSamples.getSlideShowInstance();
-   //private String pdirname;
 
-   protected void setUp() throws Exception {
-      ppe = new PowerPointExtractor(slTests.openResourceAsStream("basic_test_ppt_file.ppt"));
-      ppe2 = new PowerPointExtractor(slTests.openResourceAsStream("with_textbox.ppt"));
+   @Before
+   public void setUp() throws Exception {
+      ppe = new PowerPointExtractor(slTests.getFile("basic_test_ppt_file.ppt").getCanonicalPath());
+      ppe2 = new PowerPointExtractor(slTests.getFile("with_textbox.ppt").getCanonicalPath());
    }
 
+   @After
+   public void closeResources() throws Exception {
+       ppe2.close();
+       ppe.close();
+   }
+   
+    @Test
     public void testReadSheetText() {
     	// Basic 2 page example
 		String sheetText = ppe.getText();
@@ -69,20 +83,22 @@ public final class TestExtractor extends
 		ensureTwoStringsTheSame(expectText2, sheetText);
     }
     
+    @Test
 	public void testReadNoteText() {
 		// Basic 2 page example
 		String notesText = ppe.getNotes();
-		String expectText = "These are the notes for page 1\nThese are the notes on page two, again lacking formatting\n";
+		String expText = "These are the notes for page 1\nThese are the notes on page two, again lacking formatting\n";
 
-		ensureTwoStringsTheSame(expectText, notesText);
+		ensureTwoStringsTheSame(expText, notesText);
 		
 		// Other one doesn't have notes
 		notesText = ppe2.getNotes();
-		expectText = "";
+		expText = "";
 		
-		ensureTwoStringsTheSame(expectText, notesText);
+		ensureTwoStringsTheSame(expText, notesText);
 	}
 	
+    @Test
 	public void testReadBoth() {
 		String[] slText = new String[] {
 				"This is a test title\nThis is a test subtitle\nThis is on page 1\n",
@@ -111,6 +127,7 @@ public final class TestExtractor extends
 	 *  core record, we can still get the rest of the text out
 	 * @throws Exception
 	 */
+    @Test
 	public void testMissingCoreRecords() throws Exception {
 		ppe = new PowerPointExtractor(slTests.openResourceAsStream("missing_core_records.ppt"));
 
@@ -137,6 +154,7 @@ public final class TestExtractor extends
 		assertEquals(exp,act);
     }
     
+    @Test
     public void testExtractFromEmbeded() throws Exception {
          POIFSFileSystem fs = new POIFSFileSystem(
              POIDataSamples.getSpreadSheetInstance().openResourceAsStream("excel_with_embeded.xls")
@@ -164,12 +182,14 @@ public final class TestExtractor extends
          assertEquals("Sample PowerPoint file\nThis is the 2nd file\nNot much too it either\n",
                  ppe.getText(true, false)
          );
+         fs.close();
      }
 
      /**
       * A powerpoint file with embeded powerpoint files
       */
      @SuppressWarnings("unused")
+     @Test
      public void testExtractFromOwnEmbeded() throws Exception {
          String path = "ppt_with_embeded.ppt";
          ppe = new PowerPointExtractor(POIDataSamples.getSlideShowInstance().openResourceAsStream(path));
@@ -182,6 +202,7 @@ public final class TestExtractor extends
              if ("Worksheet".equals(name)) {
                  HSSFWorkbook wb = new HSSFWorkbook(data);
                  num_xls++;
+                 wb.close();
              } else if ("Document".equals(name)) {
                  HWPFDocument doc = new HWPFDocument(data);
                  num_doc++;
@@ -189,6 +210,7 @@ public final class TestExtractor extends
                  num_ppt++;
                  HSLFSlideShow ppt = new HSLFSlideShow(data);
              }
+             data.close();
          }
          assertEquals("Expected 2 embedded Word Documents", 2, num_doc);
          assertEquals("Expected 2 embedded Excel Spreadsheets", 2, num_xls);
@@ -198,6 +220,7 @@ public final class TestExtractor extends
     /**
      * A powerpoint file with embeded powerpoint files
      */
+    @Test
     public void test52991() throws Exception {
         String path = "badzip.ppt";
         ppe = new PowerPointExtractor(POIDataSamples.getSlideShowInstance().openResourceAsStream(path));
@@ -211,6 +234,7 @@ public final class TestExtractor extends
     /**
      * From bug #45543
      */
+    @Test
     public void testWithComments() throws Exception {
 		ppe = new PowerPointExtractor(slTests.openResourceAsStream("WithComments.ppt"));
 
@@ -238,6 +262,7 @@ public final class TestExtractor extends
     /**
      * From bug #45537
      */
+    @Test
     public void testHeaderFooter() throws Exception {
        String  text;
 
@@ -278,6 +303,7 @@ public final class TestExtractor extends
     }
     
    @SuppressWarnings("unused")
+   @Test
    public void testSlideMasterText() throws Exception {
       String masterTitleText = "This is the Master Title";
       String masterRandomText = "This text comes from the Master Slide";
@@ -292,7 +318,8 @@ public final class TestExtractor extends
       assertContains(text, masterFooterText);
    }
 
-    public void testMasterText() throws Exception {
+   @Test
+   public void testMasterText() throws Exception {
        ppe = new PowerPointExtractor(slTests.openResourceAsStream("master_text.ppt"));
        
        // Initially not there
@@ -322,6 +349,7 @@ public final class TestExtractor extends
     /**
      * Bug #54880 Chinese text not extracted properly
      */
+    @Test
     public void testChineseText() throws Exception {
        HSLFSlideShowImpl hslf = new HSLFSlideShowImpl(slTests.openResourceAsStream("54880_chinese.ppt"));
        ppe = new PowerPointExtractor(hslf);
@@ -346,6 +374,7 @@ public final class TestExtractor extends
      *  and {@link NPOIFSFileSystem}
      */
     @SuppressWarnings("resource")
+    @Test
     public void testDifferentPOIFS() throws Exception {
        // Open the two filesystems
        DirectoryNode[] files = new DirectoryNode[2];
@@ -369,6 +398,7 @@ public final class TestExtractor extends
        npoifsFileSystem.close();
     }
 
+    @Test
     public void testTable() throws Exception{
 //        ppe = new PowerPointExtractor(slTests.openResourceAsStream("54111.ppt"));
 //        String text = ppe.getText();

Modified: poi/trunk/src/scratchpad/testcases/org/apache/poi/hwpf/AllHWPFTests.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hwpf/AllHWPFTests.java?rev=1702356&r1=1702355&r2=1702356&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/testcases/org/apache/poi/hwpf/AllHWPFTests.java (original)
+++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hwpf/AllHWPFTests.java Fri Sep 11 00:56:16 2015
@@ -17,8 +17,6 @@
 
 package org.apache.poi.hwpf;
 
-import junit.framework.Test;
-import junit.framework.TestSuite;
 import org.apache.poi.hwpf.converter.AbstractWordUtilsTest;
 import org.apache.poi.hwpf.converter.TestWordToFoConverter;
 import org.apache.poi.hwpf.converter.TestWordToHtmlConverter;
@@ -58,69 +56,65 @@ import org.apache.poi.hwpf.usermodel.Tes
 import org.apache.poi.hwpf.usermodel.TestRangeSymbols;
 import org.apache.poi.hwpf.usermodel.TestShapes;
 import org.apache.poi.hwpf.usermodel.TestTableRow;
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
 
-public final class AllHWPFTests
-{
-
-    public static Test suite()
-    {
-        TestSuite suite = new TestSuite( AllHWPFTests.class.getName() );
-
-        // org.apache.poi.hwpf
-        suite.addTestSuite( TestFieldsTables.class );
-        suite.addTestSuite( TestHWPFPictures.class );
-        suite.addTestSuite( TestHWPFRangeParts.class );
-
-        // org.apache.poi.hwpf.converter
-        // suite.addTestSuite( TestWordToConverterSuite.class );
-        suite.addTestSuite( AbstractWordUtilsTest.class );
-        suite.addTestSuite( TestWordToFoConverter.class );
-        suite.addTestSuite( TestWordToHtmlConverter.class );
-
-        // org.apache.poi.hwpf.extractor
-        suite.addTestSuite( TestDifferentRoutes.class );
-        suite.addTestSuite( TestWordExtractor.class );
-        suite.addTestSuite( TestWordExtractorBugs.class );
-
-        // org.apache.poi.hwpf.model
-        suite.addTestSuite( TestBookmarksTables.class );
-        suite.addTestSuite( TestCHPBinTable.class );
-        suite.addTestSuite( TestDocumentProperties.class );
-        suite.addTestSuite( TestFileInformationBlock.class );
-        suite.addTestSuite( TestFontTable.class );
-        suite.addTestSuite( TestListTables.class );
-        suite.addTestSuite( TestNotesTables.class );
-        suite.addTestSuite( TestPAPBinTable.class );
-        suite.addTestSuite( TestPlexOfCps.class );
-        suite.addTestSuite( TestRevisionMarkAuthorTable.class );
-        suite.addTestSuite( TestSavedByTable.class );
-        suite.addTestSuite( TestSectionTable.class );
-        suite.addTestSuite( TestStyleSheet.class );
-        suite.addTestSuite( TestTextPieceTable.class );
-
-        // org.apache.poi.hwpf.sprm
-        suite.addTestSuite( TestSprms.class );
-
-        // org.apache.poi.hwpf.usermodel
-        suite.addTestSuite( TestBorderCode.class );
-        suite.addTestSuite( TestBug46610.class );
-        suite.addTestSuite( TestBug49820.class );
-        suite.addTestSuite( TestBug50075.class );
-        suite.addTestSuite( TestBugs.class );
-        suite.addTestSuite( TestHeaderStories.class );
-        suite.addTestSuite( TestHWPFOldDocument.class );
-        suite.addTestSuite( TestLists.class );
-        suite.addTestSuite( TestPictures.class );
-        suite.addTestSuite( TestProblems.class );
-        suite.addTestSuite( TestRange.class );
-        suite.addTestSuite( TestRangeDelete.class );
-        suite.addTestSuite( TestRangeInsertion.class );
-        suite.addTestSuite( TestRangeProperties.class );
-        suite.addTestSuite( TestRangeReplacement.class );
-        suite.addTestSuite( TestRangeSymbols.class );
-        suite.addTestSuite( TestShapes.class );
-        suite.addTestSuite( TestTableRow.class );
-
-        return suite;
-    }
+@RunWith(Suite.class)
+@Suite.SuiteClasses({
+    // org.apache.poi.hwpf
+    TestFieldsTables.class,
+    TestHWPFPictures.class,
+    TestHWPFRangeParts.class,
+
+    // org.apache.poi.hwpf.converter
+    // TestWordToConverterSuite.class,
+    AbstractWordUtilsTest.class,
+    TestWordToFoConverter.class,
+    TestWordToHtmlConverter.class,
+
+    // org.apache.poi.hwpf.extractor
+    TestDifferentRoutes.class,
+    TestWordExtractor.class,
+    TestWordExtractorBugs.class,
+
+    // org.apache.poi.hwpf.model
+    TestBookmarksTables.class,
+    TestCHPBinTable.class,
+    TestDocumentProperties.class,
+    TestFileInformationBlock.class,
+    TestFontTable.class,
+    TestListTables.class,
+    TestNotesTables.class,
+    TestPAPBinTable.class,
+    TestPlexOfCps.class,
+    TestRevisionMarkAuthorTable.class,
+    TestSavedByTable.class,
+    TestSectionTable.class,
+    TestStyleSheet.class,
+    TestTextPieceTable.class,
+
+    // org.apache.poi.hwpf.sprm
+    TestSprms.class,
+
+    // org.apache.poi.hwpf.usermodel
+    TestBorderCode.class,
+    TestBug46610.class,
+    TestBug49820.class,
+    TestBug50075.class,
+    TestBugs.class,
+    TestHeaderStories.class,
+    TestHWPFOldDocument.class,
+    TestLists.class,
+    TestPictures.class,
+    TestProblems.class,
+    TestRange.class,
+    TestRangeDelete.class,
+    TestRangeInsertion.class,
+    TestRangeProperties.class,
+    TestRangeReplacement.class,
+    TestRangeSymbols.class,
+    TestShapes.class,
+    TestTableRow.class
+})
+public final class AllHWPFTests {
 }

Modified: poi/trunk/src/scratchpad/testcases/org/apache/poi/hwpf/converter/TestWordToFoConverter.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hwpf/converter/TestWordToFoConverter.java?rev=1702356&r1=1702355&r2=1702356&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/testcases/org/apache/poi/hwpf/converter/TestWordToFoConverter.java (original)
+++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hwpf/converter/TestWordToFoConverter.java Fri Sep 11 00:56:16 2015
@@ -18,6 +18,8 @@
  */
 package org.apache.poi.hwpf.converter;
 
+import static org.apache.poi.POITestCase.assertContains;
+
 import java.io.StringWriter;
 
 import javax.xml.transform.OutputKeys;
@@ -27,14 +29,14 @@ import javax.xml.transform.dom.DOMSource
 import javax.xml.transform.stream.StreamResult;
 
 import org.apache.poi.POIDataSamples;
-import org.apache.poi.POITestCase;
 import org.apache.poi.hwpf.HWPFDocument;
 import org.apache.poi.util.XMLHelper;
+import org.junit.Test;
 
 /**
  * Test cases for {@link WordToFoConverter}
  */
-public class TestWordToFoConverter extends POITestCase
+public class TestWordToFoConverter
 {
     private static String getFoText( final String sampleFileName )
             throws Exception
@@ -59,6 +61,7 @@ public class TestWordToFoConverter exten
         return result;
     }
 
+    @Test
     public void testDocumentProperties() throws Exception
     {
         String result = getFoText( "documentProperties.doc" );
@@ -71,6 +74,7 @@ public class TestWordToFoConverter exten
                 "<pdf:Keywords xmlns:pdf=\"http://ns.adobe.com/pdf/1.3/\">This is document keywords</pdf:Keywords>" );
     }
 
+    @Test
     public void testEndnote() throws Exception
     {
         String result = getFoText( "endingnote.doc" );
@@ -86,6 +90,7 @@ public class TestWordToFoConverter exten
         assertContains( result, "Ending note text" );
     }
 
+    @Test
     public void testEquation() throws Exception
     {
         final String sampleFileName = "equation.doc";
@@ -94,6 +99,7 @@ public class TestWordToFoConverter exten
         assertContains( result, "<!--Image link to '0.emf' can be here-->" );
     }
 
+    @Test
     public void testHyperlink() throws Exception
     {
         final String sampleFileName = "hyperlink.doc";
@@ -104,6 +110,7 @@ public class TestWordToFoConverter exten
         assertContains( result, "Hyperlink text" );
     }
 
+    @Test
     public void testInnerTable() throws Exception
     {
         final String sampleFileName = "innertable.doc";
@@ -113,6 +120,7 @@ public class TestWordToFoConverter exten
                 "padding-end=\"0.0in\" padding-start=\"0.0in\" width=\"1.0770833in\"" );
     }
 
+    @Test
     public void testPageBreak() throws Exception
     {
         final String sampleFileName = "page-break.doc";
@@ -121,6 +129,7 @@ public class TestWordToFoConverter exten
         assertContains( result, "<fo:block break-before=\"page\"" );
     }
 
+    @Test
     public void testPageBreakBefore() throws Exception
     {
         final String sampleFileName = "page-break-before.doc";
@@ -129,6 +138,7 @@ public class TestWordToFoConverter exten
         assertContains( result, "<fo:block break-before=\"page\"" );
     }
 
+    @Test
     public void testPageref() throws Exception
     {
         final String sampleFileName = "pageref.doc";

Modified: poi/trunk/src/scratchpad/testcases/org/apache/poi/hwpf/converter/TestWordToHtmlConverter.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hwpf/converter/TestWordToHtmlConverter.java?rev=1702356&r1=1702355&r2=1702356&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/testcases/org/apache/poi/hwpf/converter/TestWordToHtmlConverter.java (original)
+++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hwpf/converter/TestWordToHtmlConverter.java Fri Sep 11 00:56:16 2015
@@ -16,6 +16,9 @@
 ==================================================================== */
 package org.apache.poi.hwpf.converter;
 
+import static org.apache.poi.POITestCase.assertContains;
+import static org.junit.Assert.assertFalse;
+
 import java.io.StringWriter;
 
 import javax.xml.transform.OutputKeys;
@@ -25,16 +28,16 @@ import javax.xml.transform.dom.DOMSource
 import javax.xml.transform.stream.StreamResult;
 
 import org.apache.poi.POIDataSamples;
-import org.apache.poi.POITestCase;
 import org.apache.poi.hwpf.HWPFDocument;
 import org.apache.poi.hwpf.usermodel.PictureType;
 import org.apache.poi.util.XMLHelper;
+import org.junit.Test;
 import org.w3c.dom.Document;
 
 /**
  * Test cases for {@link WordToHtmlConverter}
  */
-public class TestWordToHtmlConverter extends POITestCase
+public class TestWordToHtmlConverter
 {
     private static String getHtmlText( final String sampleFileName )
             throws Exception
@@ -82,12 +85,14 @@ public class TestWordToHtmlConverter ext
         return result;
     }
 
+    @Test
     public void testAIOOBTap() throws Exception
     {
         String result = getHtmlText( "AIOOB-Tap.doc");
         assertContains(result.substring( 0, 6000 ), "<table class=\"t1\">");
     }
 
+    @Test
     public void testBug33519() throws Exception
     {
         String result = getHtmlText( "Bug33519.doc");
@@ -98,6 +103,7 @@ public class TestWordToHtmlConverter ext
                 "\u042F\u0432\u043E\u0440 \u0410\u0441\u0435\u043D\u043E\u0432");
     }
 
+    @Test
     public void testBug46610_2() throws Exception
     {
         String result = getHtmlText( "Bug46610_2.doc");
@@ -106,6 +112,7 @@ public class TestWordToHtmlConverter ext
                 "012345678911234567892123456789312345678941234567890123456789112345678921234567893123456789412345678");
     }
 
+    @Test
     public void testBug46817() throws Exception
     {
         String result = getHtmlText( "Bug46817.doc");
@@ -113,6 +120,7 @@ public class TestWordToHtmlConverter ext
         assertContains(result, substring);
     }
 
+    @Test
     public void testBug47286() throws Exception
     {
         String result = getHtmlText( "Bug47286.doc");
@@ -124,11 +132,13 @@ public class TestWordToHtmlConverter ext
         assertContains(result, "mfa.gov.cy");
     }
 
+    @Test
     public void testBug48075() throws Exception
     {
         getHtmlText( "Bug48075.doc");
     }
 
+    @Test
     public void testBug52583() throws Exception
     {
         String result = getHtmlText( "Bug52583.doc");
@@ -137,12 +147,14 @@ public class TestWordToHtmlConverter ext
                 "<select><option selected>riri</option><option>fifi</option><option>loulou</option></select>");
     }
 
+    @Test
     public void testBug53182() throws Exception
     {
         String result = getHtmlText( "Bug53182.doc");
         assertFalse(result.contains( "italic" ));
     }
 
+    @Test
     public void testDocumentProperties() throws Exception
     {
         String result = getHtmlText( "documentProperties.doc");
@@ -152,6 +164,7 @@ public class TestWordToHtmlConverter ext
                 "<meta content=\"This is document keywords\" name=\"keywords\">");
     }
 
+    @Test
     public void testEmailhyperlink() throws Exception
     {
         String result = getHtmlText( "Bug47286.doc");
@@ -159,6 +172,7 @@ public class TestWordToHtmlConverter ext
         assertContains(result, substring);
     }
 
+    @Test
     public void testEndnote() throws Exception
     {
         String result = getHtmlText( "endingnote.doc");
@@ -172,6 +186,7 @@ public class TestWordToHtmlConverter ext
         assertContains(result, "Ending note text");
     }
 
+    @Test
     public void testEquation() throws Exception
     {
         String result = getHtmlText( "equation.doc");
@@ -179,6 +194,7 @@ public class TestWordToHtmlConverter ext
         assertContains(result, "<!--Image link to '0.emf' can be here-->");
     }
 
+    @Test
     public void testHyperlink() throws Exception
     {
         String result = getHtmlText( "hyperlink.doc");
@@ -189,11 +205,13 @@ public class TestWordToHtmlConverter ext
         assertContains(result, "</a><span>; after text</span>");
     }
 
+    @Test
     public void testInnerTable() throws Exception
     {
         getHtmlText( "innertable.doc");
     }
 
+    @Test
     public void testListsMargins() throws Exception
     {
         String result = getHtmlText( "lists-margins.doc");
@@ -210,11 +228,13 @@ public class TestWordToHtmlConverter ext
                 ".p4{text-indent:-0.59652776in;margin-left:-0.70069444in;");
     }
 
+    @Test
     public void testO_kurs_doc() throws Exception
     {
         getHtmlText( "o_kurs.doc");
     }
 
+    @Test
     public void testPageref() throws Exception
     {
         String result = getHtmlText( "pageref.doc");
@@ -224,6 +244,7 @@ public class TestWordToHtmlConverter ext
         assertContains(result, "1");
     }
 
+    @Test
     public void testPicture() throws Exception
     {
         String result = getHtmlText( "picture.doc", true);
@@ -238,6 +259,7 @@ public class TestWordToHtmlConverter ext
         assertContains(result, "width:3.4125in;height:2.325in;");
     }
 
+    @Test
     public void testPicturesEscher() throws Exception
     {
         String result = getHtmlText( "pictures_escher.doc", true);
@@ -245,6 +267,7 @@ public class TestWordToHtmlConverter ext
         assertContains(result, "<img src=\"s808.PNG\">");
     }
 
+    @Test
     public void testTableMerges() throws Exception
     {
         String result = getHtmlText( "table-merges.doc");
@@ -253,6 +276,7 @@ public class TestWordToHtmlConverter ext
         assertContains(result, "<td class=\"td2\" colspan=\"2\">");
     }
 
+    @Test
     public void testBug52420() throws Exception {
         String result = getHtmlText( "52420.doc");
 

Modified: poi/trunk/src/testcases/org/apache/poi/POITestCase.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/POITestCase.java?rev=1702356&r1=1702355&r2=1702356&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/POITestCase.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/POITestCase.java Fri Sep 11 00:56:16 2015
@@ -17,16 +17,17 @@
 
 package org.apache.poi;
 
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
 
 import java.util.Collection;
 
-import junit.framework.TestCase;
-
 /**
  * Parent class for POI JUnit TestCases, which provide additional
  *  features 
  */
-public class POITestCase extends TestCase {
+public class POITestCase {
     public static void assertContains(String haystack, String needle) {
         assertTrue(
               "Unable to find expected text '" + needle + "' in text:\n" + haystack,
@@ -40,21 +41,6 @@ public class POITestCase extends TestCas
         );
      }
     
-    public static <T> void assertEquals(T[] expected, T[] actual)
-    {
-        assertEquals("Non-matching lengths", expected.length, actual.length);
-        for (int i=0; i<expected.length; i++) {
-            assertEquals("Mis-match at offset " + i, expected[i], actual[i]);
-        }
-    }
-    public static void assertEquals(byte[] expected, byte[] actual)
-    {
-        assertEquals("Non-matching lengths", expected.length, actual.length);
-        for (int i=0; i<expected.length; i++) {
-            assertEquals("Mis-match at offset " + i, expected[i], actual[i]);
-        }
-    }
-    
     public static <T> void assertContains(T needle, T[] haystack)
     {
        // Check

Modified: poi/trunk/src/testcases/org/apache/poi/ddf/TestEscherDump.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/ddf/TestEscherDump.java?rev=1702356&r1=1702355&r2=1702356&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/ddf/TestEscherDump.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/ddf/TestEscherDump.java Fri Sep 11 00:56:16 2015
@@ -23,12 +23,15 @@ import java.io.ByteArrayInputStream;
 import java.io.IOException;
 import java.io.OutputStream;
 import java.io.PrintStream;
+import java.io.UnsupportedEncodingException;
 
 import org.apache.poi.POIDataSamples;
 import org.apache.poi.hssf.HSSFTestDataSamples;
 import org.apache.poi.util.IOUtils;
+import org.apache.poi.util.LocaleUtil;
 import org.junit.Test;
 
+@SuppressWarnings("resource")
 public class TestEscherDump {
     @Test
     public void testSimple() throws Exception {
@@ -64,8 +67,8 @@ public class TestEscherDump {
      * to redirect stdout to avoid spamming the console with output
      */
     private static class NullPrinterStream extends PrintStream {
-        private NullPrinterStream() {
-            super(new NullOutputStream());
+        private NullPrinterStream() throws UnsupportedEncodingException {
+            super(new NullOutputStream(),true,LocaleUtil.CHARSET_1252.name());
         }
         /**
          * Implementation of an OutputStream which does nothing, used

Modified: poi/trunk/src/testcases/org/apache/poi/hpsf/basic/TestBasic.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/hpsf/basic/TestBasic.java?rev=1702356&r1=1702355&r2=1702356&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/hpsf/basic/TestBasic.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/hpsf/basic/TestBasic.java Fri Sep 11 00:56:16 2015
@@ -17,6 +17,11 @@
 
 package org.apache.poi.hpsf.basic;
 
+import static org.junit.Assert.assertArrayEquals;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
 import java.io.ByteArrayInputStream;
 import java.io.File;
 import java.io.FileNotFoundException;
@@ -25,8 +30,6 @@ import java.io.InputStream;
 import java.io.UnsupportedEncodingException;
 import java.util.List;
 
-import junit.framework.TestCase;
-
 import org.apache.poi.POIDataSamples;
 import org.apache.poi.hpsf.DocumentSummaryInformation;
 import org.apache.poi.hpsf.HPSFException;
@@ -37,13 +40,15 @@ import org.apache.poi.hpsf.PropertySetFa
 import org.apache.poi.hpsf.Section;
 import org.apache.poi.hpsf.SummaryInformation;
 import org.apache.poi.hpsf.wellknown.SectionIDMap;
+import org.junit.Before;
+import org.junit.Test;
 
 /**
  * <p>Tests the basic HPSF functionality.</p>
  *
  * @author Rainer Klute (klute@rainer-klute.de)
  */
-public final class TestBasic extends TestCase {
+public final class TestBasic {
 
     private static final String POI_FS = "TestGermanWord90.doc";
     private static final String[] POI_FILES = new String[]
@@ -80,6 +85,7 @@ public final class TestBasic extends Tes
      * @exception FileNotFoundException if the file to be read does not exist.
      * @exception IOException if any other I/O exception occurs.
      */
+    @Before
     public void setUp() throws IOException
     {
         POIDataSamples samples = POIDataSamples.getHPSFInstance();
@@ -91,6 +97,7 @@ public final class TestBasic extends Tes
      * <p>Checks the names of the files in the POI filesystem. They
      * are expected to be in a certain order.</p>
      */
+    @Test
     public void testReadFiles()
     {
         String[] expected = POI_FILES;
@@ -112,6 +119,7 @@ public final class TestBasic extends Tes
      * @exception UnsupportedEncodingException if a character encoding is not
      * supported.
      */
+    @Test
     public void testCreatePropertySets()
     throws UnsupportedEncodingException, IOException
     {
@@ -152,24 +160,21 @@ public final class TestBasic extends Tes
      * @exception IOException if an I/O exception occurs
      * @exception HPSFException if any HPSF exception occurs
      */
+    @Test
     public void testPropertySetMethods() throws IOException, HPSFException
     {
         /* Loop over the two property sets. */
         for (int i = 0; i < 2; i++)
         {
             byte[] b = poiFiles[i].getBytes();
-            PropertySet ps =
-                PropertySetFactory.create(new ByteArrayInputStream(b));
-            assertEquals(ps.getByteOrder(), BYTE_ORDER);
-            assertEquals(ps.getFormat(), FORMAT);
-            assertEquals(ps.getOSVersion(), OS_VERSION);
-            assertEquals(new String(ps.getClassID().getBytes()),
-                                new String(CLASS_ID));
-            assertEquals(ps.getSectionCount(), SECTION_COUNT[i]);
-            assertEquals(ps.isSummaryInformation(),
-                                IS_SUMMARY_INFORMATION[i]);
-            assertEquals(ps.isDocumentSummaryInformation(),
-                                IS_DOCUMENT_SUMMARY_INFORMATION[i]);
+            PropertySet ps = PropertySetFactory.create(new ByteArrayInputStream(b));
+            assertEquals(BYTE_ORDER, ps.getByteOrder());
+            assertEquals(FORMAT, ps.getFormat());
+            assertEquals(OS_VERSION, ps.getOSVersion());
+            assertArrayEquals(CLASS_ID, ps.getClassID().getBytes());
+            assertEquals(SECTION_COUNT[i], ps.getSectionCount());
+            assertEquals(IS_SUMMARY_INFORMATION[i], ps.isSummaryInformation());
+            assertEquals(IS_DOCUMENT_SUMMARY_INFORMATION[i], ps.isDocumentSummaryInformation());
         }
     }
 
@@ -181,6 +186,7 @@ public final class TestBasic extends Tes
      * @exception IOException if an I/O exception occurs
      * @exception HPSFException if any HPSF exception occurs
      */
+    @Test
     public void testSectionMethods() throws IOException, HPSFException
     {
         final SummaryInformation si = (SummaryInformation)

Modified: poi/trunk/src/testcases/org/apache/poi/hssf/dev/TestBiffViewer.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/hssf/dev/TestBiffViewer.java?rev=1702356&r1=1702355&r2=1702356&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/hssf/dev/TestBiffViewer.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/hssf/dev/TestBiffViewer.java Fri Sep 11 00:56:16 2015
@@ -19,9 +19,11 @@ package org.apache.poi.hssf.dev;
 import java.io.File;
 import java.io.IOException;
 import java.io.InputStream;
+import java.io.OutputStreamWriter;
 import java.io.PrintWriter;
 
 import org.apache.poi.poifs.filesystem.NPOIFSFileSystem;
+import org.apache.poi.util.LocaleUtil;
 
 public class TestBiffViewer extends BaseXLSIteratingTest {
 	static {
@@ -44,12 +46,13 @@ public class TestBiffViewer extends Base
 	}
 
 	@Override
-	void runOneFile(File file) throws IOException {
-	    NPOIFSFileSystem fs  = new NPOIFSFileSystem(file, true);
+	void runOneFile(File fileIn) throws IOException {
+	    NPOIFSFileSystem fs  = new NPOIFSFileSystem(fileIn, true);
 		InputStream is = BiffViewer.getPOIFSInputStream(fs);
 		try {
-			// use a NullOutputStream to not write the bytes anywhere for best runtime 
-			BiffViewer.runBiffViewer(new PrintWriter(NULL_OUTPUT_STREAM), is, true, true, true, false);
+			// use a NullOutputStream to not write the bytes anywhere for best runtime
+		    PrintWriter dummy = new PrintWriter(new OutputStreamWriter(NULL_OUTPUT_STREAM, LocaleUtil.CHARSET_1252));
+			BiffViewer.runBiffViewer(dummy, is, true, true, true, false);
 		} finally {
 			is.close();
 			fs.close();

Modified: poi/trunk/src/testcases/org/apache/poi/hssf/dev/TestEFBiffViewer.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/hssf/dev/TestEFBiffViewer.java?rev=1702356&r1=1702355&r2=1702356&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/hssf/dev/TestEFBiffViewer.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/hssf/dev/TestEFBiffViewer.java Fri Sep 11 00:56:16 2015
@@ -20,6 +20,8 @@ import java.io.File;
 import java.io.IOException;
 import java.io.PrintStream;
 
+import org.apache.poi.util.LocaleUtil;
+
 public class TestEFBiffViewer extends BaseXLSIteratingTest {
 	static {
 		// these are likely ok to fail
@@ -39,13 +41,13 @@ public class TestEFBiffViewer extends Ba
 	}
 	
 	@Override
-	void runOneFile(File file) throws IOException {
+	void runOneFile(File fileIn) throws IOException {
 		PrintStream save = System.out;
 		try {
 			// redirect standard out during the test to avoid spamming the console with output
-			System.setOut(new PrintStream(NULL_OUTPUT_STREAM));
+			System.setOut(new PrintStream(NULL_OUTPUT_STREAM,true,LocaleUtil.CHARSET_1252.name()));
 
-			EFBiffViewer.main(new String[] { file.getAbsolutePath() });
+			EFBiffViewer.main(new String[] { fileIn.getAbsolutePath() });
 		} finally {
 			System.setOut(save);
 		}

Modified: poi/trunk/src/testcases/org/apache/poi/hssf/dev/TestFormulaViewer.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/hssf/dev/TestFormulaViewer.java?rev=1702356&r1=1702355&r2=1702356&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/hssf/dev/TestFormulaViewer.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/hssf/dev/TestFormulaViewer.java Fri Sep 11 00:56:16 2015
@@ -19,6 +19,7 @@ package org.apache.poi.hssf.dev;
 import java.io.File;
 import java.io.PrintStream;
 
+import org.apache.poi.util.LocaleUtil;
 import org.junit.Ignore;
 import org.junit.Test;
 
@@ -39,15 +40,15 @@ public class TestFormulaViewer extends B
 	public void testMain() throws Exception {
 	}
 
-	@Override
-	void runOneFile(File file) throws Exception {
+    @Override
+	void runOneFile(File fileIn) throws Exception {
 		PrintStream save = System.out;
 		try {
 			// redirect standard out during the test to avoid spamming the console with output
-			System.setOut(new PrintStream(NULL_OUTPUT_STREAM));
+			System.setOut(new PrintStream(NULL_OUTPUT_STREAM,true,LocaleUtil.CHARSET_1252.name()));
 
             FormulaViewer viewer = new FormulaViewer();
-            viewer.setFile(file.getAbsolutePath());
+            viewer.setFile(fileIn.getAbsolutePath());
             viewer.setList(true);
             viewer.run();
 		} finally {

Modified: poi/trunk/src/testcases/org/apache/poi/hssf/dev/TestReSave.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/hssf/dev/TestReSave.java?rev=1702356&r1=1702355&r2=1702356&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/hssf/dev/TestReSave.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/hssf/dev/TestReSave.java Fri Sep 11 00:56:16 2015
@@ -24,6 +24,7 @@ import java.util.ArrayList;
 import java.util.List;
 
 import org.apache.poi.POIDataSamples;
+import org.apache.poi.util.LocaleUtil;
 
 public class TestReSave extends BaseXLSIteratingTest {
 	static {
@@ -36,20 +37,20 @@ public class TestReSave extends BaseXLSI
 	}
 	
 	@Override
-	void runOneFile(File file) throws Exception {
+	void runOneFile(File fileIn) throws Exception {
 		// avoid running on files leftover from previous failed runs
-		if(file.getName().endsWith("-saved.xls")) {
+		if(fileIn.getName().endsWith("-saved.xls")) {
 			return;
 		}
 
 		PrintStream save = System.out;
 		try {
 			// redirect standard out during the test to avoid spamming the console with output
-			System.setOut(new PrintStream(NULL_OUTPUT_STREAM));
+			System.setOut(new PrintStream(NULL_OUTPUT_STREAM,true,LocaleUtil.CHARSET_1252.name()));
 
-			File reSavedFile = new File(file.getParentFile(), file.getName().replace(".xls", "-saved.xls"));
+			File reSavedFile = new File(fileIn.getParentFile(), fileIn.getName().replace(".xls", "-saved.xls"));
 			try {
-				ReSave.main(new String[] { file.getAbsolutePath() });
+				ReSave.main(new String[] { fileIn.getAbsolutePath() });
 				
 				// also try BiffViewer on the saved file
                 new TestBiffViewer().runOneFile(reSavedFile);
@@ -59,7 +60,7 @@ public class TestReSave extends BaseXLSI
         			ReSave.main(new String[] { reSavedFile.getAbsolutePath() });
     			} finally {
     				// clean up the re-re-saved file
-    			    new File(file.getParentFile(), reSavedFile.getName().replace(".xls", "-saved.xls")).delete();
+    			    new File(fileIn.getParentFile(), reSavedFile.getName().replace(".xls", "-saved.xls")).delete();
     			}
 			} finally {
 				// clean up the re-saved file

Modified: poi/trunk/src/testcases/org/apache/poi/hssf/dev/TestRecordLister.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/hssf/dev/TestRecordLister.java?rev=1702356&r1=1702355&r2=1702356&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/hssf/dev/TestRecordLister.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/hssf/dev/TestRecordLister.java Fri Sep 11 00:56:16 2015
@@ -20,6 +20,8 @@ import java.io.File;
 import java.io.IOException;
 import java.io.PrintStream;
 
+import org.apache.poi.util.LocaleUtil;
+
 public class TestRecordLister extends BaseXLSIteratingTest {
 	static {
 		// these are likely ok to fail
@@ -31,14 +33,14 @@ public class TestRecordLister extends Ba
 	}
 	
 	@Override
-	void runOneFile(File file) throws IOException {
+	void runOneFile(File fileIn) throws IOException {
 		PrintStream save = System.out;
 		try {
 			// redirect standard out during the test to avoid spamming the console with output
-			System.setOut(new PrintStream(NULL_OUTPUT_STREAM));
+			System.setOut(new PrintStream(NULL_OUTPUT_STREAM,true,LocaleUtil.CHARSET_1252.name()));
 
 			RecordLister viewer = new RecordLister();
-            viewer.setFile(file.getAbsolutePath());
+            viewer.setFile(fileIn.getAbsolutePath());
             viewer.run();
 		} finally {
 			System.setOut(save);

Modified: poi/trunk/src/testcases/org/apache/poi/hssf/extractor/TestOldExcelExtractor.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/hssf/extractor/TestOldExcelExtractor.java?rev=1702356&r1=1702355&r2=1702356&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/hssf/extractor/TestOldExcelExtractor.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/hssf/extractor/TestOldExcelExtractor.java Fri Sep 11 00:56:16 2015
@@ -17,27 +17,32 @@
 
 package org.apache.poi.hssf.extractor;
 
+import static org.apache.poi.POITestCase.assertContains;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
 import java.io.File;
-import java.io.InputStream;
 
-import org.apache.poi.POITestCase;
 import org.apache.poi.hssf.HSSFTestDataSamples;
+import org.junit.Test;
 
 /**
  * Unit tests for the Excel 5/95 and Excel 4 (and older) text 
  *  extractor
  */
-public final class TestOldExcelExtractor extends POITestCase {
+public final class TestOldExcelExtractor {
     private static OldExcelExtractor createExtractor(String sampleFileName) {
-        InputStream is = HSSFTestDataSamples.openSampleFileStream(sampleFileName);
+        File file = HSSFTestDataSamples.getSampleFile(sampleFileName);
 
         try {
-            return new OldExcelExtractor(is);
+            return new OldExcelExtractor(file);
         } catch (Exception e) {
             throw new RuntimeException(e);
         }
     }
     
+    @Test
     public void testSimpleExcel3() {
         OldExcelExtractor extractor = createExtractor("testEXCEL_3.xls");
 
@@ -59,6 +64,8 @@ public final class TestOldExcelExtractor
         assertEquals(3, extractor.getBiffVersion());
         assertEquals(0x10, extractor.getFileType());
     }
+    
+    @Test
     public void testSimpleExcel4() {
         OldExcelExtractor extractor = createExtractor("testEXCEL_4.xls");
 
@@ -77,6 +84,8 @@ public final class TestOldExcelExtractor
         assertEquals(4, extractor.getBiffVersion());
         assertEquals(0x10, extractor.getFileType());
     }
+    
+    @Test
     public void testSimpleExcel5() {
         for (String ver : new String[] {"5", "95"}) {
             OldExcelExtractor extractor = createExtractor("testEXCEL_"+ver+".xls");
@@ -101,6 +110,7 @@ public final class TestOldExcelExtractor
         }
     }
 
+    @Test
     public void testStrings() {
         OldExcelExtractor extractor = createExtractor("testEXCEL_4.xls");
         String text = extractor.getText();
@@ -119,6 +129,7 @@ public final class TestOldExcelExtractor
         // TODO Find some then test
     }
 
+    @Test
     public void testFormattedNumbersExcel4() {
         OldExcelExtractor extractor = createExtractor("testEXCEL_4.xls");
         String text = extractor.getText();
@@ -136,6 +147,8 @@ public final class TestOldExcelExtractor
 //      assertContains(text, "55,624");
 //      assertContains(text, "11,743,477");
     }
+    
+    @Test
     public void testFormattedNumbersExcel5() {
         for (String ver : new String[] {"5", "95"}) {
             OldExcelExtractor extractor = createExtractor("testEXCEL_"+ver+".xls");
@@ -160,6 +173,7 @@ public final class TestOldExcelExtractor
         }
     }
     
+    @Test
     public void testFromFile() throws Exception {
         for (String ver : new String[] {"4", "5", "95"}) {
             String filename = "testEXCEL_"+ver+".xls";

Modified: poi/trunk/src/testcases/org/apache/poi/hssf/model/AllModelTests.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/hssf/model/AllModelTests.java?rev=1702356&r1=1702355&r2=1702356&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/hssf/model/AllModelTests.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/hssf/model/AllModelTests.java Fri Sep 11 00:56:16 2015
@@ -17,30 +17,26 @@
 
 package org.apache.poi.hssf.model;
 
-import junit.framework.Test;
-import junit.framework.TestSuite;
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
 
 /**
  * Collects all tests for <tt>org.apache.poi.hssf.model</tt>.
- * 
- * @author Josh Micich
  */
+@RunWith(Suite.class)
+@Suite.SuiteClasses({
+    TestDrawingManager.class,
+    TestDrawingManager2.class,
+    TestFormulaParser.class,
+    TestFormulaParserEval.class,
+    TestFormulaParserIf.class,
+    TestLinkTable.class,
+    TestOperandClassTransformer.class,
+    TestRowBlocksReader.class,
+    TestRVA.class,
+    TestSheet.class,
+    TestSheetAdditional.class,
+    TestWorkbook.class
+})
 public final class AllModelTests {
-	
-	public static Test suite() {
-		TestSuite result = new TestSuite(AllModelTests.class.getName());
-		result.addTestSuite(TestDrawingManager.class);
-		result.addTestSuite(TestDrawingManager2.class);
-		result.addTestSuite(TestFormulaParser.class);
-		result.addTestSuite(TestFormulaParserEval.class);
-		result.addTestSuite(TestFormulaParserIf.class);
-		result.addTestSuite(TestLinkTable.class);
-		result.addTestSuite(TestOperandClassTransformer.class);
-		result.addTestSuite(TestRowBlocksReader.class);
-		result.addTestSuite(TestRVA.class);
-		result.addTestSuite(TestSheet.class);
-		result.addTestSuite(TestSheetAdditional.class);
-		result.addTestSuite(TestWorkbook.class);
-		return result;
-	}
 }

Modified: poi/trunk/src/testcases/org/apache/poi/hssf/model/TestRowBlocksReader.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/hssf/model/TestRowBlocksReader.java?rev=1702356&r1=1702355&r2=1702356&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/hssf/model/TestRowBlocksReader.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/hssf/model/TestRowBlocksReader.java Fri Sep 11 00:56:16 2015
@@ -17,10 +17,12 @@
 
 package org.apache.poi.hssf.model;
 
-import java.util.Arrays;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
 
-import junit.framework.AssertionFailedError;
-import junit.framework.TestCase;
+import java.util.Arrays;
 
 import org.apache.poi.hssf.record.NumberRecord;
 import org.apache.poi.hssf.record.Record;
@@ -28,27 +30,30 @@ import org.apache.poi.hssf.record.RowRec
 import org.apache.poi.hssf.record.UnknownRecord;
 import org.apache.poi.hssf.record.WindowTwoRecord;
 import org.apache.poi.hssf.record.pivottable.ViewDefinitionRecord;
+import org.apache.poi.util.LocaleUtil;
+import org.junit.Test;
 
 /**
  * Tests for {@link RowBlocksReader}
  *
  * @author Josh Micich
  */
-public final class TestRowBlocksReader extends TestCase {
+public final class TestRowBlocksReader {
+    @Test
 	public void testAbnormalPivotTableRecords_bug46280() {
 		int SXVIEW_SID = ViewDefinitionRecord.sid;
 		Record[] inRecs = {
 			new RowRecord(0),
 			new NumberRecord(),
 			// normally MSODRAWING(0x00EC) would come here before SXVIEW
-			new UnknownRecord(SXVIEW_SID, "dummydata (SXVIEW: View Definition)".getBytes()),
+			new UnknownRecord(SXVIEW_SID, "dummydata (SXVIEW: View Definition)".getBytes(LocaleUtil.CHARSET_1252)),
 			new WindowTwoRecord(),
 		};
 		RecordStream rs = new RecordStream(Arrays.asList(inRecs), 0);
 		RowBlocksReader rbr = new RowBlocksReader(rs);
 		if (rs.peekNextClass() == WindowTwoRecord.class) {
 			// Should have stopped at the SXVIEW record
-			throw new AssertionFailedError("Identified bug 46280b");
+			fail("Identified bug 46280b");
 		}
 		RecordStream rbStream = rbr.getPlainRecordStream();
 		assertEquals(inRecs[0], rbStream.getNext());

Modified: poi/trunk/src/testcases/org/apache/poi/hssf/record/TestSSTRecord.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/hssf/record/TestSSTRecord.java?rev=1702356&r1=1702355&r2=1702356&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/hssf/record/TestSSTRecord.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/hssf/record/TestSSTRecord.java Fri Sep 11 00:56:16 2015
@@ -18,6 +18,9 @@
 package org.apache.poi.hssf.record;
 
 import static org.junit.Assert.assertArrayEquals;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
 
 import java.io.BufferedReader;
 import java.io.ByteArrayInputStream;
@@ -28,21 +31,22 @@ import java.io.InputStreamReader;
 import java.util.Arrays;
 import java.util.Iterator;
 
-import junit.framework.AssertionFailedError;
-import junit.framework.TestCase;
-
 import org.apache.poi.hssf.HSSFTestDataSamples;
 import org.apache.poi.hssf.record.common.UnicodeString;
 import org.apache.poi.hssf.usermodel.HSSFSheet;
 import org.apache.poi.hssf.usermodel.HSSFWorkbook;
 import org.apache.poi.util.HexRead;
 import org.apache.poi.util.LittleEndian;
+import org.apache.poi.util.LocaleUtil;
+import org.junit.Test;
+
+import junit.framework.AssertionFailedError;
 
 /**
  * @author Marc Johnson (mjohnson at apache dot org)
  * @author Glen Stampoultzis (glens at apache.org)
  */
-public final class TestSSTRecord extends TestCase {
+public final class TestSSTRecord {
 
     /**
      * decodes hexdump files and concatenates the results
@@ -55,7 +59,7 @@ public final class TestSSTRecord extends
         for (int i = 0; i < nFiles; i++) {
             String sampleFileName = hexDumpFileNames[i];
             InputStream is = HSSFTestDataSamples.openSampleFileStream(sampleFileName);
-            BufferedReader br = new BufferedReader(new InputStreamReader(is));
+            BufferedReader br = new BufferedReader(new InputStreamReader(is, LocaleUtil.CHARSET_1252));
 
             while (true) {
                 String line = br.readLine();
@@ -86,6 +90,7 @@ public final class TestSSTRecord extends
      * SST is often split over several {@link ContinueRecord}s
      * @throws IOException 
      */
+    @Test
     public void testContinuedRecord() throws IOException {
         byte[] origData;
         SSTRecord record;
@@ -109,20 +114,20 @@ public final class TestSSTRecord extends
         assertEquals( 5249, record.getNumUniqueStrings() );
         assertEquals( 5249, record.countStrings() );
         ser_output = record.serialize();
-        if (false) { // set true to observe make sure areSameSSTs() is working
-            ser_output[11000] = 'X';
-        }
+//        if (false) { // set true to observe make sure areSameSSTs() is working
+//            ser_output[11000] = 'X';
+//        }
 
         SSTRecord rec2 = createSSTFromRawData(ser_output);
         if (!areSameSSTs(record, rec2)) {
             throw new AssertionFailedError("large SST re-serialized incorrectly");
         }
-        if (false) {
-            // TODO - trivial differences in ContinueRecord break locations
-            // Sample data should be checked against what most recent Excel version produces.
-            // maybe tweaks are required in ContinuableRecordOutput
-            assertArrayEquals(origData, ser_output);
-        }
+//        if (false) {
+//            // TODO - trivial differences in ContinueRecord break locations
+//            // Sample data should be checked against what most recent Excel version produces.
+//            // maybe tweaks are required in ContinuableRecordOutput
+//            assertArrayEquals(origData, ser_output);
+//        }
     }
 
     private boolean areSameSSTs(SSTRecord a, SSTRecord b) {
@@ -147,7 +152,7 @@ public final class TestSSTRecord extends
      *
      * @exception IOException
      */
-
+    @Test
     public void testHugeStrings() {
         SSTRecord record = new SSTRecord();
         byte[][] bstrings =
@@ -161,7 +166,7 @@ public final class TestSSTRecord extends
         for ( int k = 0; k < bstrings.length; k++ )
         {
             Arrays.fill( bstrings[k], (byte) ( 'a' + k ) );
-            strings[k] = new UnicodeString( new String(bstrings[k]) );
+            strings[k] = new UnicodeString( new String(bstrings[k], LocaleUtil.CHARSET_1252) );
             record.addString( strings[k] );
             total_length += 3 + bstrings[k].length;
         }
@@ -198,7 +203,7 @@ public final class TestSSTRecord extends
             if ( ( bstrings[k].length % 2 ) == 1 )
             {
                 Arrays.fill( bstrings[k], (byte) ( 'a' + k ) );
-                strings[k] = new UnicodeString( new String(bstrings[k]) );
+                strings[k] = new UnicodeString( new String(bstrings[k], LocaleUtil.CHARSET_1252) );
             }
             else
             {
@@ -230,6 +235,7 @@ public final class TestSSTRecord extends
     /**
      * test SSTRecord boundary conditions
      */
+    @Test
     public void testSSTRecordBug() {
         // create an SSTRecord and write a certain pattern of strings
         // to it ... then serialize it and verify the content
@@ -265,6 +271,7 @@ public final class TestSSTRecord extends
     /**
      * test simple addString
      */
+    @Test
     public void testSimpleAddString() {
         SSTRecord record = new SSTRecord();
         UnicodeString s1 = new UnicodeString("Hello world");
@@ -310,6 +317,7 @@ public final class TestSSTRecord extends
     /**
      * test simple constructor
      */
+    @Test
     public void testSimpleConstructor() {
         SSTRecord record = new SSTRecord();
 
@@ -334,13 +342,16 @@ public final class TestSSTRecord extends
     /**
      * Tests that workbooks with rich text that duplicates a non rich text cell can be read and written.
      */
-    public void testReadWriteDuplicatedRichText1() {
+    @Test
+    public void testReadWriteDuplicatedRichText1() throws Exception {
         HSSFWorkbook wb = HSSFTestDataSamples.openSampleWorkbook("duprich1.xls");
         HSSFSheet sheet = wb.getSheetAt( 1 );
         assertEquals( "01/05 (Wed)", sheet.getRow( 0 ).getCell(8 ).getStringCellValue() );
         assertEquals( "01/05 (Wed)", sheet.getRow( 1 ).getCell(8 ).getStringCellValue() );
 
-        HSSFTestDataSamples.writeOutAndReadBack(wb);
+        HSSFTestDataSamples.writeOutAndReadBack(wb).close();
+        
+        wb.close();
 
         // test the second file.
         wb = HSSFTestDataSamples.openSampleWorkbook("duprich2.xls");
@@ -353,7 +364,9 @@ public final class TestSSTRecord extends
         assertEquals( "Testing", sheet.getRow( row++ ).getCell(0 ).getStringCellValue() );
         assertEquals( "Testing", sheet.getRow( row++ ).getCell(0 ).getStringCellValue() );
 
-        HSSFTestDataSamples.writeOutAndReadBack(wb);
+        HSSFTestDataSamples.writeOutAndReadBack(wb).close();
+        
+        wb.close();
     }
 
     /**
@@ -1447,7 +1460,7 @@ public final class TestSSTRecord extends
     /**
      * deep comparison of two SST records
      */
-    public static void assertEquals(SSTRecord expected, SSTRecord actual){
+    private static void assertRecordEquals(SSTRecord expected, SSTRecord actual){
         assertEquals("number of strings", expected.getNumStrings(), actual.getNumStrings());
         assertEquals("number of unique strings", expected.getNumUniqueStrings(), actual.getNumUniqueStrings());
         assertEquals("count of strings", expected.countStrings(), actual.countStrings());
@@ -1458,8 +1471,8 @@ public final class TestSSTRecord extends
             assertTrue("String at idx=" + k, us1.equals(us2));
         }
     }
-
-
+    
+    @Test
     public void test50779_1(){
         byte[] bytes = HexRead.readFromString(data_50779_1);
 
@@ -1475,9 +1488,10 @@ public final class TestSSTRecord extends
         SSTRecord dst = new SSTRecord(in);
         assertEquals(81, dst.getNumStrings());
 
-        assertEquals(src, dst);
+        assertRecordEquals(src, dst);
     }
 
+    @Test
     public void test50779_2() {
         byte[] bytes = HexRead.readFromString(data_50779_2);
 
@@ -1493,9 +1507,10 @@ public final class TestSSTRecord extends
         SSTRecord dst = new SSTRecord(in);
         assertEquals(81, dst.getNumStrings());
 
-        assertEquals(src, dst);
+        assertRecordEquals(src, dst);
     }
 
+    @Test
     public void test57456() {
         byte[] bytes = HexRead.readFromString("FC, 00, 08, 00, 00, 00, 00, 00, E1, 06, 00, 00");
         RecordInputStream in = TestcaseRecordInputStream.create(bytes);

Modified: poi/trunk/src/testcases/org/apache/poi/hssf/record/aggregates/AllRecordAggregateTests.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/hssf/record/aggregates/AllRecordAggregateTests.java?rev=1702356&r1=1702355&r2=1702356&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/hssf/record/aggregates/AllRecordAggregateTests.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/hssf/record/aggregates/AllRecordAggregateTests.java Fri Sep 11 00:56:16 2015
@@ -17,26 +17,21 @@
 
 package org.apache.poi.hssf.record.aggregates;
 
-import junit.framework.Test;
-import junit.framework.TestSuite;
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
 
 /**
  * Collects all tests for package <tt>org.apache.poi.hssf.record.aggregates</tt>.
- * 
- * @author Josh Micich
  */
+@RunWith(Suite.class)
+@Suite.SuiteClasses({
+    TestCFRecordsAggregate.class,
+    TestColumnInfoRecordsAggregate.class,
+    TestFormulaRecordAggregate.class,
+    TestRowRecordsAggregate.class,
+    TestSharedValueManager.class,
+    TestValueRecordsAggregate.class,
+    TestPageSettingsBlock.class
+})
 public final class AllRecordAggregateTests {
-	
-	public static Test suite() {
-		TestSuite result = new TestSuite(AllRecordAggregateTests.class.getName());
-
-		result.addTestSuite(TestCFRecordsAggregate.class);
-		result.addTestSuite(TestColumnInfoRecordsAggregate.class);
-		result.addTestSuite(TestFormulaRecordAggregate.class);
-		result.addTestSuite(TestRowRecordsAggregate.class);
-		result.addTestSuite(TestSharedValueManager.class);
-		result.addTestSuite(TestValueRecordsAggregate.class);
-		result.addTestSuite(TestPageSettingsBlock.class);
-		return result;
-	}
 }

Modified: poi/trunk/src/testcases/org/apache/poi/hssf/record/aggregates/TestRowRecordsAggregate.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/hssf/record/aggregates/TestRowRecordsAggregate.java?rev=1702356&r1=1702355&r2=1702356&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/hssf/record/aggregates/TestRowRecordsAggregate.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/hssf/record/aggregates/TestRowRecordsAggregate.java Fri Sep 11 00:56:16 2015
@@ -17,14 +17,12 @@
 
 package org.apache.poi.hssf.record.aggregates;
 
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.OutputStream;
-import java.util.Arrays;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
 
-import junit.framework.AssertionFailedError;
-import junit.framework.TestCase;
+import java.util.Arrays;
 
 import org.apache.poi.hssf.HSSFTestDataSamples;
 import org.apache.poi.hssf.model.RecordStream;
@@ -42,12 +40,15 @@ import org.apache.poi.hssf.usermodel.HSS
 import org.apache.poi.hssf.usermodel.RecordInspector;
 import org.apache.poi.hssf.usermodel.RecordInspector.RecordCollector;
 import org.apache.poi.hssf.util.CellRangeAddress8Bit;
+import org.apache.poi.util.LocaleUtil;
+import org.junit.Test;
 
 /**
  * Tests for {@link RowRecordsAggregate}
  */
-public final class TestRowRecordsAggregate extends TestCase {
+public final class TestRowRecordsAggregate {
 
+    @Test
 	public void testRowGet() {
 		RowRecordsAggregate rra = new RowRecordsAggregate();
 		RowRecord rr = new RowRecord(4);
@@ -67,7 +68,8 @@ public final class TestRowRecordsAggrega
 	 * {@link SharedFormulaRecord}s, these records should appear immediately after the first
 	 * {@link FormulaRecord}s that they apply to (and only once).<br/>
 	 */
-	public void testArraysAndTables() {
+    @Test
+	public void testArraysAndTables() throws Exception {
 		HSSFWorkbook wb = HSSFTestDataSamples.openSampleWorkbook("testArraysAndTables.xls");
 		Record[] sheetRecs = RecordInspector.getRecords(wb.getSheetAt(0), 0);
 
@@ -82,20 +84,22 @@ public final class TestRowRecordsAggrega
 		assertEquals(0, countSharedFormulas);
 
 
-		if (false) { // set true to observe re-serialized file
-			File f = new File(System.getProperty("java.io.tmpdir") + "/testArraysAndTables-out.xls");
-			try {
-				OutputStream os = new FileOutputStream(f);
-				wb.write(os);
-				os.close();
-			} catch (IOException e) {
-				throw new RuntimeException(e);
-			}
-			System.out.println("Output file to " + f.getAbsolutePath());
-		}
+//		if (false) { // set true to observe re-serialized file
+//			File f = new File(System.getProperty("java.io.tmpdir") + "/testArraysAndTables-out.xls");
+//			try {
+//				OutputStream os = new FileOutputStream(f);
+//				wb.write(os);
+//				os.close();
+//			} catch (IOException e) {
+//				throw new RuntimeException(e);
+//			}
+//			System.out.println("Output file to " + f.getAbsolutePath());
+//		}
+		
+		wb.close();
 	}
 
-	private static int verifySharedValues(Record[] recs, Class shfClass) {
+	private static int verifySharedValues(Record[] recs, Class<? extends SharedValueRecordBase> shfClass) {
 
 		int result =0;
 		for(int i=0; i<recs.length; i++) {
@@ -104,7 +108,7 @@ public final class TestRowRecordsAggrega
 				result++;
 				Record prevRec = recs[i-1];
 				if (!(prevRec instanceof FormulaRecord)) {
-					throw new AssertionFailedError("Bad record order at index "
+					fail("Bad record order at index "
 							+ i + ": Formula record expected but got ("
 							+ prevRec.getClass().getName() + ")");
 				}
@@ -130,12 +134,13 @@ public final class TestRowRecordsAggrega
 	 * This fix in {@link RowRecordsAggregate} was implemented anyway since any {@link
 	 * UnknownRecord} has the potential of being 'continued'.
 	 */
+	@Test
 	public void testUnknownContinue_bug46280() {
 		Record[] inRecs = {
 			new RowRecord(0),
 			new NumberRecord(),
-			new UnknownRecord(0x5555, "dummydata".getBytes()),
-			new ContinueRecord("moredummydata".getBytes()),
+			new UnknownRecord(0x5555, "dummydata".getBytes(LocaleUtil.CHARSET_1252)),
+			new ContinueRecord("moredummydata".getBytes(LocaleUtil.CHARSET_1252)),
 		};
 		RecordStream rs = new RecordStream(Arrays.asList(inRecs), 0);
 		RowRecordsAggregate rra;
@@ -143,7 +148,7 @@ public final class TestRowRecordsAggrega
 			rra = new RowRecordsAggregate(rs, SharedValueManager.createEmpty());
 		} catch (RuntimeException e) {
 			if (e.getMessage().startsWith("Unexpected record type")) {
-				throw new AssertionFailedError("Identified bug 46280a");
+				fail("Identified bug 46280a");
 			}
 			throw e;
 		}

Modified: poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestOLE2Embeding.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestOLE2Embeding.java?rev=1702356&r1=1702355&r2=1702356&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestOLE2Embeding.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestOLE2Embeding.java Fri Sep 11 00:56:16 2015
@@ -18,16 +18,14 @@
 package org.apache.poi.hssf.usermodel;
 
 import static org.junit.Assert.assertArrayEquals;
+import static org.junit.Assert.assertEquals;
 
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
-import java.io.FileOutputStream;
 import java.io.IOException;
 import java.io.InputStream;
 import java.util.List;
 
-import junit.framework.TestCase;
-
 import org.apache.poi.POIDataSamples;
 import org.apache.poi.hssf.HSSFTestDataSamples;
 import org.apache.poi.poifs.filesystem.DirectoryNode;
@@ -35,52 +33,59 @@ import org.apache.poi.poifs.filesystem.O
 import org.apache.poi.poifs.filesystem.POIFSFileSystem;
 import org.apache.poi.ss.usermodel.ClientAnchor;
 import org.apache.poi.ss.usermodel.CreationHelper;
+import org.apache.poi.util.LocaleUtil;
+import org.junit.Test;
 
 /**
  * 
  */
-public final class TestOLE2Embeding extends TestCase {
+public final class TestOLE2Embeding {
 
-    public void testEmbeding() {
+    @Test
+    public void testEmbeding() throws Exception {
         // This used to break, until bug #43116 was fixed
         HSSFWorkbook workbook = HSSFTestDataSamples.openSampleWorkbook("ole2-embedding.xls");
 
         // Check we can get at the Escher layer still
         workbook.getAllPictures();
+        
+        workbook.close();
     }
 
+    @Test
     public void testEmbeddedObjects() throws Exception {
         HSSFWorkbook workbook = HSSFTestDataSamples.openSampleWorkbook("ole2-embedding.xls");
 
         List<HSSFObjectData> objects = workbook.getAllEmbeddedObjects();
         assertEquals("Wrong number of objects", 2, objects.size());
         assertEquals("Wrong name for first object", "MBD06CAB431",
-                ((HSSFObjectData)
-                objects.get(0)).getDirectory().getName());
+                objects.get(0).getDirectory().getName());
         assertEquals("Wrong name for second object", "MBD06CAC85A",
-                ((HSSFObjectData)
-                objects.get(1)).getDirectory().getName());
+                objects.get(1).getDirectory().getName());
+        
+        workbook.close();
     }
     
+    @Test
     public void testReallyEmbedSomething() throws Exception {
-    	HSSFWorkbook wb = new HSSFWorkbook();
-    	HSSFSheet sheet = wb.createSheet();
+    	HSSFWorkbook wb1 = new HSSFWorkbook();
+    	HSSFSheet sheet = wb1.createSheet();
     	HSSFPatriarch patriarch = sheet.createDrawingPatriarch();
 
     	byte[] pictureData = HSSFTestDataSamples.getTestDataFileContent("logoKarmokar4.png");
     	byte[] picturePPT = POIDataSamples.getSlideShowInstance().readFile("clock.jpg");
-    	int imgIdx = wb.addPicture(pictureData, HSSFWorkbook.PICTURE_TYPE_PNG);
+    	int imgIdx = wb1.addPicture(pictureData, HSSFWorkbook.PICTURE_TYPE_PNG);
     	POIFSFileSystem pptPoifs = getSamplePPT();
-    	int pptIdx = wb.addOlePackage(pptPoifs, "Sample-PPT", "sample.ppt", "sample.ppt");
+    	int pptIdx = wb1.addOlePackage(pptPoifs, "Sample-PPT", "sample.ppt", "sample.ppt");
     	POIFSFileSystem xlsPoifs = getSampleXLS();
-    	int imgPPT = wb.addPicture(picturePPT, HSSFWorkbook.PICTURE_TYPE_JPEG);
-    	int xlsIdx = wb.addOlePackage(xlsPoifs, "Sample-XLS", "sample.xls", "sample.xls");
-    	int txtIdx = wb.addOlePackage(getSampleTXT(), "Sample-TXT", "sample.txt", "sample.txt");
+    	int imgPPT = wb1.addPicture(picturePPT, HSSFWorkbook.PICTURE_TYPE_JPEG);
+    	int xlsIdx = wb1.addOlePackage(xlsPoifs, "Sample-XLS", "sample.xls", "sample.xls");
+    	int txtIdx = wb1.addOlePackage(getSampleTXT(), "Sample-TXT", "sample.txt", "sample.txt");
     	
         int rowoffset = 5;
         int coloffset = 5;
 
-        CreationHelper ch = wb.getCreationHelper();
+        CreationHelper ch = wb1.getCreationHelper();
         HSSFClientAnchor anchor = (HSSFClientAnchor)ch.createClientAnchor();
         anchor.setAnchor((short)(2+coloffset), 1+rowoffset, 0, 0, (short)(3+coloffset), 5+rowoffset, 0, 0);
         anchor.setAnchorType(ClientAnchor.DONT_MOVE_AND_RESIZE);
@@ -107,31 +112,35 @@ public final class TestOLE2Embeding exte
         circle.setShapeType(HSSFSimpleShape.OBJECT_TYPE_OVAL);
         circle.setNoFill(true);
 
-        if (false) {
-	        FileOutputStream fos = new FileOutputStream("embed.xls");
-	        wb.write(fos);
-	        fos.close();
-        }
+//        if (false) {
+//	        FileOutputStream fos = new FileOutputStream("embed.xls");
+//	        wb.write(fos);
+//	        fos.close();
+//        }
         
-        wb = HSSFTestDataSamples.writeOutAndReadBack(wb);
+        HSSFWorkbook wb2 = HSSFTestDataSamples.writeOutAndReadBack(wb1);
+        wb1.close();
         
         ByteArrayOutputStream bos = new ByteArrayOutputStream();
-        HSSFObjectData od = wb.getAllEmbeddedObjects().get(0);
+        HSSFObjectData od = wb2.getAllEmbeddedObjects().get(0);
         Ole10Native ole10 = Ole10Native.createFromEmbeddedOleObject((DirectoryNode)od.getDirectory());
         bos.reset();
         pptPoifs.writeFilesystem(bos);
         assertArrayEquals(ole10.getDataBuffer(), bos.toByteArray());
 
-        od = wb.getAllEmbeddedObjects().get(1);
+        od = wb2.getAllEmbeddedObjects().get(1);
         ole10 = Ole10Native.createFromEmbeddedOleObject((DirectoryNode)od.getDirectory());
         bos.reset();
         xlsPoifs.writeFilesystem(bos);
         assertArrayEquals(ole10.getDataBuffer(), bos.toByteArray());
 
-        od = wb.getAllEmbeddedObjects().get(2);
+        od = wb2.getAllEmbeddedObjects().get(2);
         ole10 = Ole10Native.createFromEmbeddedOleObject((DirectoryNode)od.getDirectory());
         assertArrayEquals(ole10.getDataBuffer(), getSampleTXT());
     
+        xlsPoifs.close();
+        pptPoifs.close();
+        wb2.close();
     }
     
     static POIFSFileSystem getSamplePPT() throws IOException {
@@ -150,12 +159,13 @@ public final class TestOLE2Embeding exte
 
     	ByteArrayOutputStream bos = new ByteArrayOutputStream();
     	wb.write(bos);
+    	wb.close();
     	POIFSFileSystem poifs = new POIFSFileSystem(new ByteArrayInputStream(bos.toByteArray()));
         
         return poifs;
     }
     
     static byte[] getSampleTXT() {
-        return "All your base are belong to us".getBytes();
+        return "All your base are belong to us".getBytes(LocaleUtil.CHARSET_1252);
     }    
 }
\ No newline at end of file

Modified: poi/trunk/src/testcases/org/apache/poi/poifs/filesystem/TestNPOIFSMiniStore.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/poifs/filesystem/TestNPOIFSMiniStore.java?rev=1702356&r1=1702355&r2=1702356&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/poifs/filesystem/TestNPOIFSMiniStore.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/poifs/filesystem/TestNPOIFSMiniStore.java Fri Sep 11 00:56:16 2015
@@ -17,25 +17,30 @@
 
 package org.apache.poi.poifs.filesystem;
 
+import static org.junit.Assert.assertArrayEquals;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+
 import java.io.ByteArrayInputStream;
 import java.nio.ByteBuffer;
 import java.util.Iterator;
 
 import org.apache.poi.POIDataSamples;
-import org.apache.poi.POITestCase;
 import org.apache.poi.poifs.common.POIFSConstants;
 import org.apache.poi.util.IOUtils;
+import org.junit.Test;
 
 /**
  * Tests for the Mini Store in the NIO POIFS
  */
-public final class TestNPOIFSMiniStore extends POITestCase {
+public final class TestNPOIFSMiniStore {
    private static final POIDataSamples _inst = POIDataSamples.getPOIFSInstance();
    
    /**
     * Check that for a given mini block, we can correctly figure
     *  out what the next one is
     */
+   @Test
    public void testNextBlock() throws Exception {
       // It's the same on 512 byte and 4096 byte block files!
       NPOIFSFileSystem fsA = new NPOIFSFileSystem(_inst.getFile("BlockSize512.zvi"));
@@ -103,14 +108,17 @@ public final class TestNPOIFSMiniStore e
          for(int i=181; i<fs.getBigBlockSizeDetails().getBATEntriesPerBlock(); i++) {
             assertEquals(POIFSConstants.UNUSED_BLOCK, ministore.getNextBlock(i));
          }
-         
-         fs.close();
       }
+      fsD.close();
+      fsC.close();
+      fsB.close();
+      fsA.close();
    }
 
    /**
     * Check we get the right data back for each block
     */
+   @Test
    public void testGetBlock() throws Exception {
       // It's the same on 512 byte and 4096 byte block files!
       NPOIFSFileSystem fsA = new NPOIFSFileSystem(_inst.getFile("BlockSize512.zvi"));
@@ -170,15 +178,18 @@ public final class TestNPOIFSMiniStore e
             assertEquals((byte)0, b.get());
             assertEquals((byte)0, b.get());
          }
-         
-         fs.close();
       }
+      fsD.close();
+      fsC.close();
+      fsB.close();
+      fsA.close();
    }
    
    /**
     * Ask for free blocks where there are some already
     *  to be had from the SFAT
     */
+   @Test
    public void testGetFreeBlockWithSpare() throws Exception {
       NPOIFSFileSystem fs = new NPOIFSFileSystem(_inst.getFile("BlockSize512.zvi"));
       NPOIFSMiniStore ministore = fs.getMiniStore();
@@ -210,6 +221,7 @@ public final class TestNPOIFSMiniStore e
     * Ask for free blocks where no free ones exist, and so the
     *  stream needs to be extended and another SBAT added
     */
+   @Test
    public void testGetFreeBlockWithNoneSpare() throws Exception {
       NPOIFSFileSystem fs = new NPOIFSFileSystem(_inst.openResourceAsStream("BlockSize512.zvi"));
       NPOIFSMiniStore ministore = fs.getMiniStore();
@@ -254,6 +266,7 @@ public final class TestNPOIFSMiniStore e
     * Test that we will extend the underlying chain of 
     *  big blocks that make up the ministream as needed
     */
+   @Test
    public void testCreateBlockIfNeeded() throws Exception {
       NPOIFSFileSystem fs = new NPOIFSFileSystem(_inst.openResourceAsStream("BlockSize512.zvi"));
       NPOIFSMiniStore ministore = fs.getMiniStore();
@@ -334,6 +347,7 @@ public final class TestNPOIFSMiniStore e
       fs.close();
    }
    
+   @Test
    public void testCreateMiniStoreFirst() throws Exception {
        NPOIFSFileSystem fs = new NPOIFSFileSystem();
        NPOIFSMiniStore ministore = fs.getMiniStore();
@@ -385,7 +399,7 @@ public final class TestNPOIFSMiniStore e
        byte[] rdata = new byte[data.length];
        dis = new DocumentInputStream(entry);
        IOUtils.readFully(dis, rdata);
-       assertEquals(data, rdata);
+       assertArrayEquals(data, rdata);
        dis.close();
        
        entry = (DocumentEntry)fs.getRoot().getEntry("mini2");
@@ -393,13 +407,14 @@ public final class TestNPOIFSMiniStore e
        rdata = new byte[data.length];
        dis = new DocumentInputStream(entry);
        IOUtils.readFully(dis, rdata);
-       assertEquals(data, rdata);
+       assertArrayEquals(data, rdata);
        dis.close();
 
        // Done
        fs.close();
    }
    
+   @Test
    public void testMultiBlockStream() throws Exception {
        byte[] data1B = new byte[63];
        byte[] data2B = new byte[64+14];
@@ -451,12 +466,13 @@ public final class TestNPOIFSMiniStore e
        DocumentInputStream dis = fs.createDocumentInputStream("mini1");
        IOUtils.readFully(dis, r1);
        dis.close();
-       assertEquals(data1B, r1);
+       assertArrayEquals(data1B, r1);
        
        byte[] r2 = new byte[data2B.length];
        dis = fs.createDocumentInputStream("mini2");
        IOUtils.readFully(dis, r2);
        dis.close();
-       assertEquals(data2B, r2);
+       assertArrayEquals(data2B, r2);
+       fs.close();
    }
 }

Modified: poi/trunk/src/testcases/org/apache/poi/poifs/property/AllPOIFSPropertyTests.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/poifs/property/AllPOIFSPropertyTests.java?rev=1702356&r1=1702355&r2=1702356&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/poifs/property/AllPOIFSPropertyTests.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/poifs/property/AllPOIFSPropertyTests.java Fri Sep 11 00:56:16 2015
@@ -17,23 +17,19 @@
 
 package org.apache.poi.poifs.property;
 
-import junit.framework.Test;
-import junit.framework.TestSuite;
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
 
 /**
  * Tests for org.apache.poi.poifs.property<br/>
- * 
- * @author Josh Micich
  */
+@RunWith(Suite.class)
+@Suite.SuiteClasses({
+    TestDirectoryProperty.class,
+    TestDocumentProperty.class,
+    TestPropertyFactory.class,
+    TestPropertyTable.class,
+    TestRootProperty.class
+})
 public final class AllPOIFSPropertyTests {
-
-    public static Test suite() {
-        TestSuite result = new TestSuite(AllPOIFSPropertyTests.class.getName());
-        result.addTestSuite(TestDirectoryProperty.class);
-        result.addTestSuite(TestDocumentProperty.class);
-        result.addTestSuite(TestPropertyFactory.class);
-        result.addTestSuite(TestPropertyTable.class);
-        result.addTestSuite(TestRootProperty.class);
-        return result;
-    }
 }

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=1702356&r1=1702355&r2=1702356&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 Sep 11 00:56:16 2015
@@ -17,6 +17,10 @@
 
 package org.apache.poi.poifs.property;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
 import java.io.ByteArrayOutputStream;
 import java.io.IOException;
 import java.util.ArrayList;
@@ -25,21 +29,20 @@ import java.util.Iterator;
 import java.util.List;
 
 import org.apache.poi.poifs.storage.RawDataUtil;
-
-import junit.framework.TestCase;
+import org.apache.poi.util.LocaleUtil;
+import org.junit.Test;
 
 /**
  * Class to test DirectoryProperty functionality
- *
- * @author Marc Johnson
  */
-public final class TestDirectoryProperty extends TestCase {
+public final class TestDirectoryProperty {
     private DirectoryProperty _property;
     private byte[]            _testblock;
 
     /**
      * Test constructing DirectoryProperty
      */
+    @Test
     public void testConstructor() throws IOException {
         createBasicDirectoryProperty();
         verifyProperty();
@@ -48,6 +51,7 @@ public final class TestDirectoryProperty
     /**
      * Test pre-write functionality
      */
+    @Test
     public void testPreWrite() throws IOException {
         createBasicDirectoryProperty();
         _property.preWrite();
@@ -97,8 +101,8 @@ public final class TestDirectoryProperty
     }
 
     private void verifyChildren(int count) {
-        Iterator iter     = _property.getChildren();
-        List     children = new ArrayList();
+        Iterator<Property> iter = _property.getChildren();
+        List<Property> children = new ArrayList<Property>();
 
         while (iter.hasNext())
         {
@@ -116,7 +120,7 @@ public final class TestDirectoryProperty
             iter = children.iterator();
             while (iter.hasNext())
             {
-                Property child = ( Property ) iter.next();
+                Property child = iter.next();
                 Child    next  = child.getNextChild();
 
                 if (next != null)
@@ -175,7 +179,7 @@ public final class TestDirectoryProperty
         {
             _testblock[ index ] = ( byte ) 0;
         }
-        byte[] name_bytes = name.getBytes();
+        byte[] name_bytes = name.getBytes(LocaleUtil.CHARSET_1252);
 
         for (index = 0; index < limit; index++)
         {
@@ -197,6 +201,7 @@ public final class TestDirectoryProperty
         }
     }
 
+    @Test
     public void testAddChild() throws IOException {
         createBasicDirectoryProperty();
         _property.addChild(new LocalProperty(1));
@@ -224,6 +229,7 @@ public final class TestDirectoryProperty
         _property.addChild(new LocalProperty(3));
     }
 
+    @Test
     public void testDeleteChild() throws IOException {
         createBasicDirectoryProperty();
         Property p1 = new LocalProperty(1);
@@ -244,6 +250,7 @@ public final class TestDirectoryProperty
         _property.addChild(new LocalProperty(1));
     }
 
+    @Test
     public void testChangeName() throws IOException {
         createBasicDirectoryProperty();
         Property p1           = new LocalProperty(1);
@@ -262,6 +269,7 @@ public final class TestDirectoryProperty
         assertTrue(_property.changeName(p1, originalName));
     }
 
+    @Test
     public void testReadingConstructor() {
         String[] input = {
             "42 00 6F 00 6F 00 74 00 20 00 45 00 6E 00 74 00 72 00 79 00 00 00 00 00 00 00 00 00 00 00 00 00",

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=1702356&r1=1702355&r2=1702356&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 Sep 11 00:56:16 2015
@@ -21,6 +21,7 @@ import java.io.ByteArrayOutputStream;
 import java.io.IOException;
 
 import org.apache.poi.poifs.storage.RawDataUtil;
+import org.apache.poi.util.LocaleUtil;
 
 import junit.framework.TestCase;
 
@@ -137,7 +138,7 @@ public final class TestDocumentProperty
         {
             testblock[ index ] = ( byte ) 0x0;
         }
-        byte[] name_bytes = name.getBytes();
+        byte[] name_bytes = name.getBytes(LocaleUtil.CHARSET_1252);
 
         for (index = 0; index < limit; index++)
         {

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=1702356&r1=1702355&r2=1702356&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 Sep 11 00:56:16 2015
@@ -17,23 +17,27 @@
 
 package org.apache.poi.poifs.property;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
 import java.io.ByteArrayOutputStream;
 import java.io.IOException;
 
-import junit.framework.TestCase;
-
 import org.apache.poi.poifs.common.POIFSConstants;
 import org.apache.poi.poifs.storage.RawDataUtil;
+import org.apache.poi.util.LocaleUtil;
+import org.junit.Test;
 
 /**
  * Class to test RootProperty functionality
  *
  * @author Marc Johnson
  */
-public final class TestRootProperty extends TestCase {
+public final class TestRootProperty {
 	private RootProperty _property;
 	private byte[] _testblock;
 
+	@Test
 	public void testConstructor() throws IOException {
 		createBasicRootProperty();
 		verifyProperty();
@@ -67,7 +71,7 @@ public final class TestRootProperty exte
 		for (; index < 0x80; index++) {
 			_testblock[index] = (byte) 0;
 		}
-		byte[] name_bytes = name.getBytes();
+		byte[] name_bytes = name.getBytes(LocaleUtil.CHARSET_1252);
 
 		for (index = 0; index < limit; index++) {
 			_testblock[index * 2] = name_bytes[index];
@@ -86,6 +90,7 @@ public final class TestRootProperty exte
 		}
 	}
 
+	@Test
 	public void testSetSize() {
 		for (int j = 0; j < 10; j++) {
 			createBasicRootProperty();
@@ -94,6 +99,7 @@ public final class TestRootProperty exte
 		}
 	}
 
+	@Test
 	public void testReadingConstructor() {
 		String[] input = {
 			"52 00 6F 00 6F 00 74 00 20 00 45 00 6E 00 74 00 72 00 79 00 00 00 00 00 00 00 00 00 00 00 00 00",



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