]> source.dussan.org Git - poi.git/commitdiff
whitespace
authorJaven O'Neal <onealj@apache.org>
Mon, 30 Nov 2015 04:50:18 +0000 (04:50 +0000)
committerJaven O'Neal <onealj@apache.org>
Mon, 30 Nov 2015 04:50:18 +0000 (04:50 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1717167 13f79535-47bb-0310-9956-ffa450edef68

src/testcases/org/apache/poi/ss/usermodel/BaseTestCell.java

index 3fc7fd669a0a00a8f4247fef2ea5bb31dba770cb..fc0260b7648e1aded9287ab0c853f359dbf87732 100644 (file)
@@ -43,297 +43,297 @@ import junit.framework.AssertionFailedError;
 @SuppressWarnings("deprecation")
 public abstract class BaseTestCell {
 
-       protected final ITestDataProvider _testDataProvider;
-
-       /**
-        * @param testDataProvider an object that provides test data in HSSF / XSSF specific way
-        */
-       protected BaseTestCell(ITestDataProvider testDataProvider) {
-               _testDataProvider = testDataProvider;
-       }
-
-       @Test
-       public void testSetValues() throws Exception {
-               Workbook book = _testDataProvider.createWorkbook();
-               Sheet sheet = book.createSheet("test");
-               Row row = sheet.createRow(0);
-
-               CreationHelper factory = book.getCreationHelper();
-               Cell cell = row.createCell(0);
-
-               cell.setCellValue(1.2);
-               assertEquals(1.2, cell.getNumericCellValue(), 0.0001);
-               assertEquals(Cell.CELL_TYPE_NUMERIC, cell.getCellType());
-               assertProhibitedValueAccess(cell, Cell.CELL_TYPE_BOOLEAN, Cell.CELL_TYPE_STRING,
-                               Cell.CELL_TYPE_FORMULA, Cell.CELL_TYPE_ERROR);
-
-               cell.setCellValue(false);
-               assertEquals(false, cell.getBooleanCellValue());
-               assertEquals(Cell.CELL_TYPE_BOOLEAN, cell.getCellType());
-               cell.setCellValue(true);
-               assertEquals(true, cell.getBooleanCellValue());
-               assertProhibitedValueAccess(cell, Cell.CELL_TYPE_NUMERIC, Cell.CELL_TYPE_STRING,
-                               Cell.CELL_TYPE_FORMULA, Cell.CELL_TYPE_ERROR);
-
-               cell.setCellValue(factory.createRichTextString("Foo"));
-               assertEquals("Foo", cell.getRichStringCellValue().getString());
-               assertEquals("Foo", cell.getStringCellValue());
-               assertEquals(Cell.CELL_TYPE_STRING, cell.getCellType());
-               assertProhibitedValueAccess(cell, Cell.CELL_TYPE_NUMERIC, Cell.CELL_TYPE_BOOLEAN,
-                               Cell.CELL_TYPE_FORMULA, Cell.CELL_TYPE_ERROR);
-
-               cell.setCellValue("345");
-               assertEquals("345", cell.getRichStringCellValue().getString());
-               assertEquals("345", cell.getStringCellValue());
-               assertEquals(Cell.CELL_TYPE_STRING, cell.getCellType());
-               assertProhibitedValueAccess(cell, Cell.CELL_TYPE_NUMERIC, Cell.CELL_TYPE_BOOLEAN,
-                               Cell.CELL_TYPE_FORMULA, Cell.CELL_TYPE_ERROR);
-
-               Calendar c = LocaleUtil.getLocaleCalendar();
-               c.setTimeInMillis(123456789);
-               cell.setCellValue(c.getTime());
-               assertEquals(c.getTime().getTime(), cell.getDateCellValue().getTime());
-               assertEquals(Cell.CELL_TYPE_NUMERIC, cell.getCellType());
-               assertProhibitedValueAccess(cell, Cell.CELL_TYPE_BOOLEAN, Cell.CELL_TYPE_STRING,
-                               Cell.CELL_TYPE_FORMULA, Cell.CELL_TYPE_ERROR);
-
-               cell.setCellValue(c);
-               assertEquals(c.getTime().getTime(), cell.getDateCellValue().getTime());
-               assertEquals(Cell.CELL_TYPE_NUMERIC, cell.getCellType());
-               assertProhibitedValueAccess(cell, Cell.CELL_TYPE_BOOLEAN, Cell.CELL_TYPE_STRING,
-                               Cell.CELL_TYPE_FORMULA, Cell.CELL_TYPE_ERROR);
-
-               cell.setCellErrorValue(FormulaError.NA.getCode());
-               assertEquals(FormulaError.NA.getCode(), cell.getErrorCellValue());
-               assertEquals(Cell.CELL_TYPE_ERROR, cell.getCellType());
-               assertProhibitedValueAccess(cell, Cell.CELL_TYPE_NUMERIC, Cell.CELL_TYPE_BOOLEAN,
-                               Cell.CELL_TYPE_FORMULA, Cell.CELL_TYPE_STRING);
-               
-               book.close();
-       }
-
-       private static void assertProhibitedValueAccess(Cell cell, int ... types){
-               for(int type : types){
-                       try {
-                               switch (type) {
-                                       case Cell.CELL_TYPE_NUMERIC:
-                                               cell.getNumericCellValue();
-                                               break;
-                                       case Cell.CELL_TYPE_STRING:
-                                               cell.getStringCellValue();
-                                               break;
-                                       case Cell.CELL_TYPE_BOOLEAN:
-                                               cell.getBooleanCellValue();
-                                               break;
-                                       case Cell.CELL_TYPE_FORMULA:
-                                               cell.getCellFormula();
-                                               break;
-                                       case Cell.CELL_TYPE_ERROR:
-                                               cell.getErrorCellValue();
-                                               break;
-                               }
-                               fail("Should get exception when reading cell type (" + type + ").");
-                       } catch (IllegalStateException e){
-                               // expected during successful test
-                               assertTrue(e.getMessage().startsWith("Cannot get a"));
-                       }
-               }
-       }
-
-       /**
-        * test that Boolean (BoolErrRecord) are supported properly.
-        * @see testErr
-        */
-       @Test
-       public void testBool() throws IOException {
-
-               Workbook wb1 = _testDataProvider.createWorkbook();
-               Sheet s = wb1.createSheet("testSheet1");
-               Row r;
-               Cell c;
-               // B1
-               r = s.createRow(0);
-               c=r.createCell(1);
-               assumeTrue(0 == c.getRowIndex());
-               assumeTrue(1 == c.getColumnIndex());
-               c.setCellValue(true);
-
-               // C1
-               c=r.createCell(2);
-               assumeTrue(0 == c.getRowIndex());
-               assumeTrue(2 == c.getColumnIndex());
-               c.setCellValue(false);
-
-               Workbook wb2 = _testDataProvider.writeOutAndReadBack(wb1);
-               wb1.close();
-               
-               s = wb2.getSheet("testSheet1");
-               r = s.getRow(0);
-               assumeTrue("Row 1 should have 2 cells", 2 == r.getPhysicalNumberOfCells());
-               
-               c = r.getCell(1);
-               assumeTrue(0 == c.getRowIndex());
+    protected final ITestDataProvider _testDataProvider;
+
+    /**
+     * @param testDataProvider an object that provides test data in HSSF / XSSF specific way
+     */
+    protected BaseTestCell(ITestDataProvider testDataProvider) {
+        _testDataProvider = testDataProvider;
+    }
+
+    @Test
+    public void testSetValues() throws Exception {
+        Workbook book = _testDataProvider.createWorkbook();
+        Sheet sheet = book.createSheet("test");
+        Row row = sheet.createRow(0);
+
+        CreationHelper factory = book.getCreationHelper();
+        Cell cell = row.createCell(0);
+
+        cell.setCellValue(1.2);
+        assertEquals(1.2, cell.getNumericCellValue(), 0.0001);
+        assertEquals(Cell.CELL_TYPE_NUMERIC, cell.getCellType());
+        assertProhibitedValueAccess(cell, Cell.CELL_TYPE_BOOLEAN, Cell.CELL_TYPE_STRING,
+                Cell.CELL_TYPE_FORMULA, Cell.CELL_TYPE_ERROR);
+
+        cell.setCellValue(false);
+        assertEquals(false, cell.getBooleanCellValue());
+        assertEquals(Cell.CELL_TYPE_BOOLEAN, cell.getCellType());
+        cell.setCellValue(true);
+        assertEquals(true, cell.getBooleanCellValue());
+        assertProhibitedValueAccess(cell, Cell.CELL_TYPE_NUMERIC, Cell.CELL_TYPE_STRING,
+                Cell.CELL_TYPE_FORMULA, Cell.CELL_TYPE_ERROR);
+
+        cell.setCellValue(factory.createRichTextString("Foo"));
+        assertEquals("Foo", cell.getRichStringCellValue().getString());
+        assertEquals("Foo", cell.getStringCellValue());
+        assertEquals(Cell.CELL_TYPE_STRING, cell.getCellType());
+        assertProhibitedValueAccess(cell, Cell.CELL_TYPE_NUMERIC, Cell.CELL_TYPE_BOOLEAN,
+                Cell.CELL_TYPE_FORMULA, Cell.CELL_TYPE_ERROR);
+
+        cell.setCellValue("345");
+        assertEquals("345", cell.getRichStringCellValue().getString());
+        assertEquals("345", cell.getStringCellValue());
+        assertEquals(Cell.CELL_TYPE_STRING, cell.getCellType());
+        assertProhibitedValueAccess(cell, Cell.CELL_TYPE_NUMERIC, Cell.CELL_TYPE_BOOLEAN,
+                Cell.CELL_TYPE_FORMULA, Cell.CELL_TYPE_ERROR);
+
+        Calendar c = LocaleUtil.getLocaleCalendar();
+        c.setTimeInMillis(123456789);
+        cell.setCellValue(c.getTime());
+        assertEquals(c.getTime().getTime(), cell.getDateCellValue().getTime());
+        assertEquals(Cell.CELL_TYPE_NUMERIC, cell.getCellType());
+        assertProhibitedValueAccess(cell, Cell.CELL_TYPE_BOOLEAN, Cell.CELL_TYPE_STRING,
+                Cell.CELL_TYPE_FORMULA, Cell.CELL_TYPE_ERROR);
+
+        cell.setCellValue(c);
+        assertEquals(c.getTime().getTime(), cell.getDateCellValue().getTime());
+        assertEquals(Cell.CELL_TYPE_NUMERIC, cell.getCellType());
+        assertProhibitedValueAccess(cell, Cell.CELL_TYPE_BOOLEAN, Cell.CELL_TYPE_STRING,
+                Cell.CELL_TYPE_FORMULA, Cell.CELL_TYPE_ERROR);
+
+        cell.setCellErrorValue(FormulaError.NA.getCode());
+        assertEquals(FormulaError.NA.getCode(), cell.getErrorCellValue());
+        assertEquals(Cell.CELL_TYPE_ERROR, cell.getCellType());
+        assertProhibitedValueAccess(cell, Cell.CELL_TYPE_NUMERIC, Cell.CELL_TYPE_BOOLEAN,
+                Cell.CELL_TYPE_FORMULA, Cell.CELL_TYPE_STRING);
+        
+        book.close();
+    }
+
+    private static void assertProhibitedValueAccess(Cell cell, int ... types){
+        for(int type : types){
+            try {
+                switch (type) {
+                    case Cell.CELL_TYPE_NUMERIC:
+                        cell.getNumericCellValue();
+                        break;
+                    case Cell.CELL_TYPE_STRING:
+                        cell.getStringCellValue();
+                        break;
+                    case Cell.CELL_TYPE_BOOLEAN:
+                        cell.getBooleanCellValue();
+                        break;
+                    case Cell.CELL_TYPE_FORMULA:
+                        cell.getCellFormula();
+                        break;
+                    case Cell.CELL_TYPE_ERROR:
+                        cell.getErrorCellValue();
+                        break;
+                }
+                fail("Should get exception when reading cell type (" + type + ").");
+            } catch (IllegalStateException e){
+                // expected during successful test
+                assertTrue(e.getMessage().startsWith("Cannot get a"));
+            }
+        }
+    }
+
+    /**
+     * test that Boolean (BoolErrRecord) are supported properly.
+     * @see testErr
+     */
+    @Test
+    public void testBool() throws IOException {
+
+        Workbook wb1 = _testDataProvider.createWorkbook();
+        Sheet s = wb1.createSheet("testSheet1");
+        Row r;
+        Cell c;
+        // B1
+        r = s.createRow(0);
+        c=r.createCell(1);
+        assumeTrue(0 == c.getRowIndex());
         assumeTrue(1 == c.getColumnIndex());
-               assertEquals(Cell.CELL_TYPE_BOOLEAN, c.getCellType());
-               assertEquals("B1 value", true, c.getBooleanCellValue());
-               
-               c = r.getCell(2);
-               assumeTrue(0 == c.getRowIndex());
-               assumeTrue(2 == c.getColumnIndex());
-               assertEquals(Cell.CELL_TYPE_BOOLEAN, c.getCellType());
-               assertEquals("C1 value", false, c.getBooleanCellValue());
-               
-               wb2.close();
-       }
-       
-       /**
-        * test that Error types (BoolErrRecord) are supported properly.
-        * @see testBool
-        */
-       @Test
-       public void testErr() throws IOException {
-
-               Workbook wb1 = _testDataProvider.createWorkbook();
-               Sheet s = wb1.createSheet("testSheet1");
-               Row r;
-               Cell c;
-
-               // B1
-               r = s.createRow(1);
-               c=r.createCell(1);
-               assumeTrue(0 == c.getRowIndex());
-               assumeTrue(1 == c.getColumnIndex());
-               c.setCellErrorValue(FormulaError.NULL.getCode());
-
-               // C1
-               c=r.createCell(2);
-               assumeTrue(0 == c.getRowIndex());
-               assumeTrue(2 == c.getColumnIndex());
-               c.setCellErrorValue(FormulaError.DIV0.getCode());
-
-               Workbook wb2 = _testDataProvider.writeOutAndReadBack(wb1);
-               wb1.close();
-
-               s = wb2.getSheet("testSheet1");
-
-               r = s.getRow(0);
-               assumeTrue("Row 1 should have 2 cells", 2 == r.getPhysicalNumberOfCells());
-
-               c = r.getCell(1);
-               assertEquals(Cell.CELL_TYPE_ERROR, c.getCellType());
-               assertEquals("B2 value == #NULL!", FormulaError.NULL.getCode(), c.getErrorCellValue());
-
-               c = r.getCell(2);
-               assertEquals(Cell.CELL_TYPE_ERROR, c.getCellType());
-               assertEquals("C2 value == #DIV/0!", FormulaError.DIV0.getCode(), c.getErrorCellValue());
-
-               wb2.close();
-       }
-
-       /**
-        * test that Cell Styles being applied to formulas remain intact
-        */
-       @Test
-       public void testFormulaStyle() throws Exception {
-
-               Workbook wb1 = _testDataProvider.createWorkbook();
-               Sheet s = wb1.createSheet("testSheet1");
-               Row r = null;
-               Cell c = null;
-               CellStyle cs = wb1.createCellStyle();
-               Font f = wb1.createFont();
-               f.setFontHeightInPoints((short) 20);
-               f.setColor(IndexedColors.RED.getIndex());
-               f.setBoldweight(Font.BOLDWEIGHT_BOLD);
-               f.setFontName("Arial Unicode MS");
-               cs.setFillBackgroundColor((short)3);
-               cs.setFont(f);
-               cs.setBorderTop((short)1);
-               cs.setBorderRight((short)1);
-               cs.setBorderLeft((short)1);
-               cs.setBorderBottom((short)1);
-
-               r = s.createRow(0);
-               c=r.createCell(0);
-               c.setCellStyle(cs);
-               c.setCellFormula("2*3");
-
-               Workbook wb2 = _testDataProvider.writeOutAndReadBack(wb1);
-               wb1.close();
-               s = wb2.getSheetAt(0);
-               r = s.getRow(0);
-               c = r.getCell(0);
-
-               assertTrue("Formula Cell at 0,0", (c.getCellType()==Cell.CELL_TYPE_FORMULA));
-               cs = c.getCellStyle();
-
-               assertNotNull("Formula Cell Style", cs);
-               assertTrue("Font Index Matches", (cs.getFontIndex() == f.getIndex()));
-               assertTrue("Top Border", (cs.getBorderTop() == (short)1));
-               assertTrue("Left Border", (cs.getBorderLeft() == (short)1));
-               assertTrue("Right Border", (cs.getBorderRight() == (short)1));
-               assertTrue("Bottom Border", (cs.getBorderBottom() == (short)1));
-               wb2.close();
-       }
-
-       /**tests the toString() method of HSSFCell*/
+        c.setCellValue(true);
+
+        // C1
+        c=r.createCell(2);
+        assumeTrue(0 == c.getRowIndex());
+        assumeTrue(2 == c.getColumnIndex());
+        c.setCellValue(false);
+
+        Workbook wb2 = _testDataProvider.writeOutAndReadBack(wb1);
+        wb1.close();
+        
+        s = wb2.getSheet("testSheet1");
+        r = s.getRow(0);
+        assumeTrue("Row 1 should have 2 cells", 2 == r.getPhysicalNumberOfCells());
+        
+        c = r.getCell(1);
+        assumeTrue(0 == c.getRowIndex());
+        assumeTrue(1 == c.getColumnIndex());
+        assertEquals(Cell.CELL_TYPE_BOOLEAN, c.getCellType());
+        assertEquals("B1 value", true, c.getBooleanCellValue());
+        
+        c = r.getCell(2);
+        assumeTrue(0 == c.getRowIndex());
+        assumeTrue(2 == c.getColumnIndex());
+        assertEquals(Cell.CELL_TYPE_BOOLEAN, c.getCellType());
+        assertEquals("C1 value", false, c.getBooleanCellValue());
+        
+        wb2.close();
+    }
+    
+    /**
+     * test that Error types (BoolErrRecord) are supported properly.
+     * @see testBool
+     */
     @Test
-       public void testToString() throws Exception {
-               Workbook wb1 = _testDataProvider.createWorkbook();
-               Row r = wb1.createSheet("Sheet1").createRow(0);
-               CreationHelper factory = wb1.getCreationHelper();
-
-               r.createCell(0).setCellValue(true);
-               r.createCell(1).setCellValue(1.5);
-               r.createCell(2).setCellValue(factory.createRichTextString("Astring"));
-               r.createCell(3).setCellErrorValue((byte)ErrorConstants.ERROR_DIV_0);
-               r.createCell(4).setCellFormula("A1+B1");
-
-               assertEquals("Boolean", "TRUE", r.getCell(0).toString());
-               assertEquals("Numeric", "1.5", r.getCell(1).toString());
-               assertEquals("String", "Astring", r.getCell(2).toString());
-               assertEquals("Error", "#DIV/0!", r.getCell(3).toString());
-               assertEquals("Formula", "A1+B1", r.getCell(4).toString());
-
-               //Write out the file, read it in, and then check cell values
-               Workbook wb2 = _testDataProvider.writeOutAndReadBack(wb1);
-               wb1.close();
-
-               r = wb2.getSheetAt(0).getRow(0);
-               assertEquals("Boolean", "TRUE", r.getCell(0).toString());
-               assertEquals("Numeric", "1.5", r.getCell(1).toString());
-               assertEquals("String", "Astring", r.getCell(2).toString());
-               assertEquals("Error", "#DIV/0!", r.getCell(3).toString());
-               assertEquals("Formula", "A1+B1", r.getCell(4).toString());
-               wb2.close();
-       }
-
-       /**
-        *  Test that setting cached formula result keeps the cell type
-        */
-       @Test
-       public void testSetFormulaValue() throws Exception {
-               Workbook wb = _testDataProvider.createWorkbook();
-               Sheet s = wb.createSheet();
-               Row r = s.createRow(0);
-
-               Cell c1 = r.createCell(0);
-               c1.setCellFormula("NA()");
-               assertEquals(0.0, c1.getNumericCellValue(), 0.0);
-               assertEquals(Cell.CELL_TYPE_NUMERIC, c1.getCachedFormulaResultType());
-               c1.setCellValue(10);
-               assertEquals(10.0, c1.getNumericCellValue(), 0.0);
-               assertEquals(Cell.CELL_TYPE_FORMULA, c1.getCellType());
-               assertEquals(Cell.CELL_TYPE_NUMERIC, c1.getCachedFormulaResultType());
-
-               Cell c2 = r.createCell(1);
-               c2.setCellFormula("NA()");
-               assertEquals(0.0, c2.getNumericCellValue(), 0.0);
-               assertEquals(Cell.CELL_TYPE_NUMERIC, c2.getCachedFormulaResultType());
-               c2.setCellValue("I changed!");
-               assertEquals("I changed!", c2.getStringCellValue());
-               assertEquals(Cell.CELL_TYPE_FORMULA, c2.getCellType());
-               assertEquals(Cell.CELL_TYPE_STRING, c2.getCachedFormulaResultType());
+    public void testErr() throws IOException {
+
+        Workbook wb1 = _testDataProvider.createWorkbook();
+        Sheet s = wb1.createSheet("testSheet1");
+        Row r;
+        Cell c;
+
+        // B1
+        r = s.createRow(1);
+        c=r.createCell(1);
+        assumeTrue(0 == c.getRowIndex());
+        assumeTrue(1 == c.getColumnIndex());
+        c.setCellErrorValue(FormulaError.NULL.getCode());
+
+        // C1
+        c=r.createCell(2);
+        assumeTrue(0 == c.getRowIndex());
+        assumeTrue(2 == c.getColumnIndex());
+        c.setCellErrorValue(FormulaError.DIV0.getCode());
+
+        Workbook wb2 = _testDataProvider.writeOutAndReadBack(wb1);
+        wb1.close();
+
+        s = wb2.getSheet("testSheet1");
+
+        r = s.getRow(0);
+        assumeTrue("Row 1 should have 2 cells", 2 == r.getPhysicalNumberOfCells());
+
+        c = r.getCell(1);
+        assertEquals(Cell.CELL_TYPE_ERROR, c.getCellType());
+        assertEquals("B2 value == #NULL!", FormulaError.NULL.getCode(), c.getErrorCellValue());
+
+        c = r.getCell(2);
+        assertEquals(Cell.CELL_TYPE_ERROR, c.getCellType());
+        assertEquals("C2 value == #DIV/0!", FormulaError.DIV0.getCode(), c.getErrorCellValue());
+
+        wb2.close();
+    }
+
+    /**
+     * test that Cell Styles being applied to formulas remain intact
+     */
+    @Test
+    public void testFormulaStyle() throws Exception {
+
+        Workbook wb1 = _testDataProvider.createWorkbook();
+        Sheet s = wb1.createSheet("testSheet1");
+        Row r = null;
+        Cell c = null;
+        CellStyle cs = wb1.createCellStyle();
+        Font f = wb1.createFont();
+        f.setFontHeightInPoints((short) 20);
+        f.setColor(IndexedColors.RED.getIndex());
+        f.setBoldweight(Font.BOLDWEIGHT_BOLD);
+        f.setFontName("Arial Unicode MS");
+        cs.setFillBackgroundColor((short)3);
+        cs.setFont(f);
+        cs.setBorderTop((short)1);
+        cs.setBorderRight((short)1);
+        cs.setBorderLeft((short)1);
+        cs.setBorderBottom((short)1);
+
+        r = s.createRow(0);
+        c=r.createCell(0);
+        c.setCellStyle(cs);
+        c.setCellFormula("2*3");
+
+        Workbook wb2 = _testDataProvider.writeOutAndReadBack(wb1);
+        wb1.close();
+        s = wb2.getSheetAt(0);
+        r = s.getRow(0);
+        c = r.getCell(0);
+
+        assertTrue("Formula Cell at 0,0", (c.getCellType()==Cell.CELL_TYPE_FORMULA));
+        cs = c.getCellStyle();
+
+        assertNotNull("Formula Cell Style", cs);
+        assertTrue("Font Index Matches", (cs.getFontIndex() == f.getIndex()));
+        assertTrue("Top Border", (cs.getBorderTop() == (short)1));
+        assertTrue("Left Border", (cs.getBorderLeft() == (short)1));
+        assertTrue("Right Border", (cs.getBorderRight() == (short)1));
+        assertTrue("Bottom Border", (cs.getBorderBottom() == (short)1));
+        wb2.close();
+    }
+
+    /**tests the toString() method of HSSFCell*/
+    @Test
+    public void testToString() throws Exception {
+        Workbook wb1 = _testDataProvider.createWorkbook();
+        Row r = wb1.createSheet("Sheet1").createRow(0);
+        CreationHelper factory = wb1.getCreationHelper();
+
+        r.createCell(0).setCellValue(true);
+        r.createCell(1).setCellValue(1.5);
+        r.createCell(2).setCellValue(factory.createRichTextString("Astring"));
+        r.createCell(3).setCellErrorValue((byte)ErrorConstants.ERROR_DIV_0);
+        r.createCell(4).setCellFormula("A1+B1");
+
+        assertEquals("Boolean", "TRUE", r.getCell(0).toString());
+        assertEquals("Numeric", "1.5", r.getCell(1).toString());
+        assertEquals("String", "Astring", r.getCell(2).toString());
+        assertEquals("Error", "#DIV/0!", r.getCell(3).toString());
+        assertEquals("Formula", "A1+B1", r.getCell(4).toString());
+
+        //Write out the file, read it in, and then check cell values
+        Workbook wb2 = _testDataProvider.writeOutAndReadBack(wb1);
+        wb1.close();
+
+        r = wb2.getSheetAt(0).getRow(0);
+        assertEquals("Boolean", "TRUE", r.getCell(0).toString());
+        assertEquals("Numeric", "1.5", r.getCell(1).toString());
+        assertEquals("String", "Astring", r.getCell(2).toString());
+        assertEquals("Error", "#DIV/0!", r.getCell(3).toString());
+        assertEquals("Formula", "A1+B1", r.getCell(4).toString());
+        wb2.close();
+    }
+
+    /**
+     *  Test that setting cached formula result keeps the cell type
+     */
+    @Test
+    public void testSetFormulaValue() throws Exception {
+        Workbook wb = _testDataProvider.createWorkbook();
+        Sheet s = wb.createSheet();
+        Row r = s.createRow(0);
+
+        Cell c1 = r.createCell(0);
+        c1.setCellFormula("NA()");
+        assertEquals(0.0, c1.getNumericCellValue(), 0.0);
+        assertEquals(Cell.CELL_TYPE_NUMERIC, c1.getCachedFormulaResultType());
+        c1.setCellValue(10);
+        assertEquals(10.0, c1.getNumericCellValue(), 0.0);
+        assertEquals(Cell.CELL_TYPE_FORMULA, c1.getCellType());
+        assertEquals(Cell.CELL_TYPE_NUMERIC, c1.getCachedFormulaResultType());
+
+        Cell c2 = r.createCell(1);
+        c2.setCellFormula("NA()");
+        assertEquals(0.0, c2.getNumericCellValue(), 0.0);
+        assertEquals(Cell.CELL_TYPE_NUMERIC, c2.getCachedFormulaResultType());
+        c2.setCellValue("I changed!");
+        assertEquals("I changed!", c2.getStringCellValue());
+        assertEquals(Cell.CELL_TYPE_FORMULA, c2.getCellType());
+        assertEquals(Cell.CELL_TYPE_STRING, c2.getCachedFormulaResultType());
 
         //calglin Cell.setCellFormula(null) for a non-formula cell
         Cell c3 = r.createCell(2);
@@ -342,265 +342,265 @@ public abstract class BaseTestCell {
         wb.close();
 
     }
-       private Cell createACell() {
-               return _testDataProvider.createWorkbook().createSheet("Sheet1").createRow(0).createCell(0);
-       }
-       
-       /**
-        * bug 58452: Copy cell formulas containing unregistered function names
-        * Make sure that formulas with unknown/unregistered UDFs can be written to and read back from a file.
-        *
-        * @throws IOException
-        */
-       @Test
-       public void testFormulaWithUnknownUDF() throws IOException {
-               final Workbook wb1 = _testDataProvider.createWorkbook();
-               final FormulaEvaluator evaluator1 = wb1.getCreationHelper().createFormulaEvaluator();
-               try {
-                       final Cell cell1 = wb1.createSheet().createRow(0).createCell(0);
-                       final String formula = "myFunc(\"arg\")";
-                       cell1.setCellFormula(formula);
-                       confirmFormulaWithUnknownUDF(formula, cell1, evaluator1);
-                       
-                       final Workbook wb2 = _testDataProvider.writeOutAndReadBack(wb1);
-                       final FormulaEvaluator evaluator2 = wb2.getCreationHelper().createFormulaEvaluator();
-                       try {
-                               final Cell cell2 = wb2.getSheetAt(0).getRow(0).getCell(0);
-                               confirmFormulaWithUnknownUDF(formula, cell2, evaluator2);
-                       } finally {
-                               wb2.close();
-                       }
-               } finally {
-                       wb1.close();
-               }
-       }
-       
-       private static void confirmFormulaWithUnknownUDF(String expectedFormula, Cell cell, FormulaEvaluator evaluator) {
-               assertEquals(expectedFormula, cell.getCellFormula());
-               try {
-                       evaluator.evaluate(cell);
-                       fail("Expected NotImplementedFunctionException/NotImplementedException");
-               } catch (final org.apache.poi.ss.formula.eval.NotImplementedException e) {
-                       // expected
-               }
-       }
-
-       @Test
-       public void testChangeTypeStringToBool() {
-               Cell cell = createACell();
-
-               cell.setCellValue("TRUE");
-               assertEquals(Cell.CELL_TYPE_STRING, cell.getCellType());
-               try {
-                       cell.setCellType(Cell.CELL_TYPE_BOOLEAN);
-               } catch (ClassCastException e) {
-                       throw new AssertionFailedError(
-                                       "Identified bug in conversion of cell from text to boolean");
-               }
-
-               assertEquals(Cell.CELL_TYPE_BOOLEAN, cell.getCellType());
-               assertEquals(true, cell.getBooleanCellValue());
-               cell.setCellType(Cell.CELL_TYPE_STRING);
-               assertEquals("TRUE", cell.getRichStringCellValue().getString());
-
-               // 'false' text to bool and back
-               cell.setCellValue("FALSE");
-               cell.setCellType(Cell.CELL_TYPE_BOOLEAN);
-               assertEquals(Cell.CELL_TYPE_BOOLEAN, cell.getCellType());
-               assertEquals(false, cell.getBooleanCellValue());
-               cell.setCellType(Cell.CELL_TYPE_STRING);
-               assertEquals("FALSE", cell.getRichStringCellValue().getString());
-       }
-
-       @Test
-       public void testChangeTypeBoolToString() {
-               Cell cell = createACell();
-
-               cell.setCellValue(true);
-               try {
-                       cell.setCellType(Cell.CELL_TYPE_STRING);
-               } catch (IllegalStateException e) {
-                       if (e.getMessage().equals("Cannot get a text value from a boolean cell")) {
-                               throw new AssertionFailedError(
-                                               "Identified bug in conversion of cell from boolean to text");
-                       }
-                       throw e;
-               }
-               assertEquals("TRUE", cell.getRichStringCellValue().getString());
-       }
-
-       @Test
-       public void testChangeTypeErrorToNumber() {
-               Cell cell = createACell();
-               cell.setCellErrorValue((byte)ErrorConstants.ERROR_NAME);
-               try {
-                       cell.setCellValue(2.5);
-               } catch (ClassCastException e) {
-                       throw new AssertionFailedError("Identified bug 46479b");
-               }
-               assertEquals(2.5, cell.getNumericCellValue(), 0.0);
-       }
-
-       @Test
-       public void testChangeTypeErrorToBoolean() {
-               Cell cell = createACell();
-               cell.setCellErrorValue((byte)ErrorConstants.ERROR_NAME);
-               cell.setCellValue(true);
-               try {
-                       cell.getBooleanCellValue();
-               } catch (IllegalStateException e) {
-                       if (e.getMessage().equals("Cannot get a boolean value from a error cell")) {
-
-                               throw new AssertionFailedError("Identified bug 46479c");
-                       }
-                       throw e;
-               }
-               assertEquals(true, cell.getBooleanCellValue());
-       }
-
-       /**
-        * Test for a bug observed around svn r886733 when using
-        * {@link FormulaEvaluator#evaluateInCell(Cell)} with a
-        * string result type.
-        */
-       @Test
-       public void testConvertStringFormulaCell() {
-               Cell cellA1 = createACell();
-               cellA1.setCellFormula("\"abc\"");
-
-               // default cached formula result is numeric zero
-               assertEquals(0.0, cellA1.getNumericCellValue(), 0.0);
-
-               FormulaEvaluator fe = cellA1.getSheet().getWorkbook().getCreationHelper().createFormulaEvaluator();
-
-               fe.evaluateFormulaCell(cellA1);
-               assertEquals("abc", cellA1.getStringCellValue());
-
-               fe.evaluateInCell(cellA1);
-               if (cellA1.getStringCellValue().equals("")) {
-                       throw new AssertionFailedError("Identified bug with writing back formula result of type string");
-               }
-               assertEquals("abc", cellA1.getStringCellValue());
-       }
-       
-       /**
-        * similar to {@link #testConvertStringFormulaCell()} but  checks at a
-        * lower level that {#link {@link Cell#setCellType(int)} works properly
-        */
-       @Test
-       public void testSetTypeStringOnFormulaCell() {
-               Cell cellA1 = createACell();
-               FormulaEvaluator fe = cellA1.getSheet().getWorkbook().getCreationHelper().createFormulaEvaluator();
-
-               cellA1.setCellFormula("\"DEF\"");
-               fe.clearAllCachedResultValues();
-               fe.evaluateFormulaCell(cellA1);
-               assertEquals("DEF", cellA1.getStringCellValue());
-               cellA1.setCellType(Cell.CELL_TYPE_STRING);
-               assertEquals("DEF", cellA1.getStringCellValue());
-
-               cellA1.setCellFormula("25.061");
-               fe.clearAllCachedResultValues();
-               fe.evaluateFormulaCell(cellA1);
-               confirmCannotReadString(cellA1);
-               assertEquals(25.061, cellA1.getNumericCellValue(), 0.0);
-               cellA1.setCellType(Cell.CELL_TYPE_STRING);
-               assertEquals("25.061", cellA1.getStringCellValue());
-
-               cellA1.setCellFormula("TRUE");
-               fe.clearAllCachedResultValues();
-               fe.evaluateFormulaCell(cellA1);
-               confirmCannotReadString(cellA1);
-               assertEquals(true, cellA1.getBooleanCellValue());
-               cellA1.setCellType(Cell.CELL_TYPE_STRING);
-               assertEquals("TRUE", cellA1.getStringCellValue());
-
-               cellA1.setCellFormula("#NAME?");
-               fe.clearAllCachedResultValues();
-               fe.evaluateFormulaCell(cellA1);
-               confirmCannotReadString(cellA1);
-               assertEquals(ErrorConstants.ERROR_NAME, cellA1.getErrorCellValue());
-               cellA1.setCellType(Cell.CELL_TYPE_STRING);
-               assertEquals("#NAME?", cellA1.getStringCellValue());
-       }
-
-       private static void confirmCannotReadString(Cell cell) {
-               assertProhibitedValueAccess(cell, Cell.CELL_TYPE_STRING);
-       }
-
-       /**
-        * Test for bug in convertCellValueToBoolean to make sure that formula results get converted
-        */
-       @Test
-       public void testChangeTypeFormulaToBoolean() {
-               Cell cell = createACell();
-               cell.setCellFormula("1=1");
-               cell.setCellValue(true);
-               cell.setCellType(Cell.CELL_TYPE_BOOLEAN);
-               if (cell.getBooleanCellValue() == false) {
-                       throw new AssertionFailedError("Identified bug 46479d");
-               }
-               assertEquals(true, cell.getBooleanCellValue());
-       }
-
-       /**
-        * Bug 40296:     HSSFCell.setCellFormula throws
-        *   ClassCastException if cell is created using HSSFRow.createCell(short column, int type)
-        */
-       @Test
-       public void test40296() throws Exception {
-               Workbook wb1 = _testDataProvider.createWorkbook();
-               Sheet workSheet = wb1.createSheet("Sheet1");
-               Cell cell;
-               Row row = workSheet.createRow(0);
-
-               cell = row.createCell(0, Cell.CELL_TYPE_NUMERIC);
-               cell.setCellValue(1.0);
-               assertEquals(Cell.CELL_TYPE_NUMERIC, cell.getCellType());
-               assertEquals(1.0, cell.getNumericCellValue(), 0.0);
-
-               cell = row.createCell(1, Cell.CELL_TYPE_NUMERIC);
-               cell.setCellValue(2.0);
-               assertEquals(Cell.CELL_TYPE_NUMERIC, cell.getCellType());
-               assertEquals(2.0, cell.getNumericCellValue(), 0.0);
-
-               cell = row.createCell(2, Cell.CELL_TYPE_FORMULA);
-               cell.setCellFormula("SUM(A1:B1)");
-               assertEquals(Cell.CELL_TYPE_FORMULA, cell.getCellType());
-               assertEquals("SUM(A1:B1)", cell.getCellFormula());
-
-               //serialize and check again
-               Workbook wb2 = _testDataProvider.writeOutAndReadBack(wb1);
-               wb1.close();
-               row = wb2.getSheetAt(0).getRow(0);
-               cell = row.getCell(0);
-               assertEquals(Cell.CELL_TYPE_NUMERIC, cell.getCellType());
-               assertEquals(1.0, cell.getNumericCellValue(), 0.0);
-
-               cell = row.getCell(1);
-               assertEquals(Cell.CELL_TYPE_NUMERIC, cell.getCellType());
-               assertEquals(2.0, cell.getNumericCellValue(), 0.0);
-
-               cell = row.getCell(2);
-               assertEquals(Cell.CELL_TYPE_FORMULA, cell.getCellType());
-               assertEquals("SUM(A1:B1)", cell.getCellFormula());
-               wb2.close();
-       }
-
-       @Test
-       public void testSetStringInFormulaCell_bug44606() throws Exception {
-               Workbook wb = _testDataProvider.createWorkbook();
-               Cell cell = wb.createSheet("Sheet1").createRow(0).createCell(0);
-               cell.setCellFormula("B1&C1");
-               cell.setCellValue(wb.getCreationHelper().createRichTextString("hello"));
-               wb.close();
-       }
+    private Cell createACell() {
+        return _testDataProvider.createWorkbook().createSheet("Sheet1").createRow(0).createCell(0);
+    }
+    
+    /**
+     * bug 58452: Copy cell formulas containing unregistered function names
+     * Make sure that formulas with unknown/unregistered UDFs can be written to and read back from a file.
+     *
+     * @throws IOException
+     */
+    @Test
+    public void testFormulaWithUnknownUDF() throws IOException {
+        final Workbook wb1 = _testDataProvider.createWorkbook();
+        final FormulaEvaluator evaluator1 = wb1.getCreationHelper().createFormulaEvaluator();
+        try {
+            final Cell cell1 = wb1.createSheet().createRow(0).createCell(0);
+            final String formula = "myFunc(\"arg\")";
+            cell1.setCellFormula(formula);
+            confirmFormulaWithUnknownUDF(formula, cell1, evaluator1);
+            
+            final Workbook wb2 = _testDataProvider.writeOutAndReadBack(wb1);
+            final FormulaEvaluator evaluator2 = wb2.getCreationHelper().createFormulaEvaluator();
+            try {
+                final Cell cell2 = wb2.getSheetAt(0).getRow(0).getCell(0);
+                confirmFormulaWithUnknownUDF(formula, cell2, evaluator2);
+            } finally {
+                wb2.close();
+            }
+        } finally {
+            wb1.close();
+        }
+    }
+    
+    private static void confirmFormulaWithUnknownUDF(String expectedFormula, Cell cell, FormulaEvaluator evaluator) {
+        assertEquals(expectedFormula, cell.getCellFormula());
+        try {
+            evaluator.evaluate(cell);
+            fail("Expected NotImplementedFunctionException/NotImplementedException");
+        } catch (final org.apache.poi.ss.formula.eval.NotImplementedException e) {
+            // expected
+        }
+    }
+
+    @Test
+    public void testChangeTypeStringToBool() {
+        Cell cell = createACell();
+
+        cell.setCellValue("TRUE");
+        assertEquals(Cell.CELL_TYPE_STRING, cell.getCellType());
+        try {
+            cell.setCellType(Cell.CELL_TYPE_BOOLEAN);
+        } catch (ClassCastException e) {
+            throw new AssertionFailedError(
+                    "Identified bug in conversion of cell from text to boolean");
+        }
+
+        assertEquals(Cell.CELL_TYPE_BOOLEAN, cell.getCellType());
+        assertEquals(true, cell.getBooleanCellValue());
+        cell.setCellType(Cell.CELL_TYPE_STRING);
+        assertEquals("TRUE", cell.getRichStringCellValue().getString());
+
+        // 'false' text to bool and back
+        cell.setCellValue("FALSE");
+        cell.setCellType(Cell.CELL_TYPE_BOOLEAN);
+        assertEquals(Cell.CELL_TYPE_BOOLEAN, cell.getCellType());
+        assertEquals(false, cell.getBooleanCellValue());
+        cell.setCellType(Cell.CELL_TYPE_STRING);
+        assertEquals("FALSE", cell.getRichStringCellValue().getString());
+    }
+
+    @Test
+    public void testChangeTypeBoolToString() {
+        Cell cell = createACell();
+
+        cell.setCellValue(true);
+        try {
+            cell.setCellType(Cell.CELL_TYPE_STRING);
+        } catch (IllegalStateException e) {
+            if (e.getMessage().equals("Cannot get a text value from a boolean cell")) {
+                throw new AssertionFailedError(
+                        "Identified bug in conversion of cell from boolean to text");
+            }
+            throw e;
+        }
+        assertEquals("TRUE", cell.getRichStringCellValue().getString());
+    }
+
+    @Test
+    public void testChangeTypeErrorToNumber() {
+        Cell cell = createACell();
+        cell.setCellErrorValue((byte)ErrorConstants.ERROR_NAME);
+        try {
+            cell.setCellValue(2.5);
+        } catch (ClassCastException e) {
+            throw new AssertionFailedError("Identified bug 46479b");
+        }
+        assertEquals(2.5, cell.getNumericCellValue(), 0.0);
+    }
+
+    @Test
+    public void testChangeTypeErrorToBoolean() {
+        Cell cell = createACell();
+        cell.setCellErrorValue((byte)ErrorConstants.ERROR_NAME);
+        cell.setCellValue(true);
+        try {
+            cell.getBooleanCellValue();
+        } catch (IllegalStateException e) {
+            if (e.getMessage().equals("Cannot get a boolean value from a error cell")) {
+
+                throw new AssertionFailedError("Identified bug 46479c");
+            }
+            throw e;
+        }
+        assertEquals(true, cell.getBooleanCellValue());
+    }
+
+    /**
+     * Test for a bug observed around svn r886733 when using
+     * {@link FormulaEvaluator#evaluateInCell(Cell)} with a
+     * string result type.
+     */
+    @Test
+    public void testConvertStringFormulaCell() {
+        Cell cellA1 = createACell();
+        cellA1.setCellFormula("\"abc\"");
+
+        // default cached formula result is numeric zero
+        assertEquals(0.0, cellA1.getNumericCellValue(), 0.0);
+
+        FormulaEvaluator fe = cellA1.getSheet().getWorkbook().getCreationHelper().createFormulaEvaluator();
+
+        fe.evaluateFormulaCell(cellA1);
+        assertEquals("abc", cellA1.getStringCellValue());
+
+        fe.evaluateInCell(cellA1);
+        if (cellA1.getStringCellValue().equals("")) {
+            throw new AssertionFailedError("Identified bug with writing back formula result of type string");
+        }
+        assertEquals("abc", cellA1.getStringCellValue());
+    }
+    
+    /**
+     * similar to {@link #testConvertStringFormulaCell()} but  checks at a
+     * lower level that {#link {@link Cell#setCellType(int)} works properly
+     */
+    @Test
+    public void testSetTypeStringOnFormulaCell() {
+        Cell cellA1 = createACell();
+        FormulaEvaluator fe = cellA1.getSheet().getWorkbook().getCreationHelper().createFormulaEvaluator();
+
+        cellA1.setCellFormula("\"DEF\"");
+        fe.clearAllCachedResultValues();
+        fe.evaluateFormulaCell(cellA1);
+        assertEquals("DEF", cellA1.getStringCellValue());
+        cellA1.setCellType(Cell.CELL_TYPE_STRING);
+        assertEquals("DEF", cellA1.getStringCellValue());
+
+        cellA1.setCellFormula("25.061");
+        fe.clearAllCachedResultValues();
+        fe.evaluateFormulaCell(cellA1);
+        confirmCannotReadString(cellA1);
+        assertEquals(25.061, cellA1.getNumericCellValue(), 0.0);
+        cellA1.setCellType(Cell.CELL_TYPE_STRING);
+        assertEquals("25.061", cellA1.getStringCellValue());
+
+        cellA1.setCellFormula("TRUE");
+        fe.clearAllCachedResultValues();
+        fe.evaluateFormulaCell(cellA1);
+        confirmCannotReadString(cellA1);
+        assertEquals(true, cellA1.getBooleanCellValue());
+        cellA1.setCellType(Cell.CELL_TYPE_STRING);
+        assertEquals("TRUE", cellA1.getStringCellValue());
+
+        cellA1.setCellFormula("#NAME?");
+        fe.clearAllCachedResultValues();
+        fe.evaluateFormulaCell(cellA1);
+        confirmCannotReadString(cellA1);
+        assertEquals(ErrorConstants.ERROR_NAME, cellA1.getErrorCellValue());
+        cellA1.setCellType(Cell.CELL_TYPE_STRING);
+        assertEquals("#NAME?", cellA1.getStringCellValue());
+    }
+
+    private static void confirmCannotReadString(Cell cell) {
+        assertProhibitedValueAccess(cell, Cell.CELL_TYPE_STRING);
+    }
+
+    /**
+     * Test for bug in convertCellValueToBoolean to make sure that formula results get converted
+     */
+    @Test
+    public void testChangeTypeFormulaToBoolean() {
+        Cell cell = createACell();
+        cell.setCellFormula("1=1");
+        cell.setCellValue(true);
+        cell.setCellType(Cell.CELL_TYPE_BOOLEAN);
+        if (cell.getBooleanCellValue() == false) {
+            throw new AssertionFailedError("Identified bug 46479d");
+        }
+        assertEquals(true, cell.getBooleanCellValue());
+    }
+
+    /**
+     * Bug 40296:      HSSFCell.setCellFormula throws
+     *   ClassCastException if cell is created using HSSFRow.createCell(short column, int type)
+     */
+    @Test
+    public void test40296() throws Exception {
+        Workbook wb1 = _testDataProvider.createWorkbook();
+        Sheet workSheet = wb1.createSheet("Sheet1");
+        Cell cell;
+        Row row = workSheet.createRow(0);
+
+        cell = row.createCell(0, Cell.CELL_TYPE_NUMERIC);
+        cell.setCellValue(1.0);
+        assertEquals(Cell.CELL_TYPE_NUMERIC, cell.getCellType());
+        assertEquals(1.0, cell.getNumericCellValue(), 0.0);
+
+        cell = row.createCell(1, Cell.CELL_TYPE_NUMERIC);
+        cell.setCellValue(2.0);
+        assertEquals(Cell.CELL_TYPE_NUMERIC, cell.getCellType());
+        assertEquals(2.0, cell.getNumericCellValue(), 0.0);
+
+        cell = row.createCell(2, Cell.CELL_TYPE_FORMULA);
+        cell.setCellFormula("SUM(A1:B1)");
+        assertEquals(Cell.CELL_TYPE_FORMULA, cell.getCellType());
+        assertEquals("SUM(A1:B1)", cell.getCellFormula());
+
+        //serialize and check again
+        Workbook wb2 = _testDataProvider.writeOutAndReadBack(wb1);
+        wb1.close();
+        row = wb2.getSheetAt(0).getRow(0);
+        cell = row.getCell(0);
+        assertEquals(Cell.CELL_TYPE_NUMERIC, cell.getCellType());
+        assertEquals(1.0, cell.getNumericCellValue(), 0.0);
+
+        cell = row.getCell(1);
+        assertEquals(Cell.CELL_TYPE_NUMERIC, cell.getCellType());
+        assertEquals(2.0, cell.getNumericCellValue(), 0.0);
+
+        cell = row.getCell(2);
+        assertEquals(Cell.CELL_TYPE_FORMULA, cell.getCellType());
+        assertEquals("SUM(A1:B1)", cell.getCellFormula());
+        wb2.close();
+    }
+
+    @Test
+    public void testSetStringInFormulaCell_bug44606() throws Exception {
+        Workbook wb = _testDataProvider.createWorkbook();
+        Cell cell = wb.createSheet("Sheet1").createRow(0).createCell(0);
+        cell.setCellFormula("B1&C1");
+        cell.setCellValue(wb.getCreationHelper().createRichTextString("hello"));
+        wb.close();
+    }
 
     /**
      *  Make sure that cell.setCellType(Cell.CELL_TYPE_BLANK) preserves the cell style
      */
-       @Test
-       public void testSetBlank_bug47028() throws Exception {
+    @Test
+    public void testSetBlank_bug47028() throws Exception {
         Workbook wb = _testDataProvider.createWorkbook();
         CellStyle style = wb.createCellStyle();
         Cell cell = wb.createSheet("Sheet1").createRow(0).createCell(0);
@@ -631,8 +631,8 @@ public abstract class BaseTestCell {
      * </li>
      * </ul>
      */
-       @Test
-       public void testNanAndInfinity() throws Exception {
+    @Test
+    public void testNanAndInfinity() throws Exception {
         Workbook wb1 = _testDataProvider.createWorkbook();
         Sheet workSheet = wb1.createSheet("Sheet1");
         Row row = workSheet.createRow(0);
@@ -670,8 +670,8 @@ public abstract class BaseTestCell {
         wb2.close();
     }
 
-       @Test
-       public void testDefaultStyleProperties() throws Exception {
+    @Test
+    public void testDefaultStyleProperties() throws Exception {
         Workbook wb1 = _testDataProvider.createWorkbook();
 
         Cell cell = wb1.createSheet("Sheet1").createRow(0).createCell(0);
@@ -707,8 +707,8 @@ public abstract class BaseTestCell {
         wb2.close();
     }
 
-       @Test
-       public void testBug55658SetNumericValue() throws Exception {
+    @Test
+    public void testBug55658SetNumericValue() throws Exception {
         Workbook wb1 = _testDataProvider.createWorkbook();
         Sheet sh = wb1.createSheet();
         Row row = sh.createRow(0);
@@ -730,8 +730,8 @@ public abstract class BaseTestCell {
         wb2.close();
     }
 
-       @Test
-       public void testRemoveHyperlink() throws Exception {
+    @Test
+    public void testRemoveHyperlink() throws Exception {
         Workbook wb1 = _testDataProvider.createWorkbook();
         Sheet sh = wb1.createSheet("test");
         Row row = sh.createRow(0);
@@ -775,8 +775,8 @@ public abstract class BaseTestCell {
      * an problem that cell could not return error value form formula cell).
      * @throws IOException 
      */
-       @Test
-       public void testGetErrorCellValueFromFormulaCell() throws IOException {
+    @Test
+    public void testGetErrorCellValueFromFormulaCell() throws IOException {
         Workbook wb = _testDataProvider.createWorkbook();
         try {
             Sheet sheet = wb.createSheet();
@@ -790,8 +790,8 @@ public abstract class BaseTestCell {
         }
     }
     
-       @Test
-       public void testSetRemoveStyle() throws Exception {
+    @Test
+    public void testSetRemoveStyle() throws Exception {
         Workbook wb = _testDataProvider.createWorkbook();
         Sheet sheet = wb.createSheet();
         Row row = sheet.createRow(0);
@@ -830,28 +830,28 @@ public abstract class BaseTestCell {
         wb.close();
     }
 
-       @Test
-       public void test57008() throws IOException {
+    @Test
+    public void test57008() throws IOException {
         Workbook wb1 = _testDataProvider.createWorkbook();
-               Sheet sheet = wb1.createSheet();
-               
-               Row row0 = sheet.createRow(0);
-               Cell cell0 = row0.createCell(0);
-               cell0.setCellValue("row 0, cell 0 _x0046_ without changes");
-               
-               Cell cell1 = row0.createCell(1);
-               cell1.setCellValue("row 0, cell 1 _x005fx0046_ with changes");
-               
-               Cell cell2 = row0.createCell(2);
-               cell2.setCellValue("hgh_x0041_**_x0100_*_x0101_*_x0190_*_x0200_*_x0300_*_x0427_*");
-
-               checkUnicodeValues(wb1);
-               
-               Workbook wb2 = _testDataProvider.writeOutAndReadBack(wb1);
-               checkUnicodeValues(wb2);
-               wb2.close();
-               wb1.close();
-       }
+        Sheet sheet = wb1.createSheet();
+        
+        Row row0 = sheet.createRow(0);
+        Cell cell0 = row0.createCell(0);
+        cell0.setCellValue("row 0, cell 0 _x0046_ without changes");
+        
+        Cell cell1 = row0.createCell(1);
+        cell1.setCellValue("row 0, cell 1 _x005fx0046_ with changes");
+        
+        Cell cell2 = row0.createCell(2);
+        cell2.setCellValue("hgh_x0041_**_x0100_*_x0101_*_x0190_*_x0200_*_x0300_*_x0427_*");
+
+        checkUnicodeValues(wb1);
+        
+        Workbook wb2 = _testDataProvider.writeOutAndReadBack(wb1);
+        checkUnicodeValues(wb2);
+        wb2.close();
+        wb1.close();
+    }
 
     /**
      * Setting a cell value of a null RichTextString should set
@@ -886,46 +886,46 @@ public abstract class BaseTestCell {
     }
 
     private void checkUnicodeValues(Workbook wb) {
-               assertEquals((wb instanceof HSSFWorkbook ? "row 0, cell 0 _x0046_ without changes" : "row 0, cell 0 F without changes"), 
-                               wb.getSheetAt(0).getRow(0).getCell(0).toString());
-               assertEquals((wb instanceof HSSFWorkbook ? "row 0, cell 1 _x005fx0046_ with changes" : "row 0, cell 1 _x005fx0046_ with changes"), 
-                               wb.getSheetAt(0).getRow(0).getCell(1).toString());
-               assertEquals((wb instanceof HSSFWorkbook ? "hgh_x0041_**_x0100_*_x0101_*_x0190_*_x0200_*_x0300_*_x0427_*" : "hghA**\u0100*\u0101*\u0190*\u0200*\u0300*\u0427*"), 
-                               wb.getSheetAt(0).getRow(0).getCell(2).toString());
-       }
-
-       /**
-        *  The maximum length of cell contents (text) is 32,767 characters.
-        * @throws IOException 
-        */
-       @Test
-       public void testMaxTextLength() throws IOException{
-               Workbook wb = _testDataProvider.createWorkbook();
+        assertEquals((wb instanceof HSSFWorkbook ? "row 0, cell 0 _x0046_ without changes" : "row 0, cell 0 F without changes"), 
+                wb.getSheetAt(0).getRow(0).getCell(0).toString());
+        assertEquals((wb instanceof HSSFWorkbook ? "row 0, cell 1 _x005fx0046_ with changes" : "row 0, cell 1 _x005fx0046_ with changes"), 
+                wb.getSheetAt(0).getRow(0).getCell(1).toString());
+        assertEquals((wb instanceof HSSFWorkbook ? "hgh_x0041_**_x0100_*_x0101_*_x0190_*_x0200_*_x0300_*_x0427_*" : "hghA**\u0100*\u0101*\u0190*\u0200*\u0300*\u0427*"), 
+                wb.getSheetAt(0).getRow(0).getCell(2).toString());
+    }
+
+    /**
+     *  The maximum length of cell contents (text) is 32,767 characters.
+     * @throws IOException 
+     */
+    @Test
+    public void testMaxTextLength() throws IOException{
+        Workbook wb = _testDataProvider.createWorkbook();
         Sheet sheet = wb.createSheet();
-               Cell cell = sheet.createRow(0).createCell(0);
-
-               int maxlen = wb instanceof HSSFWorkbook ? 
-                               SpreadsheetVersion.EXCEL97.getMaxTextLength()
-                               : SpreadsheetVersion.EXCEL2007.getMaxTextLength();
-               assertEquals(32767, maxlen);
-
-               StringBuffer b = new StringBuffer() ;
-
-               // 32767 is okay
-               for( int i = 0 ; i < maxlen ; i++ )
-               {
-                       b.append( "X" ) ;
-               }
-               cell.setCellValue(b.toString());
-
-               b.append("X");
-               // 32768 produces an invalid XLS file
-               try {
-                       cell.setCellValue(b.toString());
-                       fail("Expected exception");
-               } catch (IllegalArgumentException e){
-                       assertEquals("The maximum length of cell contents (text) is 32,767 characters", e.getMessage());
-               }
-               wb.close();
-       }
+        Cell cell = sheet.createRow(0).createCell(0);
+
+        int maxlen = wb instanceof HSSFWorkbook ? 
+                SpreadsheetVersion.EXCEL97.getMaxTextLength()
+                : SpreadsheetVersion.EXCEL2007.getMaxTextLength();
+        assertEquals(32767, maxlen);
+
+        StringBuffer b = new StringBuffer() ;
+
+        // 32767 is okay
+        for( int i = 0 ; i < maxlen ; i++ )
+        {
+            b.append( "X" ) ;
+        }
+        cell.setCellValue(b.toString());
+
+        b.append("X");
+        // 32768 produces an invalid XLS file
+        try {
+            cell.setCellValue(b.toString());
+            fail("Expected exception");
+        } catch (IllegalArgumentException e){
+            assertEquals("The maximum length of cell contents (text) is 32,767 characters", e.getMessage());
+        }
+        wb.close();
+    }
 }