poi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kiwiwi...@apache.org
Subject svn commit: r1735706 - in /poi/trunk: ooxml-lib/ src/examples/src/org/apache/poi/ss/examples/ src/examples/src/org/apache/poi/xssf/usermodel/examples/ src/ooxml/testcases/org/apache/poi/xssf/usermodel/ src/testcases/org/apache/poi/hssf/usermodel/ src/t...
Date Fri, 18 Mar 2016 23:12:28 GMT
Author: kiwiwings
Date: Fri Mar 18 23:12:28 2016
New Revision: 1735706

URL: http://svn.apache.org/viewvc?rev=1735706&view=rev
Log:
eclipse warning fixes

Modified:
    poi/trunk/ooxml-lib/   (props changed)
    poi/trunk/src/examples/src/org/apache/poi/ss/examples/CalendarDemo.java
    poi/trunk/src/examples/src/org/apache/poi/xssf/usermodel/examples/CalendarDemo.java
    poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFDataFormat.java
    poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFDataFormat.java
    poi/trunk/src/testcases/org/apache/poi/sl/usermodel/BaseTestSlideShowFactory.java
    poi/trunk/src/testcases/org/apache/poi/ss/usermodel/BaseTestCellComment.java
    poi/trunk/src/testcases/org/apache/poi/ss/usermodel/BaseTestDataFormat.java
    poi/trunk/src/testcases/org/apache/poi/ss/usermodel/BaseTestSheetShiftRows.java

Propchange: poi/trunk/ooxml-lib/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Fri Mar 18 23:12:28 2016
@@ -1,3 +1,4 @@
 *.jar
 *.zip
 *.xsd
+*.orig

Modified: poi/trunk/src/examples/src/org/apache/poi/ss/examples/CalendarDemo.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/examples/src/org/apache/poi/ss/examples/CalendarDemo.java?rev=1735706&r1=1735705&r2=1735706&view=diff
==============================================================================
--- poi/trunk/src/examples/src/org/apache/poi/ss/examples/CalendarDemo.java (original)
+++ poi/trunk/src/examples/src/org/apache/poi/ss/examples/CalendarDemo.java Fri Mar 18 23:12:28
2016
@@ -140,6 +140,8 @@ public class CalendarDemo {
         FileOutputStream out = new FileOutputStream(file);
         wb.write(out);
         out.close();
+        
+        wb.close();
     }
 
     /**

Modified: poi/trunk/src/examples/src/org/apache/poi/xssf/usermodel/examples/CalendarDemo.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/examples/src/org/apache/poi/xssf/usermodel/examples/CalendarDemo.java?rev=1735706&r1=1735705&r2=1735706&view=diff
==============================================================================
--- poi/trunk/src/examples/src/org/apache/poi/xssf/usermodel/examples/CalendarDemo.java (original)
+++ poi/trunk/src/examples/src/org/apache/poi/xssf/usermodel/examples/CalendarDemo.java Fri
Mar 18 23:12:28 2016
@@ -127,6 +127,8 @@ public class CalendarDemo {
         FileOutputStream out = new FileOutputStream("calendar-"+year+".xlsx");
         wb.write(out);
         out.close();
+        
+        wb.close();
     }
 
     /**

Modified: poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFDataFormat.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFDataFormat.java?rev=1735706&r1=1735705&r2=1735706&view=diff
==============================================================================
--- poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFDataFormat.java (original)
+++ poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFDataFormat.java Fri
Mar 18 23:12:28 2016
@@ -17,6 +17,8 @@
 
 package org.apache.poi.xssf.usermodel;
 
+import static org.junit.Assert.*;
+
 import java.io.IOException;
 
 import org.apache.poi.ss.usermodel.BaseTestDataFormat;
@@ -26,6 +28,7 @@ import org.apache.poi.ss.usermodel.CellS
 import org.apache.poi.ss.usermodel.DataFormat;
 import org.apache.poi.xssf.XSSFITestDataProvider;
 import org.apache.poi.xssf.XSSFTestDataSamples;
+import org.junit.Test;
 
 /**
  * Tests for {@link XSSFDataFormat}
@@ -39,7 +42,8 @@ public final class TestXSSFDataFormat ex
     /**
      * [Bug 49928] formatCellValue returns incorrect value for \u00a3 formatted cells
      */
-    public void test49928() {
+	@Test
+    public void test49928() throws IOException {
         XSSFWorkbook wb = XSSFTestDataSamples.openSampleWorkbook("49928.xlsx");
         doTest49928Core(wb);
         
@@ -57,26 +61,31 @@ public final class TestXSSFDataFormat ex
         short customFmtIdx = dataFormat.getFormat(customFmt);
         assertTrue(customFmtIdx >= BuiltinFormats.FIRST_USER_DEFINED_FORMAT_INDEX);
         assertEquals(customFmt, dataFormat.getFormat(customFmtIdx));
+        
+        wb.close();
     }
     
     /**
      * [Bug 58532] Handle formats that go numnum, numK, numM etc 
      */
-    public void test58532() {
+	@Test
+    public void test58532() throws IOException {
         XSSFWorkbook wb = XSSFTestDataSamples.openSampleWorkbook("FormatKM.xlsx");
         doTest58532Core(wb);
+        wb.close();
     }
     
     /**
      * [Bug 58778] Built-in number formats can be overridden with XSSFDataFormat.putFormat(int
id, String fmt)
      */
+	@Test
     public void test58778() throws IOException {
-        XSSFWorkbook wb = new XSSFWorkbook();
-        Cell cell = wb.createSheet("bug58778").createRow(0).createCell(0);
+        XSSFWorkbook wb1 = new XSSFWorkbook();
+        Cell cell = wb1.createSheet("bug58778").createRow(0).createCell(0);
         cell.setCellValue(5.25);
-        CellStyle style = wb.createCellStyle();
+        CellStyle style = wb1.createCellStyle();
         
-        XSSFDataFormat dataFormat = wb.createDataFormat();
+        XSSFDataFormat dataFormat = wb1.createDataFormat();
         
         short poundFmtIdx = 6;
         dataFormat.putFormat(poundFmtIdx, poundFmt);
@@ -84,9 +93,9 @@ public final class TestXSSFDataFormat ex
         cell.setCellStyle(style);
         // Cell should appear as "<poundsymbol>5"
         
-        wb = XSSFTestDataSamples.writeOutCloseAndReadBack(wb);
-        cell = wb.getSheet("bug58778").getRow(0).getCell(0);
-        assertEquals(5.25, cell.getNumericCellValue());
+        XSSFWorkbook wb2 = XSSFTestDataSamples.writeOutCloseAndReadBack(wb1);
+        cell = wb2.getSheet("bug58778").getRow(0).getCell(0);
+        assertEquals(5.25, cell.getNumericCellValue(), 0);
         
         style = cell.getCellStyle();
         assertEquals(poundFmt, style.getDataFormatString());
@@ -94,6 +103,7 @@ public final class TestXSSFDataFormat ex
         
         // manually check the file to make sure the cell is rendered as "<poundsymbol>5"
         // Verified with LibreOffice 4.2.8.2 on 2015-12-28
-        wb.close();
+        wb2.close();
+        wb1.close();
     }
 }

Modified: poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFDataFormat.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFDataFormat.java?rev=1735706&r1=1735705&r2=1735706&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFDataFormat.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFDataFormat.java Fri Mar
18 23:12:28 2016
@@ -17,11 +17,22 @@
 
 package org.apache.poi.hssf.usermodel;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import java.io.IOException;
+
 import org.apache.poi.hssf.HSSFITestDataProvider;
 import org.apache.poi.hssf.HSSFTestDataSamples;
-import org.apache.poi.ss.usermodel.*;
+import org.apache.poi.ss.usermodel.BaseTestDataFormat;
+import org.apache.poi.ss.usermodel.BuiltinFormats;
+import org.apache.poi.ss.usermodel.Cell;
+import org.apache.poi.ss.usermodel.CellStyle;
+import org.apache.poi.ss.usermodel.DataFormat;
+import org.apache.poi.ss.usermodel.Row;
 import org.apache.poi.util.POILogFactory;
 import org.apache.poi.util.POILogger;
+import org.junit.Test;
 
 /**
  * Tests for {@link HSSFDataFormat}
@@ -36,7 +47,8 @@ public final class TestHSSFDataFormat ex
     /**
      * [Bug 49928] formatCellValue returns incorrect value for \u00a3 formatted cells
      */
-    public void test49928(){
+    @Test
+    public void test49928() throws IOException {
         HSSFWorkbook wb = HSSFTestDataSamples.openSampleWorkbook("49928.xls");
         doTest49928Core(wb);
 
@@ -49,20 +61,25 @@ public final class TestHSSFDataFormat ex
         short customFmtIdx = dataFormat.getFormat("\u00a3##.00[Yellow]");
         assertTrue(customFmtIdx >= BuiltinFormats.FIRST_USER_DEFINED_FORMAT_INDEX );
         assertEquals("\u00a3##.00[Yellow]", dataFormat.getFormat(customFmtIdx));
+        
+        wb.close();
     }
 
     /**
      * [Bug 58532] Handle formats that go numnum, numK, numM etc 
      */
-    public void test58532() {
+    @Test
+    public void test58532() throws IOException {
         HSSFWorkbook wb = HSSFTestDataSamples.openSampleWorkbook("FormatKM.xls");
         doTest58532Core(wb);
+        wb.close();
     }
 
     /**
      * Bug 51378: getDataFormatString method call crashes when reading the test file
      */
-    public void test51378(){
+    @Test
+    public void test51378() throws IOException {
         HSSFWorkbook wb = HSSFTestDataSamples.openSampleWorkbook("12561-1.xls");
         for (int i = 0; i < wb.getNumberOfSheets(); i++) {
             HSSFSheet sheet = wb.getSheetAt(i);
@@ -77,6 +94,7 @@ public final class TestHSSFDataFormat ex
                 }
             }
         }
+        wb.close();
     }
 
 }

Modified: poi/trunk/src/testcases/org/apache/poi/sl/usermodel/BaseTestSlideShowFactory.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/sl/usermodel/BaseTestSlideShowFactory.java?rev=1735706&r1=1735705&r2=1735706&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/sl/usermodel/BaseTestSlideShowFactory.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/sl/usermodel/BaseTestSlideShowFactory.java Fri
Mar 18 23:12:28 2016
@@ -34,6 +34,7 @@ import org.apache.poi.poifs.filesystem.N
 public class BaseTestSlideShowFactory {
     private static final POIDataSamples _slTests = POIDataSamples.getSlideShowInstance();
 
+    @SuppressWarnings("resource")
     protected static void testFactoryFromFile(String file) throws Exception {
         SlideShow<?,?> ss;
         // from file
@@ -42,6 +43,7 @@ public class BaseTestSlideShowFactory {
         assertCloseDoesNotModifyFile(file, ss);
     }
 
+    @SuppressWarnings("resource")
     protected static void testFactoryFromStream(String file) throws Exception {
         SlideShow<?,?> ss;
         // from stream
@@ -50,6 +52,7 @@ public class BaseTestSlideShowFactory {
         assertCloseDoesNotModifyFile(file, ss);
     }
 
+    @SuppressWarnings("resource")
     protected static void testFactoryFromNative(String file) throws Exception {
         SlideShow<?,?> ss;
         // from NPOIFS
@@ -70,6 +73,7 @@ public class BaseTestSlideShowFactory {
         }
     }
 
+    @SuppressWarnings("resource")
     protected static void testFactoryFromProtectedFile(String protectedFile, String password)
throws Exception {
         SlideShow<?,?> ss;
         // from protected file 
@@ -78,6 +82,7 @@ public class BaseTestSlideShowFactory {
         assertCloseDoesNotModifyFile(protectedFile, ss);
     }
 
+    @SuppressWarnings("resource")
     protected static void testFactoryFromProtectedStream(String protectedFile, String password)
throws Exception {
         SlideShow<?,?> ss;
         // from protected stream
@@ -86,6 +91,7 @@ public class BaseTestSlideShowFactory {
         assertCloseDoesNotModifyFile(protectedFile, ss);
     }
 
+    @SuppressWarnings("resource")
     protected static void testFactoryFromProtectedNative(String protectedFile, String password)
throws Exception {
         SlideShow<?,?> ss;
         // Encryption layer is a BIFF8 binary format that can be read by NPOIFSFileSystem,

Modified: poi/trunk/src/testcases/org/apache/poi/ss/usermodel/BaseTestCellComment.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/ss/usermodel/BaseTestCellComment.java?rev=1735706&r1=1735705&r2=1735706&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/ss/usermodel/BaseTestCellComment.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/ss/usermodel/BaseTestCellComment.java Fri Mar 18
23:12:28 2016
@@ -28,6 +28,7 @@ import java.io.IOException;
 
 import org.apache.poi.hssf.usermodel.HSSFSheet;
 import org.apache.poi.ss.ITestDataProvider;
+import org.apache.poi.ss.util.CellAddress;
 import org.apache.poi.util.Units;
 import org.junit.Test;
 
@@ -47,11 +48,11 @@ public abstract class BaseTestCellCommen
     public final void find() throws IOException {
         Workbook book = _testDataProvider.createWorkbook();
         Sheet sheet = book.createSheet();
-        assertNull(sheet.getCellComment(0, 0));
+        assertNull(sheet.getCellComment(new CellAddress(0, 0)));
 
         Row row = sheet.createRow(0);
         Cell cell = row.createCell(0);
-        assertNull(sheet.getCellComment(0, 0));
+        assertNull(sheet.getCellComment(new CellAddress(0, 0)));
         assertNull(cell.getCellComment());
         book.close();
     }
@@ -68,12 +69,12 @@ public abstract class BaseTestCellCommen
         CreationHelper factory = wb1.getCreationHelper();
 
         Sheet sheet = wb1.createSheet();
-        assertNull(sheet.getCellComment(cellRow, cellColumn));
+        assertNull(sheet.getCellComment(new CellAddress(cellRow, cellColumn)));
 
         Cell cell = sheet.createRow(cellRow).createCell(cellColumn);
         cell.setCellValue(factory.createRichTextString(cellText));
         assertNull(cell.getCellComment());
-        assertNull(sheet.getCellComment(cellRow, cellColumn));
+        assertNull(sheet.getCellComment(new CellAddress(cellRow, cellColumn)));
 
         Drawing patr = sheet.createDrawingPatriarch();
         ClientAnchor anchor = factory.createClientAnchor();
@@ -90,7 +91,7 @@ public abstract class BaseTestCellCommen
         comment.setAuthor(commentAuthor);
         cell.setCellComment(comment);
         assertNotNull(cell.getCellComment());
-        assertNotNull(sheet.getCellComment(cellRow, cellColumn));
+        assertNotNull(sheet.getCellComment(new CellAddress(cellRow, cellColumn)));
 
         //verify our settings
         assertEquals(commentAuthor, comment.getAuthor());
@@ -152,7 +153,7 @@ public abstract class BaseTestCellCommen
             cell = row.getCell(0);
             comment = cell.getCellComment();
             assertNull("Cells in the first column are not commented", comment);
-            assertNull(sheet.getCellComment(rownum, 0));
+            assertNull(sheet.getCellComment(new CellAddress(rownum, 0)));
         }
 
         for (int rownum = 0; rownum < 3; rownum++) {
@@ -160,7 +161,7 @@ public abstract class BaseTestCellCommen
             cell = row.getCell(1);
             comment = cell.getCellComment();
             assertNotNull("Cells in the second column have comments", comment);
-            assertNotNull("Cells in the second column have comments", sheet.getCellComment(rownum,
1));
+            assertNotNull("Cells in the second column have comments", sheet.getCellComment(new
CellAddress(rownum, 1)));
 
             assertEquals("Yegor Kozlov", comment.getAuthor());
             assertFalse("cells in the second column have not empyy notes",

Modified: poi/trunk/src/testcases/org/apache/poi/ss/usermodel/BaseTestDataFormat.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/ss/usermodel/BaseTestDataFormat.java?rev=1735706&r1=1735705&r2=1735706&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/ss/usermodel/BaseTestDataFormat.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/ss/usermodel/BaseTestDataFormat.java Fri Mar 18
23:12:28 2016
@@ -17,30 +17,34 @@
 
 package org.apache.poi.ss.usermodel;
 
-import junit.framework.TestCase;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
 
 import java.io.IOException;
 
 import org.apache.poi.ss.ITestDataProvider;
+import org.junit.Test;
 
 /**
  * Tests of implementation of {@link DataFormat}
  *
  */
-public abstract class BaseTestDataFormat extends TestCase {
+public abstract class BaseTestDataFormat {
 
     private final ITestDataProvider _testDataProvider;
 
     protected BaseTestDataFormat(ITestDataProvider testDataProvider) {
         _testDataProvider = testDataProvider;
     }
-    
+
     public void assertNotBuiltInFormat(String customFmt) {
         //check it is not in built-in formats
         assertEquals(-1, BuiltinFormats.getBuiltinFormat(customFmt));
     }
 
-    public final void testBuiltinFormats() {
+    @Test
+    public final void testBuiltinFormats() throws IOException {
         Workbook wb = _testDataProvider.createWorkbook();
 
         DataFormat df = wb.createDataFormat();
@@ -66,13 +70,16 @@ public abstract class BaseTestDataFormat
         assertTrue(customIdx >= BuiltinFormats.FIRST_USER_DEFINED_FORMAT_INDEX);
         //read and verify the string representation
         assertEquals(customFmt, df.getFormat((short)customIdx));
+
+        wb.close();
     }
-    
+
     /**
      * [Bug 49928] formatCellValue returns incorrect value for \u00a3 formatted cells
      */
-    public abstract void test49928();
-    protected final String poundFmt = "\"\u00a3\"#,##0;[Red]\\-\"\u00a3\"#,##0";
+    @Test
+    public abstract void test49928() throws IOException;
+    protected final static String poundFmt = "\"\u00a3\"#,##0;[Red]\\-\"\u00a3\"#,##0";
     public void doTest49928Core(Workbook wb){
         DataFormatter df = new DataFormatter();
 
@@ -80,8 +87,7 @@ public abstract class BaseTestDataFormat
         Cell cell = sheet.getRow(0).getCell(0);
         CellStyle style = cell.getCellStyle();
 
-        String poundFmt = "\"\u00a3\"#,##0;[Red]\\-\"\u00a3\"#,##0";
-        // not expected normally, id of a custom format should be greater 
+        // not expected normally, id of a custom format should be greater
         // than BuiltinFormats.FIRST_USER_DEFINED_FORMAT_INDEX
         short  poundFmtIdx = 6;
 
@@ -94,16 +100,17 @@ public abstract class BaseTestDataFormat
         assertEquals(poundFmtIdx, dataFormat.getFormat(poundFmt));
         assertEquals(poundFmt, dataFormat.getFormat(poundFmtIdx));
     }
-    
+
+    @Test
     public void testReadbackFormat() throws IOException {
         readbackFormat("built-in format", "0.00");
         readbackFormat("overridden built-in format", poundFmt);
-        
+
         String customFormat = "#0.00 AM/PM";
         assertNotBuiltInFormat(customFormat);
         readbackFormat("custom format", customFormat);
     }
-    
+
     private void readbackFormat(String msg, String fmt) throws IOException {
         Workbook wb = _testDataProvider.createWorkbook();
         try {
@@ -115,118 +122,124 @@ public abstract class BaseTestDataFormat
             wb.close();
         }
     }
-    
-    public abstract void test58532();
+
+    @Test
+    public abstract void test58532() throws IOException;
     public void doTest58532Core(Workbook wb) {
         Sheet s = wb.getSheetAt(0);
         DataFormatter fmt = new DataFormatter();
         FormulaEvaluator eval = wb.getCreationHelper().createFormulaEvaluator();
-        
+
         // Column A is the raw values
         // Column B is the ##/#K/#M values
         // Column C is strings of what they should look like
         // Column D is the #.##/#.#K/#.#M values
         // Column E is strings of what they should look like
-        
+
         String formatKMWhole = "[>999999]#,,\"M\";[>999]#,\"K\";#";
         String formatKM3dp = "[>999999]#.000,,\"M\";[>999]#.000,\"K\";#.000";
-        
+
         // Check the formats are as expected
         Row headers = s.getRow(0);
         assertNotNull(headers);
         assertEquals(formatKMWhole, headers.getCell(1).getStringCellValue());
         assertEquals(formatKM3dp, headers.getCell(3).getStringCellValue());
-        
+
         Row r2 = s.getRow(1);
         assertNotNull(r2);
         assertEquals(formatKMWhole, r2.getCell(1).getCellStyle().getDataFormatString());
         assertEquals(formatKM3dp, r2.getCell(3).getCellStyle().getDataFormatString());
-        
+
         // For all of the contents rows, check that DataFormatter is able
         //  to format the cells to the same value as the one next to it
         for (int rn=1; rn<s.getLastRowNum(); rn++) {
             Row r = s.getRow(rn);
             if (r == null) break;
-            
+
             double value = r.getCell(0).getNumericCellValue();
-            
+
             String expWhole = r.getCell(2).getStringCellValue();
             String exp3dp   = r.getCell(4).getStringCellValue();
-            
+
             assertEquals("Wrong formatting of " + value + " for row " + rn,
                          expWhole, fmt.formatCellValue(r.getCell(1), eval));
             assertEquals("Wrong formatting of " + value + " for row " + rn,
                          exp3dp, fmt.formatCellValue(r.getCell(3), eval));
         }
     }
-    
+
     /**
-     * Localised accountancy formats
+     * Localized accountancy formats
      */
-    public final void test58536() {
+    @Test
+    public final void test58536() throws IOException {
         Workbook wb = _testDataProvider.createWorkbook();
         DataFormatter formatter = new DataFormatter();
         DataFormat fmt = wb.createDataFormat();
         Sheet sheet = wb.createSheet();
         Row r = sheet.createRow(0);
-        
+
         char pound = '\u00A3';
         String formatUK  = "_-[$"+pound+"-809]* #,##0_-;\\-[$"+pound+"-809]* #,##0_-;_-[$"+pound+"-809]*
\"-\"??_-;_-@_-";
-        
+
         CellStyle cs = wb.createCellStyle();
         cs.setDataFormat(fmt.getFormat(formatUK));
-        
+
         Cell pve = r.createCell(0);
         pve.setCellValue(12345);
         pve.setCellStyle(cs);
-        
+
         Cell nve = r.createCell(1);
         nve.setCellValue(-12345);
         nve.setCellStyle(cs);
-        
+
         Cell zero = r.createCell(2);
         zero.setCellValue(0);
         zero.setCellStyle(cs);
-        
-        assertEquals(pound+"   12,345", formatter.formatCellValue(pve)); 
+
+        assertEquals(pound+"   12,345", formatter.formatCellValue(pve));
         assertEquals("-"+pound+"   12,345", formatter.formatCellValue(nve));
         // TODO Fix this to not have an extra 0 at the end
-        //assertEquals(pound+"   -  ", formatter.formatCellValue(zero)); 
+        //assertEquals(pound+"   -  ", formatter.formatCellValue(zero));
+        
+        wb.close();
     }
-    
+
     /**
      * Using a single quote (') instead of a comma (,) as
-     *  a number separator, eg 1000 -> 1'000 
+     *  a number separator, eg 1000 -> 1'000
      */
-    public final void test55265() {
+    @Test
+    public final void test55265() throws IOException {
         Workbook wb = _testDataProvider.createWorkbook();
         DataFormatter formatter = new DataFormatter();
         DataFormat fmt = wb.createDataFormat();
         Sheet sheet = wb.createSheet();
         Row r = sheet.createRow(0);
-        
+
         CellStyle cs = wb.createCellStyle();
         cs.setDataFormat(fmt.getFormat("#'##0"));
-        
+
         Cell zero = r.createCell(0);
         zero.setCellValue(0);
         zero.setCellStyle(cs);
-        
+
         Cell sml = r.createCell(1);
         sml.setCellValue(12);
         sml.setCellStyle(cs);
-        
+
         Cell med = r.createCell(2);
         med.setCellValue(1234);
         med.setCellStyle(cs);
-        
+
         Cell lge = r.createCell(3);
         lge.setCellValue(12345678);
         lge.setCellStyle(cs);
-        
-        assertEquals("0", formatter.formatCellValue(zero)); 
-        assertEquals("12", formatter.formatCellValue(sml)); 
-        assertEquals("1'234", formatter.formatCellValue(med)); 
-        assertEquals("12'345'678", formatter.formatCellValue(lge)); 
+
+        assertEquals("0", formatter.formatCellValue(zero));
+        assertEquals("12", formatter.formatCellValue(sml));
+        assertEquals("1'234", formatter.formatCellValue(med));
+        assertEquals("12'345'678", formatter.formatCellValue(lge));
+        wb.close();
     }
 }

Modified: poi/trunk/src/testcases/org/apache/poi/ss/usermodel/BaseTestSheetShiftRows.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/ss/usermodel/BaseTestSheetShiftRows.java?rev=1735706&r1=1735705&r2=1735706&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/ss/usermodel/BaseTestSheetShiftRows.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/ss/usermodel/BaseTestSheetShiftRows.java Fri Mar
18 23:12:28 2016
@@ -168,16 +168,16 @@ public abstract class BaseTestSheetShift
         assertEquals(3, sheet.getLastRowNum());
 
         // Verify comments are in the position expected
-        assertNotNull(sheet.getCellComment(0,0));
-        assertNull(sheet.getCellComment(1,0));
-        assertNotNull(sheet.getCellComment(2,0));
-        assertNotNull(sheet.getCellComment(3,0));
+        assertNotNull(sheet.getCellComment(new CellAddress(0,0)));
+        assertNull(sheet.getCellComment(new CellAddress(1,0)));
+        assertNotNull(sheet.getCellComment(new CellAddress(2,0)));
+        assertNotNull(sheet.getCellComment(new CellAddress(3,0)));
 
-        String comment1 = sheet.getCellComment(0,0).getString().getString();
+        String comment1 = sheet.getCellComment(new CellAddress(0,0)).getString().getString();
         assertEquals(comment1,"comment top row1 (index0)\n");
-        String comment3 = sheet.getCellComment(2,0).getString().getString();
+        String comment3 = sheet.getCellComment(new CellAddress(2,0)).getString().getString();
         assertEquals(comment3,"comment top row3 (index2)\n");
-        String comment4 = sheet.getCellComment(3,0).getString().getString();
+        String comment4 = sheet.getCellComment(new CellAddress(3,0)).getString().getString();
         assertEquals(comment4,"comment top row4 (index3)\n");
 
         //Workbook wbBack = _testDataProvider.writeOutAndReadBack(wb);
@@ -187,17 +187,17 @@ public abstract class BaseTestSheetShift
 
         // Test that comments were shifted as expected
         assertEquals(4, sheet.getLastRowNum());
-        assertNotNull(sheet.getCellComment(0,0));
-        assertNull(sheet.getCellComment(1,0));
-        assertNull(sheet.getCellComment(2,0));
-        assertNotNull(sheet.getCellComment(3,0));
-        assertNotNull(sheet.getCellComment(4,0));
+        assertNotNull(sheet.getCellComment(new CellAddress(0,0)));
+        assertNull(sheet.getCellComment(new CellAddress(1,0)));
+        assertNull(sheet.getCellComment(new CellAddress(2,0)));
+        assertNotNull(sheet.getCellComment(new CellAddress(3,0)));
+        assertNotNull(sheet.getCellComment(new CellAddress(4,0)));
 
-        String comment1_shifted = sheet.getCellComment(0,0).getString().getString();
+        String comment1_shifted = sheet.getCellComment(new CellAddress(0,0)).getString().getString();
         assertEquals(comment1,comment1_shifted);
-        String comment3_shifted = sheet.getCellComment(3,0).getString().getString();
+        String comment3_shifted = sheet.getCellComment(new CellAddress(3,0)).getString().getString();
         assertEquals(comment3,comment3_shifted);
-        String comment4_shifted = sheet.getCellComment(4,0).getString().getString();
+        String comment4_shifted = sheet.getCellComment(new CellAddress(4,0)).getString().getString();
         assertEquals(comment4,comment4_shifted);
 
         // Write out and read back in again
@@ -209,17 +209,17 @@ public abstract class BaseTestSheetShift
         assertEquals(4, sheet.getLastRowNum());
 
         // Verify comments are in the position expected after the shift
-        assertNotNull(sheet.getCellComment(0,0));
-        assertNull(sheet.getCellComment(1,0));
-        assertNull(sheet.getCellComment(2,0));
-        assertNotNull(sheet.getCellComment(3,0));
-        assertNotNull(sheet.getCellComment(4,0));
+        assertNotNull(sheet.getCellComment(new CellAddress(0,0)));
+        assertNull(sheet.getCellComment(new CellAddress(1,0)));
+        assertNull(sheet.getCellComment(new CellAddress(2,0)));
+        assertNotNull(sheet.getCellComment(new CellAddress(3,0)));
+        assertNotNull(sheet.getCellComment(new CellAddress(4,0)));
 
-        comment1_shifted = sheet.getCellComment(0,0).getString().getString();
+        comment1_shifted = sheet.getCellComment(new CellAddress(0,0)).getString().getString();
         assertEquals(comment1,comment1_shifted);
-        comment3_shifted = sheet.getCellComment(3,0).getString().getString();
+        comment3_shifted = sheet.getCellComment(new CellAddress(3,0)).getString().getString();
         assertEquals(comment3,comment3_shifted);
-        comment4_shifted = sheet.getCellComment(4,0).getString().getString();
+        comment4_shifted = sheet.getCellComment(new CellAddress(4,0)).getString().getString();
         assertEquals(comment4,comment4_shifted);
 
         // Shifting back up again, now two rows
@@ -231,15 +231,15 @@ public abstract class BaseTestSheetShift
         	assertEquals(2, sheet.getLastRowNum());
         	
         	// Verify comments are in the position expected
-        	assertNull("Had: " + (sheet.getCellComment(0,0) == null ? "null" : sheet.getCellComment(0,0).getString()),
-        			sheet.getCellComment(0,0));
-        	assertNotNull(sheet.getCellComment(1,0));
-        	assertNotNull(sheet.getCellComment(2,0));
+        	assertNull("Had: " + (sheet.getCellComment(new CellAddress(0,0)) == null ? "null"
: sheet.getCellComment(new CellAddress(0,0)).getString()),
+        			sheet.getCellComment(new CellAddress(0,0)));
+        	assertNotNull(sheet.getCellComment(new CellAddress(1,0)));
+        	assertNotNull(sheet.getCellComment(new CellAddress(2,0)));
         }
 
-        comment1 = sheet.getCellComment(1,0).getString().getString();
+        comment1 = sheet.getCellComment(new CellAddress(1,0)).getString().getString();
         assertEquals(comment1,"comment top row3 (index2)\n");
-        String comment2 = sheet.getCellComment(2,0).getString().getString();
+        String comment2 = sheet.getCellComment(new CellAddress(2,0)).getString().getString();
         assertEquals(comment2,"comment top row4 (index3)\n");
         
         wb2.close();
@@ -342,6 +342,7 @@ public abstract class BaseTestSheetShift
         expectedMergedRegions.add(C4_D8);
         
         assertEquals(expectedMergedRegions, sheet.getMergedRegions());
+        wb.close();
     }
     
     



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


Mime
View raw message