diff options
author | Andreas Beeker <kiwiwings@apache.org> | 2015-09-11 00:56:16 +0000 |
---|---|---|
committer | Andreas Beeker <kiwiwings@apache.org> | 2015-09-11 00:56:16 +0000 |
commit | 17d8c71a657e79b204fe0675edfab305251b0e4f (patch) | |
tree | b210dd2aa1f73c788e4e3d646b64dce16cddd584 /src/testcases/org/apache/poi/hssf/dev | |
parent | 9f26731f44ba4eccabdb82f0a23f91eb755787fc (diff) | |
download | poi-17d8c71a657e79b204fe0675edfab305251b0e4f.tar.gz poi-17d8c71a657e79b204fe0675edfab305251b0e4f.zip |
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
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1702356 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/testcases/org/apache/poi/hssf/dev')
5 files changed, 29 insertions, 20 deletions
diff --git a/src/testcases/org/apache/poi/hssf/dev/TestBiffViewer.java b/src/testcases/org/apache/poi/hssf/dev/TestBiffViewer.java index c96aec4f7f..0463162daf 100644 --- a/src/testcases/org/apache/poi/hssf/dev/TestBiffViewer.java +++ b/src/testcases/org/apache/poi/hssf/dev/TestBiffViewer.java @@ -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 BaseXLSIteratingTest { } @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(); diff --git a/src/testcases/org/apache/poi/hssf/dev/TestEFBiffViewer.java b/src/testcases/org/apache/poi/hssf/dev/TestEFBiffViewer.java index 32eaa924f4..0763a55875 100644 --- a/src/testcases/org/apache/poi/hssf/dev/TestEFBiffViewer.java +++ b/src/testcases/org/apache/poi/hssf/dev/TestEFBiffViewer.java @@ -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 BaseXLSIteratingTest { } @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); } diff --git a/src/testcases/org/apache/poi/hssf/dev/TestFormulaViewer.java b/src/testcases/org/apache/poi/hssf/dev/TestFormulaViewer.java index b6014376c5..1b2ef67e2c 100644 --- a/src/testcases/org/apache/poi/hssf/dev/TestFormulaViewer.java +++ b/src/testcases/org/apache/poi/hssf/dev/TestFormulaViewer.java @@ -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 BaseXLSIteratingTest { 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 { diff --git a/src/testcases/org/apache/poi/hssf/dev/TestReSave.java b/src/testcases/org/apache/poi/hssf/dev/TestReSave.java index e26bffea3a..d858f881eb 100644 --- a/src/testcases/org/apache/poi/hssf/dev/TestReSave.java +++ b/src/testcases/org/apache/poi/hssf/dev/TestReSave.java @@ -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 BaseXLSIteratingTest { } @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 BaseXLSIteratingTest { 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 diff --git a/src/testcases/org/apache/poi/hssf/dev/TestRecordLister.java b/src/testcases/org/apache/poi/hssf/dev/TestRecordLister.java index 4c0ad1add0..7f53793043 100644 --- a/src/testcases/org/apache/poi/hssf/dev/TestRecordLister.java +++ b/src/testcases/org/apache/poi/hssf/dev/TestRecordLister.java @@ -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 BaseXLSIteratingTest { } @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); |