]> source.dussan.org Git - poi.git/commitdiff
60805 (partial) -- remove/suppress println in tests
authorTim Allison <tallison@apache.org>
Tue, 19 Sep 2017 15:52:21 +0000 (15:52 +0000)
committerTim Allison <tallison@apache.org>
Tue, 19 Sep 2017 15:52:21 +0000 (15:52 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1808903 13f79535-47bb-0310-9956-ffa450edef68

22 files changed:
src/ooxml/testcases/org/apache/poi/dev/TestOOXMLLister.java
src/ooxml/testcases/org/apache/poi/dev/TestOOXMLPrettyPrint.java
src/ooxml/testcases/org/apache/poi/extractor/TestExtractorFactory.java
src/ooxml/testcases/org/apache/poi/ss/formula/functions/TestProper.java
src/ooxml/testcases/org/apache/poi/xssf/model/TestCommentsTable.java
src/ooxml/testcases/org/apache/poi/xssf/streaming/TestAutoSizeColumnTracker.java
src/ooxml/testcases/org/apache/poi/xssf/streaming/TestSXSSFWorkbook.java
src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestMatrixFormulasFromXMLSpreadsheet.java
src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestUnfixedBugs.java
src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFBugs.java
src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFSheet.java
src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFSheetMergeRegions.java
src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFPictureData.java
src/testcases/org/apache/poi/hpsf/extractor/TestHPSFPropertiesExtractor.java
src/testcases/org/apache/poi/hssf/usermodel/TestMatrixFormulasFromBinarySpreadsheet.java
src/testcases/org/apache/poi/poifs/dev/TestPOIFSDump.java
src/testcases/org/apache/poi/sl/draw/geom/TestPresetGeometries.java
src/testcases/org/apache/poi/ss/usermodel/BaseTestBugzillaIssues.java
src/testcases/org/apache/poi/ss/util/BaseTestCellUtil.java
src/testcases/org/apache/poi/ss/util/TestDateFormatConverter.java
src/testcases/org/apache/poi/util/TestHexDump.java
src/testcases/org/apache/poi/util/TestLittleEndianCP950Reader.java

index cb883c8765d2de9d74dd084dfb603db95278301d..3adaa2a954d6f884b0ea8f5a601fe9a1499a20f7 100644 (file)
@@ -22,6 +22,7 @@ package org.apache.poi.dev;
 
 import java.io.File;
 import java.io.IOException;
+import java.io.OutputStream;
 import java.io.PrintStream;
 
 import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
@@ -29,9 +30,29 @@ import org.apache.poi.openxml4j.opc.OPCPackage;
 import org.apache.poi.openxml4j.opc.PackageAccess;
 import org.apache.poi.util.NullOutputStream;
 import org.apache.poi.xssf.XSSFTestDataSamples;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
 import org.junit.Test;
 
 public class TestOOXMLLister {
+    private static PrintStream SYSTEM_OUT;
+
+    @BeforeClass
+    public static void setUp() {
+        SYSTEM_OUT = System.out;
+        System.setOut(new PrintStream(new OutputStream() {
+            @Override
+            public void write(int b) throws IOException {
+
+            }
+        }));
+    }
+
+    @AfterClass
+    public static void tearDown() {
+        System.setOut(SYSTEM_OUT);
+    }
+
     @Test
     public void testMain() throws IOException, InvalidFormatException {
         File file = XSSFTestDataSamples.getSampleFile("Formatting.xlsx");
index edc0bdd7d7445d56fb9f94195621ec154014e0e4..261a1575c173378e2e7a8692dcef2194d316e73d 100644 (file)
@@ -22,14 +22,38 @@ package org.apache.poi.dev;
 
 import org.apache.poi.util.TempFile;
 import org.apache.poi.xssf.XSSFTestDataSamples;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
 import org.junit.Test;
 
 import java.io.File;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.PrintStream;
 
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
 
 public class TestOOXMLPrettyPrint {
+
+    private static PrintStream SYSTEM_OUT;
+
+    @BeforeClass
+    public static void setUp() {
+        SYSTEM_OUT = System.out;
+        System.setOut(new PrintStream(new OutputStream() {
+            @Override
+            public void write(int b) throws IOException {
+
+            }
+        }));
+    }
+
+    @AfterClass
+    public static void tearDown() {
+        System.setOut(SYSTEM_OUT);
+    }
+
     @Test
     public void testMain() throws Exception {
         File file = XSSFTestDataSamples.getSampleFile("Formatting.xlsx");
index ec0b14b1e38d1de046d108366d9985696d391c16..dfae641070dd529f465e1d45790e4f696f6563c0 100644 (file)
@@ -49,10 +49,13 @@ import org.apache.poi.openxml4j.opc.PackageAccess;
 import org.apache.poi.poifs.filesystem.OPOIFSFileSystem;
 import org.apache.poi.poifs.filesystem.POIFSFileSystem;
 import org.apache.poi.util.IOUtils;
+import org.apache.poi.util.POILogFactory;
+import org.apache.poi.util.POILogger;
 import org.apache.poi.xdgf.extractor.XDGFVisioExtractor;
 import org.apache.poi.xslf.extractor.XSLFPowerPointExtractor;
 import org.apache.poi.xssf.extractor.XSSFEventBasedExcelExtractor;
 import org.apache.poi.xssf.extractor.XSSFExcelExtractor;
+import org.apache.poi.xssf.usermodel.TestMatrixFormulasFromXMLSpreadsheet;
 import org.apache.poi.xwpf.extractor.XWPFWordExtractor;
 import org.junit.BeforeClass;
 import org.junit.Test;
@@ -61,6 +64,9 @@ import org.junit.Test;
  * Test that the extractor factory plays nicely
  */
 public class TestExtractorFactory {
+
+    private static final POILogger LOG = POILogFactory.getLogger(TestExtractorFactory.class);
+
     private static File txt;
 
     private static File xls;
@@ -691,7 +697,7 @@ public class TestExtractorFactory {
         } catch(UnsupportedFileFormatException e) {
             // Good
         } catch (Exception e) {
-            System.out.println("TestExtractorFactory.testPackage() failed on " + txt);
+            LOG.log(POILogger.WARN, "TestExtractorFactory.testPackage() failed on " + txt);
             throw e;
         }
     }
index 6c46e3dcc0b66523d2186b02af00bd56ba0b0a91..a56a8682ff9a8716abbc0916d4e48375ff67b02d 100644 (file)
@@ -129,8 +129,8 @@ public final class TestProper {
             final ValueEval ret = TextFunction.PROPER.evaluate(new ValueEval[]{strArg}, 0, 0);
             assertEquals("Some Longer Text That Needs A Number Of Replacements To Check For Runtime Of Different Implementations", ((StringEval)ret).getStringValue());
         }
-        // Took aprox. 600ms on a decent Laptop in July 2016
-        System.out.println("Took: " + (System.currentTimeMillis() - start) + "ms");
+        // Took approx. 600ms on a decent Laptop in July 2016
+        //System.out.println("Took: " + (System.currentTimeMillis() - start) + "ms");
     }
 
     private void checkProper(String input, String expected) {
index 4ebd5387d9124975ca1ef18233ac241e083103a8..9a1d1fdd832aa00242a012ccaef6222ecf451cee 100644 (file)
@@ -283,7 +283,6 @@ public class TestCommentsTable {
     // Set the comment on a sheet
     //
     private static void setComment(Sheet sheet, Cell cell, Drawing<?> drawing, String commentText, CreationHelper helper, ClientAnchor anchor) {
-        System.out.println("Setting col: " + cell.getColumnIndex() + " and row " + cell.getRowIndex());
         anchor.setCol1(cell.getColumnIndex());
         anchor.setCol2(cell.getColumnIndex());
         anchor.setRow1(cell.getRowIndex());
index a0d91223098dc05d222a4a8c50d31fd6863086e2..02a0a33344e4dc93e376db94733c8646b4818b74 100644 (file)
@@ -211,8 +211,6 @@ public class TestAutoSizeColumnTracker {
     private static void assumeRequiredFontsAreInstalled(final Workbook workbook, final Cell cell) {
         // autoSize will fail if required fonts are not installed, skip this test then
         Font font = workbook.getFontAt(cell.getCellStyle().getFontIndex());
-        System.out.println(font.getFontHeightInPoints());
-        System.out.println(font.getFontName());
         Assume.assumeTrue("Cannot verify autoSizeColumn() because the necessary Fonts are not installed on this machine: " + font,
                           SheetUtil.canComputeColumnWidth(font));
     }
index 84e519d27c92b3179d3b60e6a69601dc45e2705d..96bc0654e65fb08182cee5f7d30b460ae7abb053 100644 (file)
@@ -385,7 +385,6 @@ public final class TestSXSSFWorkbook extends BaseTestXWorkbook {
         File out = new File("Test.xlsx");
         out.delete();
         for (int i = 0; i < 2; i++) {
-            System.out.println("Iteration " + i);
             final SXSSFWorkbook wb;
             if (out.exists()) {
                 wb = new SXSSFWorkbook(
index 0f6b1e2a52ebd6a08e72a53939464d16ea1fd8c0..b0447871b3980406cc6a2d2c83793a636e008b9d 100644 (file)
@@ -27,6 +27,7 @@ import java.util.List;
 import java.util.Locale;
 
 
+import org.apache.poi.poifs.crypt.TestSignatureInfo;
 import org.apache.poi.ss.formula.eval.ErrorEval;
 import org.apache.poi.ss.formula.functions.TestMathX;
 import org.apache.poi.ss.usermodel.Cell;
@@ -36,6 +37,8 @@ import org.apache.poi.ss.usermodel.FormulaEvaluator;
 import org.apache.poi.ss.usermodel.Row;
 import org.apache.poi.ss.usermodel.Sheet;
 import org.apache.poi.util.LocaleUtil;
+import org.apache.poi.util.POILogFactory;
+import org.apache.poi.util.POILogger;
 import org.apache.poi.xssf.XSSFTestDataSamples;
 import org.junit.AfterClass;
 import org.junit.Test;
@@ -48,7 +51,9 @@ import junit.framework.AssertionFailedError;
 
 @RunWith(Parameterized.class)
 public final class TestMatrixFormulasFromXMLSpreadsheet {
-    
+
+    private static final POILogger LOG = POILogFactory.getLogger(TestMatrixFormulasFromXMLSpreadsheet.class);
+
     private static XSSFWorkbook workbook;
     private static Sheet sheet;
     private static FormulaEvaluator evaluator;
@@ -213,13 +218,13 @@ public final class TestMatrixFormulasFromXMLSpreadsheet {
      */
     private static String getTargetFunctionName(Row r) {
         if(r == null) {
-            System.err.println("Warning - given null row, can't figure out function name");
+            LOG.log(POILogger.WARN, "Warning - given null row, can't figure out function name");
             return null;
         }
         Cell cell = r.getCell(Navigator.START_OPERATORS_COL_INDEX);
-        System.err.println(String.valueOf(Navigator.START_OPERATORS_COL_INDEX));
+        LOG.log(POILogger.DEBUG, String.valueOf(Navigator.START_OPERATORS_COL_INDEX));
         if(cell == null) {
-            System.err.println("Warning - Row " + r.getRowNum() + " has no cell " + Navigator.START_OPERATORS_COL_INDEX + ", can't figure out function name");
+            LOG.log(POILogger.WARN, "Warning - Row " + r.getRowNum() + " has no cell " + Navigator.START_OPERATORS_COL_INDEX + ", can't figure out function name");
             return null;
         }
         if(cell.getCellType() == CellType.BLANK) {
index de70066f12998fcd7a175f7e7f0e12458cc3a9b3..ea48e4b1698de7d14b658593f0247a4ed8745cb4 100644 (file)
@@ -103,7 +103,6 @@ public final class TestUnfixedBugs {
         Workbook workbook = XSSFTestDataSamples.openSampleWorkbook("54071.xlsx");
         Sheet sheet = workbook.getSheetAt(0);
         int rows = sheet.getPhysicalNumberOfRows();
-        System.out.println(">> file rows is:"+(rows-1)+" <<");
         Row title = sheet.getRow(0);
 
         Date prev = null;
@@ -115,7 +114,7 @@ public final class TestUnfixedBugs {
                 if (titleName.startsWith("time")) {
                     // here the output will produce ...59 or ...58 for the rows, probably POI is
                     // doing some different rounding or some other small difference...
-                    System.out.println("==Time:"+cell.getDateCellValue());
+                    //System.out.println("==Time:"+cell.getDateCellValue());
                     if(prev != null) {
                         assertEquals(prev, cell.getDateCellValue());
                     }
index 15cede111dd192554713a6ab43a8dc3040182b05..f7798270a2e836bbf1e56810c6c94db732fd95ab 100644 (file)
@@ -2649,7 +2649,6 @@ public final class TestXSSFBugs extends BaseTestBugzillaIssues {
             Cell cell = aRow.getCell(1);
             if (cell.getCellType() == CellType.FORMULA) {
                 String formula = cell.getCellFormula();
-                //System.out.println("formula: " + formula);
                 assertNotNull(formula);
                 assertTrue(formula.contains("WORKDAY"));
             } else {
@@ -2786,7 +2785,6 @@ public final class TestXSSFBugs extends BaseTestBugzillaIssues {
             Sheet newSheet = wb.createSheet();
             //Sheet newSheet = wb.createSheet(sheetName);
             int newSheetIndex = wb.getSheetIndex(newSheet);
-            //System.out.println(newSheetIndex);
             wb.setSheetName(newSheetIndex, sheetName);
             wb.setSheetOrder(sheetName, sheetIndex);
         }
@@ -2873,8 +2871,6 @@ public final class TestXSSFBugs extends BaseTestBugzillaIssues {
                 for (int cellNum = row.getFirstCellNum(); cellNum < row.getLastCellNum(); cellNum++) {
                     Cell cell = row.getCell(cellNum);
                     String fmtCellValue = formatter.formatCellValue(cell);
-
-                    System.out.println("Cell: " + fmtCellValue);
                     assertNotNull(fmtCellValue);
                     assertFalse(fmtCellValue.equals("0"));
                 }
@@ -3178,7 +3174,6 @@ public final class TestXSSFBugs extends BaseTestBugzillaIssues {
         Row r = s.getRow(3);
         Cell c = r.getCell(0);
         assertEquals(CellType.FORMULA, c.getCellType());
-        System.out.println(c.getCellFormula());
         eval.setDebugEvaluationOutputForNextEval(true);
         CellValue cv = eval.evaluate(c);
         assertNotNull(cv);
index 9b2c9ffbc617c89e1391c1c67c835559d62af309..2938140cb2a88f0ff0f3ee8407d05bbb75049871 100644 (file)
@@ -1509,7 +1509,7 @@ public final class TestXSSFSheet extends BaseTestXSheet {
         assertEquals("J7", new CellReference(cell).formatAsString());
         assertEquals("[Cell Formula] J7 cell type", CellType.FORMULA, cell.getCellType());
         assertEquals("[Cell Formula] J7 cell formula", "5+2", cell.getCellFormula());
-        System.out.println("Cell formula evaluation currently unsupported");
+        //System.out.println("Cell formula evaluation currently unsupported");
         
         // Cell Formula with Reference
         // Formula row references should be adjusted by destRowNum-srcRowNum
@@ -1536,7 +1536,7 @@ public final class TestXSSFSheet extends BaseTestXSheet {
         
         // Array Formula
         cell = CellUtil.getCell(destRow, col++);
-        System.out.println("Array formulas currently unsupported");
+        //System.out.println("Array formulas currently unsupported");
         // FIXME: Array Formula set with Sheet.setArrayFormula() instead of cell.setFormula()
         /*
         assertEquals("[Array Formula] N7 cell type", CellType.FORMULA, cell.getCellType());
index fb7a9c0b013706a1067c6fce45200769b73466a8..59b1a08aa0e11e6264fce2d8d52c7c7fe8f81b90 100644 (file)
@@ -22,10 +22,15 @@ import java.io.IOException;
 import java.util.List;
 
 import org.apache.poi.ss.util.CellRangeAddress;
+import org.apache.poi.util.POILogFactory;
+import org.apache.poi.util.POILogger;
 import org.apache.poi.xssf.XSSFTestDataSamples;
 import org.junit.Test;
 
 public class TestXSSFSheetMergeRegions {
+
+    private static final POILogger LOG = POILogFactory.getLogger(TestXSSFSheetMergeRegions.class);
+
     @Test
     public void testMergeRegionsSpeed() throws IOException {
         final XSSFWorkbook wb = XSSFTestDataSamples.openSampleWorkbook("57893-many-merges.xlsx");
@@ -39,7 +44,7 @@ public class TestXSSFSheetMergeRegions {
                 if(millis < 2000) {
                     break;
                 }
-                System.out.println("Retry " + i + " because run-time is too high: " + millis);
+                LOG.log(POILogger.INFO,"Retry " + i + " because run-time is too high: " + millis);
             }
 
             boolean inGump = false;
index f4c0a49c08af522abff6a578ad81e5fb09fa5657..4bf84a5534d0af95cb7d7503da55557ff0efd49f 100644 (file)
@@ -167,9 +167,10 @@ public class TestXWPFPictureData extends TestCase {
             for (XWPFRun run : paragraph.getRuns()) {
                 for (XWPFPicture picture : run.getEmbeddedPictures()) {
                     if (paragraph.getDocument() != null) {
-                        //System.out.println(picture.getCTPicture());
                         XWPFPictureData data = picture.getPictureData();
-                        if (data != null) System.out.println(data.getFileName());
+                        if (data != null) {
+                            fail("Should have returned null: "+ data.getFileName());
+                        }
                     }
                 }
             }
index 0e69ca94e6158bcf7d9c2cf3d934a5e3b87bd53c..e4598211c637d4217e9ace5c522e1245d84f400d 100644 (file)
@@ -21,6 +21,7 @@ import static org.apache.poi.POITestCase.assertContains;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
 
+import java.io.File;
 import java.io.IOException;
 import java.io.InputStream;
 
@@ -29,6 +30,7 @@ import org.apache.poi.hpsf.*;
 import org.apache.poi.hssf.HSSFTestDataSamples;
 import org.apache.poi.hssf.extractor.ExcelExtractor;
 import org.apache.poi.hssf.usermodel.HSSFWorkbook;
+import org.apache.poi.poifs.filesystem.NPOIFSFileSystem;
 import org.apache.poi.poifs.filesystem.POIFSFileSystem;
 import org.junit.Test;
 
@@ -194,8 +196,10 @@ public final class TestHPSFPropertiesExtractor {
 
        @Test
        public void test61300Extractor() throws NoPropertySetStreamException, MarkUnsupportedException, IOException {
-               HPSFPropertiesExtractor.main(new String[]{
-                               POIDataSamples.getPOIFSInstance().getFile("61300.bin").getAbsolutePath()
-               });
+               try (NPOIFSFileSystem npoifs = new NPOIFSFileSystem(
+                               POIDataSamples.getPOIFSInstance().getFile("61300.bin"))) {
+                       HPSFPropertiesExtractor ext = new HPSFPropertiesExtractor(npoifs);
+                       assertContains(ext.getText(), "PID_CODEPAGE = 1252");
+               }
        }
 }
index 9d178341896133eed751ee818b20722992e7dc29..a28060c1b4b83cece1d8051b16cdf4eec04d2567 100644 (file)
@@ -36,6 +36,8 @@ import org.apache.poi.ss.usermodel.FormulaEvaluator;
 import org.apache.poi.ss.usermodel.Row;
 import org.apache.poi.ss.usermodel.Sheet;
 import org.apache.poi.util.LocaleUtil;
+import org.apache.poi.util.POILogFactory;
+import org.apache.poi.util.POILogger;
 import org.junit.AfterClass;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -47,7 +49,10 @@ import junit.framework.AssertionFailedError;
 
 @RunWith(Parameterized.class)
 public final class TestMatrixFormulasFromBinarySpreadsheet {
-    
+
+    private static final POILogger LOG = POILogFactory.getLogger(TestMatrixFormulasFromBinarySpreadsheet.class);
+
+
     private static HSSFWorkbook workbook;
     private static Sheet sheet;
     private static FormulaEvaluator evaluator;
@@ -212,13 +217,15 @@ public final class TestMatrixFormulasFromBinarySpreadsheet {
      */
     private static String getTargetFunctionName(Row r) {
         if(r == null) {
-            System.err.println("Warning - given null row, can't figure out function name");
+
+            LOG.log(POILogger.WARN,"Warning - given null row, can't figure out function name");
             return null;
         }
         Cell cell = r.getCell(Navigator.START_OPERATORS_COL_INDEX);
-        System.err.println(String.valueOf(Navigator.START_OPERATORS_COL_INDEX));
+        LOG.log(POILogger.INFO, String.valueOf(Navigator.START_OPERATORS_COL_INDEX));
         if(cell == null) {
-            System.err.println("Warning - Row " + r.getRowNum() + " has no cell " + Navigator.START_OPERATORS_COL_INDEX + ", can't figure out function name");
+            LOG.log(POILogger.WARN,
+                    "Warning - Row " + r.getRowNum() + " has no cell " + Navigator.START_OPERATORS_COL_INDEX + ", can't figure out function name");
             return null;
         }
         if(cell.getCellType() == CellType.BLANK) {
index 3c50507d15674cf8c441cb251d87d8605a5a7506..1a2e1af60e1479a298496a4b914f64ac8d703efc 100644 (file)
@@ -23,18 +23,41 @@ import org.apache.poi.poifs.filesystem.OfficeXmlFileException;
 import org.apache.poi.poifs.property.NPropertyTable;
 import org.apache.poi.util.TempFile;
 import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
 import org.junit.Ignore;
 import org.junit.Test;
 
+import java.io.ByteArrayOutputStream;
 import java.io.File;
 import java.io.FileInputStream;
 import java.io.FileNotFoundException;
 import java.io.IOException;
+import java.io.OutputStream;
+import java.io.PrintStream;
 
 import static org.junit.Assert.*;
 
 public class TestPOIFSDump {
 
+    private static PrintStream SYSTEM;
+    @BeforeClass
+    public static void setUp() {
+        SYSTEM = System.out;
+        System.setOut(new PrintStream(new OutputStream() {
+            @Override
+            public void write(int b) throws IOException {
+
+            }
+        }
+        ));
+    }
+
+    @AfterClass
+    public static void resetSystemOut() {
+        System.setOut(SYSTEM);
+    }
+
     private static final String TEST_FILE = HSSFTestDataSamples.getSampleFile("46515.xls").getAbsolutePath();
     private static final String INVALID_FILE = HSSFTestDataSamples.getSampleFile("48936-strings.txt").getAbsolutePath();
     private static final String INVALID_XLSX_FILE = HSSFTestDataSamples.getSampleFile("47668.xlsx").getAbsolutePath();
index 43a408383054b0113fbb5311505d1bf85288b676..371188edb67dd01c374c17b1c153268e2441d4fb 100644 (file)
@@ -28,6 +28,7 @@ import java.net.URL;
 import java.util.Enumeration;
 import java.util.Map;
 
+import org.junit.Ignore;
 import org.junit.Test;
 
 public class TestPresetGeometries {
@@ -67,6 +68,7 @@ public class TestPresetGeometries {
         PresetGeometries._inst = null;
     }
 
+    @Ignore("problem solved? Turn back on if this debugging is still in process.")
     @Test
     public void testCheckXMLParser() throws Exception{
         // Gump reports a strange error because of an unavailable XML Parser, let's try to find out where 
index e7deaf2feef48d6b3fce4154e5b4a8f633508e14..2e7eb293bee93b0eef30a7dcff3bf7bd63692594 100644 (file)
@@ -1571,30 +1571,28 @@ public abstract class BaseTestBugzillaIssues {
         // First cell of array formula, OK
         int rowId = 0;
         int cellId = 1;
-        System.out.println("Reading row " + rowId + ", col " + cellId);
 
         Row row = sheet.getRow(rowId);
         Cell cell = row.getCell(cellId);
 
-        System.out.println("Formula:" + cell.getCellFormula());
+        assertEquals("A1", cell.getCellFormula());
         if (CellType.FORMULA == cell.getCellType()) {
             CellType formulaResultType = cell.getCachedFormulaResultType();
-            System.out.println("Formula Result Type:" + formulaResultType);
+            assertEquals(CellType.STRING, formulaResultType);
         }
 
         // *******************************
         // Second cell of array formula, NOT OK for xlsx files
         rowId = 1;
         cellId = 1;
-        System.out.println("Reading row " + rowId + ", col " + cellId);
 
         row = sheet.getRow(rowId);
         cell = row.getCell(cellId);
-        System.out.println("Formula:" + cell.getCellFormula());
+        assertEquals("A1", cell.getCellFormula());
 
         if (CellType.FORMULA == cell.getCellType()) {
             CellType formulaResultType = cell.getCachedFormulaResultType();
-            System.out.println("Formula Result Type:" + formulaResultType);
+            assertEquals(CellType.STRING, formulaResultType);
         }
 
         workbook.close();
index dd985df65fe456a1d61269f639dd85dbce4b5087..e7af379fd008416134628fbeb9eae90e492604e4 100644 (file)
@@ -107,7 +107,6 @@ public class BaseTestCellUtil {
 
     @Test
     public void setCellStyleProperties() throws IOException {
-        System.out.println("setCellStyleProps start");
         Workbook wb = _testDataProvider.createWorkbook();
         Sheet s = wb.createSheet();
         Row r = s.createRow(0);
@@ -130,7 +129,6 @@ public class BaseTestCellUtil {
         c = r.createCell(1);
         CellUtil.setCellStyleProperties(c, props);
         int styCnt3 = wb.getNumCellStyles();
-        System.out.println("setCellStyleProps nearing end");
         assertEquals("No additional styles should have been created", styCnt2, styCnt3);
 
         wb.close();
index 70a90492a8f39cbe3fcf1f3ec5ec3fbd9c4f2181..b7bcca647b06a089467552759fddc6384a0f32eb 100644 (file)
@@ -110,7 +110,7 @@ public final class TestDateFormatConverter extends TestCase {
                 workbook.write(outputStream);
             }
 
-            System.out.println("Open " + outputFile.getAbsolutePath() + " in Excel");
+            //System.out.println("Open " + outputFile.getAbsolutePath() + " in Excel");
         }
     }
 
index 5611636959829813ee95596a31a6b8c8ffd7be5c..f196c9b6e0ae2c946cc83b5a3b7c8611533d076e 100644 (file)
@@ -27,11 +27,33 @@ import java.io.ByteArrayOutputStream;
 import java.io.File;
 import java.io.FileOutputStream;
 import java.io.IOException;
+import java.io.OutputStream;
 import java.io.PrintStream;
 
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
 import org.junit.Test;
 
 public class TestHexDump {
+
+    private static PrintStream SYSTEM_OUT;
+
+    @BeforeClass
+    public static void setUp() {
+        SYSTEM_OUT = System.out;
+        System.setOut(new PrintStream(new OutputStream() {
+            @Override
+            public void write(int b) throws IOException {
+
+            }
+        }));
+    }
+
+    @AfterClass
+    public static void tearDown() {
+        System.setOut(SYSTEM_OUT);
+    }
+
     @Test
     public void testDump() throws IOException {
         byte[] testArray = testArray();
index 96106dc751d76551037045a775ad514b54d530fc..ef648e4f00d7ede9aa94d873e9035b361ff6ca53 100644 (file)
@@ -58,14 +58,6 @@ public class TestLittleEndianCP950Reader {
 
     }
 
-    @Test
-    public void one() {
-        byte b = (byte) 0xfe;
-        byte c = (byte) 0xd3;
-
-        int i = ((b & 0xff) << 8) + (c & 0xff);
-        System.out.println(i);
-    }
 
     private void assertCharEquals(char expected, byte[] data) throws IOException {
         Reader reader = new LittleEndianCP950Reader(data);