poi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j...@apache.org
Subject svn commit: r805552 [4/4] - in /poi/trunk/src: java/org/apache/poi/hpsf/extractor/ java/org/apache/poi/poifs/filesystem/ java/org/apache/poi/poifs/storage/ java/org/apache/poi/util/ ooxml/java/org/apache/poi/openxml4j/opc/ ooxml/java/org/apache/poi/ope...
Date Tue, 18 Aug 2009 19:49:31 GMT
Modified: poi/trunk/src/testcases/org/apache/poi/hssf/record/TestExtendedFormatRecord.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/hssf/record/TestExtendedFormatRecord.java?rev=805552&r1=805551&r2=805552&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/hssf/record/TestExtendedFormatRecord.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/hssf/record/TestExtendedFormatRecord.java Tue Aug 18 19:49:28 2009
@@ -21,38 +21,40 @@
 /**
  */
 public final class TestExtendedFormatRecord extends TestCase {
-	byte[] header = new byte[] {
-    		0xE0-256, 00, 0x14, 00 // sid=e0, 20 bytes long 
+
+	private static final byte[] data = new byte[] {
+			00, 00, // Font 0
+			00, 00, // Format 0
+			0xF5 - 256, 0xFF - 256, // Cell opts ...
+			0x20, 00, // Alignment 20
+			00, 00, // Ident 0
+			00, 00, // Border 0
+			00, 00, // Palette 0
+			00, 00, 00, 00, // ADTL Palette 0
+			0xC0 - 256, 0x20 // Fill Palette 20c0
 	};
-    byte[] data = new byte[] {
-    		00, 00, // Font 0 
-    		00, 00, // Format 0
-    		0xF5-256, 0xFF-256, // Cell opts ...
-    		0x20, 00, // Alignment 20 
-    		00, 00,   // Ident 0
-    		00, 00,   // Border 0
-    		00, 00,   // Palette 0 
-    		00, 00, 00, 00, // ADTL Palette 0
-    		0xC0-256, 0x20  // Fill Palette 20c0
-    };
-
-    public void testLoad() {
-        ExtendedFormatRecord record = new ExtendedFormatRecord(TestcaseRecordInputStream.create(0xe0, data));
-        assertEquals(0, record.getFontIndex());
-        assertEquals(0, record.getFormatIndex());
-        assertEquals(0xF5-256, record.getCellOptions());
-        assertEquals(0x20, record.getAlignmentOptions());
-        assertEquals(0, record.getIndentionOptions());
-        assertEquals(0, record.getBorderOptions());
-        assertEquals(0, record.getPaletteOptions());
-        assertEquals(0, record.getAdtlPaletteOptions());
-        assertEquals(0x20c0, record.getFillPaletteOptions());
 
-        assertEquals( 20 + 4, record.getRecordSize() );
-    }
+	private static ExtendedFormatRecord createEFR() {
+		return new ExtendedFormatRecord(TestcaseRecordInputStream.create(0x00E0, data));
+	}
+
+	public void testLoad() {
+		ExtendedFormatRecord record = createEFR();
+		assertEquals(0, record.getFontIndex());
+		assertEquals(0, record.getFormatIndex());
+		assertEquals(0xF5 - 256, record.getCellOptions());
+		assertEquals(0x20, record.getAlignmentOptions());
+		assertEquals(0, record.getIndentionOptions());
+		assertEquals(0, record.getBorderOptions());
+		assertEquals(0, record.getPaletteOptions());
+		assertEquals(0, record.getAdtlPaletteOptions());
+		assertEquals(0x20c0, record.getFillPaletteOptions());
+
+		assertEquals(20 + 4, record.getRecordSize());
+	}
+
 
-    public void testStore()
-    {
+	public void testStore() {
 //    .fontindex       = 0
 //    .formatindex     = 0
 //    .celloptions     = fffffff5
@@ -96,35 +98,35 @@
 //          .foreground= 40
 //          .background= 41
 
-    	ExtendedFormatRecord record = new ExtendedFormatRecord();
-    	record.setFontIndex((short)0);
-    	record.setFormatIndex((short)0);
-    	
-    	record.setLocked(true);
-    	record.setHidden(false);
-    	record.setXFType((short)1);
-    	record.setParentIndex((short)0xfff);
-    	
-    	record.setVerticalAlignment((short)2);
-    	
-    	record.setFillForeground((short)0x40);
-    	record.setFillBackground((short)0x41);
-
-        byte [] recordBytes = record.serialize();
-        assertEquals(recordBytes.length - 4, data.length);
-        for (int i = 0; i < data.length; i++)
-            assertEquals("At offset " + i, data[i], recordBytes[i+4]);
-    }
-    
-    public void testCloneOnto() throws Exception {
-        ExtendedFormatRecord base = new ExtendedFormatRecord(TestcaseRecordInputStream.create(0xe0, data));
-    	
-    	ExtendedFormatRecord other = new ExtendedFormatRecord();
-        other.cloneStyleFrom(base);
-
-        byte [] recordBytes = other.serialize();
-        assertEquals(recordBytes.length - 4, data.length);
-        for (int i = 0; i < data.length; i++)
-            assertEquals("At offset " + i, data[i], recordBytes[i+4]);
-    }
+		ExtendedFormatRecord record = new ExtendedFormatRecord();
+		record.setFontIndex((short) 0);
+		record.setFormatIndex((short) 0);
+
+		record.setLocked(true);
+		record.setHidden(false);
+		record.setXFType((short) 1);
+		record.setParentIndex((short) 0xfff);
+
+		record.setVerticalAlignment((short) 2);
+
+		record.setFillForeground((short) 0x40);
+		record.setFillBackground((short) 0x41);
+
+		byte[] recordBytes = record.serialize();
+		assertEquals(recordBytes.length - 4, data.length);
+		for (int i = 0; i < data.length; i++)
+			assertEquals("At offset " + i, data[i], recordBytes[i + 4]);
+	}
+
+	public void testCloneOnto() {
+		ExtendedFormatRecord base = createEFR();
+
+		ExtendedFormatRecord other = new ExtendedFormatRecord();
+		other.cloneStyleFrom(base);
+
+		byte[] recordBytes = other.serialize();
+		assertEquals(recordBytes.length - 4, data.length);
+		for (int i = 0; i < data.length; i++)
+			assertEquals("At offset " + i, data[i], recordBytes[i + 4]);
+	}
 }

Modified: poi/trunk/src/testcases/org/apache/poi/hssf/record/aggregates/TestFormulaRecordAggregate.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/hssf/record/aggregates/TestFormulaRecordAggregate.java?rev=805552&r1=805551&r2=805552&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/hssf/record/aggregates/TestFormulaRecordAggregate.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/hssf/record/aggregates/TestFormulaRecordAggregate.java Tue Aug 18 19:49:28 2009
@@ -27,12 +27,12 @@
 import org.apache.poi.hssf.usermodel.RecordInspector.RecordCollector;
 
 /**
- * 
+ *
  * @author avik
  */
 public final class TestFormulaRecordAggregate extends TestCase {
 
-	public void testBasic() throws Exception {
+	public void testBasic() {
 		FormulaRecord f = new FormulaRecord();
 		f.setCachedResultTypeString();
 		StringRecord s = new StringRecord();
@@ -56,7 +56,7 @@
 		sr.setString("NA");
 		SharedValueManager svm = SharedValueManager.EMPTY;
 		FormulaRecordAggregate fra;
-		
+
 		try {
 			fra = new FormulaRecordAggregate(fr, sr, svm);
 		} catch (RecordFormatException e) {

Modified: poi/trunk/src/testcases/org/apache/poi/hssf/record/formula/TestAreaErrPtg.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/hssf/record/formula/TestAreaErrPtg.java?rev=805552&r1=805551&r2=805552&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/hssf/record/formula/TestAreaErrPtg.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/hssf/record/formula/TestAreaErrPtg.java Tue Aug 18 19:49:28 2009
@@ -1,4 +1,3 @@
-        
 /* ====================================================================
    Licensed to the Apache Software Foundation (ASF) under one or more
    contributor license agreements.  See the NOTICE file distributed with
@@ -25,17 +24,13 @@
  *
  * @author Daniel Noll (daniel at nuix dot com dot au)
  */
-public class TestAreaErrPtg extends AbstractPtgTestCase
-{
+public final class TestAreaErrPtg extends AbstractPtgTestCase {
     /**
      * Tests reading a file containing this ptg.
      */
-    public void testReading() throws Exception
-    {
+    public void testReading() {
         HSSFWorkbook workbook = loadWorkbook("AreaErrPtg.xls");
         assertEquals("Wrong formula string for area error", "SUM(#REF!)",
                      workbook.getSheetAt(0).getRow(0).getCell(2).getCellFormula());
     }
 }
-
-

Modified: poi/trunk/src/testcases/org/apache/poi/hssf/record/formula/TestErrPtg.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/hssf/record/formula/TestErrPtg.java?rev=805552&r1=805551&r2=805552&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/hssf/record/formula/TestErrPtg.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/hssf/record/formula/TestErrPtg.java Tue Aug 18 19:49:28 2009
@@ -1,4 +1,3 @@
-        
 /* ====================================================================
    Licensed to the Apache Software Foundation (ASF) under one or more
    contributor license agreements.  See the NOTICE file distributed with
@@ -26,18 +25,14 @@
  *
  * @author Daniel Noll (daniel at nuix dot com dot au)
  */
-public class TestErrPtg extends AbstractPtgTestCase
-{
+public final class TestErrPtg extends AbstractPtgTestCase {
     /**
      * Tests reading a file containing this ptg.
      */
-    public void testReading() throws Exception
-    {
+    public void testReading() {
         HSSFWorkbook workbook = loadWorkbook("ErrPtg.xls");
         HSSFCell cell = workbook.getSheetAt(0).getRow(3).getCell(0);
         assertEquals("Wrong cell value", 4.0, cell.getNumericCellValue(), 0.0);
         assertEquals("Wrong cell formula", "ERROR.TYPE(#REF!)", cell.getCellFormula());
     }
 }
-
-

Modified: poi/trunk/src/testcases/org/apache/poi/hssf/record/formula/TestIntersectionPtg.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/hssf/record/formula/TestIntersectionPtg.java?rev=805552&r1=805551&r2=805552&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/hssf/record/formula/TestIntersectionPtg.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/hssf/record/formula/TestIntersectionPtg.java Tue Aug 18 19:49:28 2009
@@ -1,4 +1,3 @@
-        
 /* ====================================================================
    Licensed to the Apache Software Foundation (ASF) under one or more
    contributor license agreements.  See the NOTICE file distributed with
@@ -26,18 +25,14 @@
  *
  * @author Daniel Noll (daniel at nuix dot com dot au)
  */
-public class TestIntersectionPtg extends AbstractPtgTestCase
-{
+public final class TestIntersectionPtg extends AbstractPtgTestCase {
     /**
      * Tests reading a file containing this ptg.
      */
-    public void testReading() throws Exception
-    {
+    public void testReading() {
         HSSFWorkbook workbook = loadWorkbook("IntersectionPtg.xls");
         HSSFCell cell = workbook.getSheetAt(0).getRow(4).getCell(2);
         assertEquals("Wrong cell value", 5.0, cell.getNumericCellValue(), 0.0);
         assertEquals("Wrong cell formula", "SUM(A1:B2 B2:C3)", cell.getCellFormula());
     }
 }
-
-

Modified: poi/trunk/src/testcases/org/apache/poi/hssf/record/formula/TestPercentPtg.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/hssf/record/formula/TestPercentPtg.java?rev=805552&r1=805551&r2=805552&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/hssf/record/formula/TestPercentPtg.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/hssf/record/formula/TestPercentPtg.java Tue Aug 18 19:49:28 2009
@@ -1,4 +1,3 @@
-        
 /* ====================================================================
    Licensed to the Apache Software Foundation (ASF) under one or more
    contributor license agreements.  See the NOTICE file distributed with
@@ -26,13 +25,11 @@
  *
  * @author Daniel Noll (daniel at nuix dot com dot au)
  */
-public class TestPercentPtg extends AbstractPtgTestCase
-{
+public final class TestPercentPtg extends AbstractPtgTestCase {
     /**
      * Tests reading a file containing this ptg.
      */
-    public void testReading() throws Exception
-    {
+    public void testReading() {
         HSSFWorkbook workbook = loadWorkbook("PercentPtg.xls");
         HSSFSheet sheet = workbook.getSheetAt(0);
 
@@ -44,5 +41,3 @@
                      sheet.getRow(1).getCell(0).getCellFormula());
     }
 }
-
-

Modified: poi/trunk/src/testcases/org/apache/poi/hssf/record/formula/TestRangePtg.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/hssf/record/formula/TestRangePtg.java?rev=805552&r1=805551&r2=805552&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/hssf/record/formula/TestRangePtg.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/hssf/record/formula/TestRangePtg.java Tue Aug 18 19:49:28 2009
@@ -1,4 +1,3 @@
-        
 /* ====================================================================
    Licensed to the Apache Software Foundation (ASF) under one or more
    contributor license agreements.  See the NOTICE file distributed with
@@ -26,18 +25,14 @@
  *
  * @author Daniel Noll (daniel at nuix dot com dot au)
  */
-public class TestRangePtg extends AbstractPtgTestCase
-{
+public final class TestRangePtg extends AbstractPtgTestCase {
     /**
      * Tests reading a file containing this ptg.
      */
-    public void testReading() throws Exception
-    {
+    public void testReading() {
         HSSFWorkbook workbook = loadWorkbook("RangePtg.xls");
         HSSFCell cell = workbook.getSheetAt(0).getRow(3).getCell(1);
         assertEquals("Wrong cell value", 10.0, cell.getNumericCellValue(), 0.0);
         assertEquals("Wrong cell formula", "SUM(pineapple:B2)", cell.getCellFormula());
     }
 }
-
-

Modified: poi/trunk/src/testcases/org/apache/poi/hssf/record/formula/TestUnionPtg.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/hssf/record/formula/TestUnionPtg.java?rev=805552&r1=805551&r2=805552&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/hssf/record/formula/TestUnionPtg.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/hssf/record/formula/TestUnionPtg.java Tue Aug 18 19:49:28 2009
@@ -1,4 +1,3 @@
-        
 /* ====================================================================
    Licensed to the Apache Software Foundation (ASF) under one or more
    contributor license agreements.  See the NOTICE file distributed with
@@ -26,18 +25,14 @@
  *
  * @author Daniel Noll (daniel at nuix dot com dot au)
  */
-public class TestUnionPtg extends AbstractPtgTestCase
-{
+public final class TestUnionPtg extends AbstractPtgTestCase {
     /**
      * Tests reading a file containing this ptg.
      */
-    public void testReading() throws Exception
-    {
+    public void testReading() {
         HSSFWorkbook workbook = loadWorkbook("UnionPtg.xls");
         HSSFCell cell = workbook.getSheetAt(0).getRow(4).getCell(2);
         assertEquals("Wrong cell value", 24.0, cell.getNumericCellValue(), 0.0);
         assertEquals("Wrong cell formula", "SUM(A1:B2,B2:C3)", cell.getCellFormula());
     }
 }
-
-

Modified: poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestBug42464.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestBug42464.java?rev=805552&r1=805551&r2=805552&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestBug42464.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestBug42464.java Tue Aug 18 19:49:28 2009
@@ -29,24 +29,24 @@
 import org.apache.poi.ss.usermodel.CellValue;
 
 /**
- * 
+ *
  */
 public final class TestBug42464 extends TestCase {
 
-	public void testOKFile() throws Exception {
+	public void testOKFile() {
 		HSSFWorkbook wb = HSSFTestDataSamples.openSampleWorkbook("42464-ExpPtg-ok.xls");
 		process(wb);
 	}
-	public void testExpSharedBadFile() throws Exception {
+	public void testExpSharedBadFile() {
 		HSSFWorkbook wb = HSSFTestDataSamples.openSampleWorkbook("42464-ExpPtg-bad.xls");
 		process(wb);
 	}
-	
+
 	private static void process(HSSFWorkbook wb) {
 		HSSFFormulaEvaluator eval =	new HSSFFormulaEvaluator(wb);
 		for(int i=0; i<wb.getNumberOfSheets(); i++) {
 			HSSFSheet s = wb.getSheetAt(i);
-			
+
 			Iterator it = s.rowIterator();
 			while(it.hasNext()) {
 				HSSFRow r = (HSSFRow)it.next();
@@ -54,7 +54,7 @@
 			}
 		}
 	}
-	
+
 	private static void process(HSSFRow row, HSSFFormulaEvaluator eval) {
 		Iterator it = row.cellIterator();
 		while(it.hasNext()) {
@@ -65,7 +65,7 @@
 			FormulaRecordAggregate record = (FormulaRecordAggregate) cell.getCellValueRecord();
 			FormulaRecord r = record.getFormulaRecord();
 			Ptg[] ptgs = r.getParsedExpression();
-			
+
 			String cellRef = new CellReference(row.getRowNum(), cell.getColumnIndex(), false, false).formatAsString();
 			if(false && cellRef.equals("BP24")) { // TODO - replace System.out.println()s with asserts
 				System.out.print(cellRef);
@@ -76,7 +76,7 @@
 				}
 				System.out.println("-> " + cell.getCellFormula());
 			}
-			
+
 			CellValue evalResult = eval.evaluate(cell);
 			assertNotNull(evalResult);
 		}

Modified: poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestEscherGraphics.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestEscherGraphics.java?rev=805552&r1=805551&r2=805552&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestEscherGraphics.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestEscherGraphics.java Tue Aug 18 19:49:28 2009
@@ -25,15 +25,14 @@
 
 /**
  * Tests the capabilities of the EscherGraphics class.
- * 
+ *
  * All tests have two escher groups available to them,
  *  one anchored at 0,0,1022,255 and another anchored
- *  at 20,30,500,200 
+ *  at 20,30,500,200
  *
  * @author Glen Stampoultzis (glens at apache.org)
  */
-public class TestEscherGraphics extends TestCase
-{
+public final class TestEscherGraphics extends TestCase {
 	private HSSFWorkbook workbook;
 	private HSSFPatriarch patriarch;
     private HSSFShapeGroup escherGroupA;
@@ -43,7 +42,7 @@
     protected void setUp() throws Exception
     {
         workbook = new HSSFWorkbook();
-        
+
         HSSFSheet sheet = workbook.createSheet("test");
         patriarch = sheet.createDrawingPatriarch();
         escherGroupA = patriarch.createGroup(new HSSFClientAnchor(0,0,1022,255,(short)0,0,(short) 0,0));
@@ -53,15 +52,13 @@
         super.setUp();
     }
 
-    public void testGetFont() throws Exception
-    {
+    public void testGetFont() {
         Font f = graphics.getFont();
         if (f.toString().indexOf("dialog") == -1 && f.toString().indexOf("Dialog") == -1)
             assertEquals("java.awt.Font[family=Arial,name=Arial,style=plain,size=10]", f.toString());
     }
 
-    public void testGetFontMetrics() throws Exception
-    {
+    public void testGetFontMetrics() {
         Font f = graphics.getFont();
         if (f.toString().indexOf("dialog") != -1 || f.toString().indexOf("Dialog") != -1)
             return;
@@ -70,21 +67,18 @@
         assertEquals("java.awt.Font[family=Arial,name=Arial,style=plain,size=10]", fontMetrics.getFont().toString());
     }
 
-    public void testSetFont() throws Exception
-    {
+    public void testSetFont() {
         Font f = new Font("Helvetica", 0, 12);
         graphics.setFont(f);
         assertEquals(f, graphics.getFont());
     }
 
-    public void testSetColor() throws Exception
-    {
+    public void testSetColor() {
         graphics.setColor(Color.red);
         assertEquals(Color.red, graphics.getColor());
     }
 
-    public void testFillRect() throws Exception
-    {
+    public void testFillRect() {
         graphics.fillRect( 10, 10, 20, 20 );
         HSSFSimpleShape s = (HSSFSimpleShape) escherGroupA.getChildren().get(0);
         assertEquals(HSSFSimpleShape.OBJECT_TYPE_RECTANGLE, s.getShapeType());
@@ -94,8 +88,7 @@
         assertEquals(30, s.getAnchor().getDx2());
     }
 
-    public void testDrawString() throws Exception
-    {
+    public void testDrawString() {
         graphics.drawString("This is a test", 10, 10);
         HSSFTextbox t = (HSSFTextbox) escherGroupA.getChildren().get(0);
         assertEquals("This is a test", t.getString().getString().toString());
@@ -105,30 +98,30 @@
     	HSSFSheet s;
     	HSSFShapeGroup s1;
     	HSSFShapeGroup s2;
-    	
+
     	patriarch.setCoordinates(10, 20, 30, 40);
-    	
+
     	ByteArrayOutputStream baos = new ByteArrayOutputStream();
     	workbook.write(baos);
     	workbook = new HSSFWorkbook(new ByteArrayInputStream(baos.toByteArray()));
     	s = workbook.getSheetAt(0);
-    	
+
     	patriarch = s.getDrawingPatriarch();
-    	
+
     	assertNotNull(patriarch);
     	assertEquals(10, patriarch.getX1());
     	assertEquals(20, patriarch.getY1());
     	assertEquals(30, patriarch.getX2());
     	assertEquals(40, patriarch.getY2());
-    	
+
     	// Check the two groups too
     	assertEquals(2, patriarch.countOfAllChildren());
     	assertTrue(patriarch.getChildren().get(0) instanceof HSSFShapeGroup);
     	assertTrue(patriarch.getChildren().get(1) instanceof HSSFShapeGroup);
-    	
+
     	s1 = (HSSFShapeGroup)patriarch.getChildren().get(0);
     	s2 = (HSSFShapeGroup)patriarch.getChildren().get(1);
-    	
+
     	assertEquals(0, s1.getX1());
     	assertEquals(0, s1.getY1());
     	assertEquals(1023, s1.getX2());
@@ -137,7 +130,7 @@
     	assertEquals(0, s2.getY1());
     	assertEquals(1023, s2.getX2());
     	assertEquals(255, s2.getY2());
-    	
+
     	assertEquals(0, s1.getAnchor().getDx1());
     	assertEquals(0, s1.getAnchor().getDy1());
     	assertEquals(1022, s1.getAnchor().getDx2());
@@ -146,29 +139,29 @@
     	assertEquals(30, s2.getAnchor().getDy1());
     	assertEquals(500, s2.getAnchor().getDx2());
     	assertEquals(200, s2.getAnchor().getDy2());
-    	
-    	
+
+
     	// Write and re-load once more, to check that's ok
     	baos = new ByteArrayOutputStream();
     	workbook.write(baos);
     	workbook = new HSSFWorkbook(new ByteArrayInputStream(baos.toByteArray()));
     	s = workbook.getSheetAt(0);
     	patriarch = s.getDrawingPatriarch();
-    	
+
     	assertNotNull(patriarch);
     	assertEquals(10, patriarch.getX1());
     	assertEquals(20, patriarch.getY1());
     	assertEquals(30, patriarch.getX2());
     	assertEquals(40, patriarch.getY2());
-    	
+
     	// Check the two groups too
     	assertEquals(2, patriarch.countOfAllChildren());
     	assertTrue(patriarch.getChildren().get(0) instanceof HSSFShapeGroup);
     	assertTrue(patriarch.getChildren().get(1) instanceof HSSFShapeGroup);
-    	
+
     	s1 = (HSSFShapeGroup)patriarch.getChildren().get(0);
     	s2 = (HSSFShapeGroup)patriarch.getChildren().get(1);
-    	
+
     	assertEquals(0, s1.getX1());
     	assertEquals(0, s1.getY1());
     	assertEquals(1023, s1.getX2());
@@ -177,7 +170,7 @@
     	assertEquals(0, s2.getY1());
     	assertEquals(1023, s2.getX2());
     	assertEquals(255, s2.getY2());
-    	
+
     	assertEquals(0, s1.getAnchor().getDx1());
     	assertEquals(0, s1.getAnchor().getDy1());
     	assertEquals(1022, s1.getAnchor().getDx2());
@@ -186,32 +179,32 @@
     	assertEquals(30, s2.getAnchor().getDy1());
     	assertEquals(500, s2.getAnchor().getDx2());
     	assertEquals(200, s2.getAnchor().getDy2());
-    	
+
     	// Change the positions of the first groups,
     	//  but not of their anchors
     	s1.setCoordinates(2, 3, 1021, 242);
-    	
+
     	baos = new ByteArrayOutputStream();
     	workbook.write(baos);
     	workbook = new HSSFWorkbook(new ByteArrayInputStream(baos.toByteArray()));
     	s = workbook.getSheetAt(0);
     	patriarch = s.getDrawingPatriarch();
-    	
+
     	assertNotNull(patriarch);
     	assertEquals(10, patriarch.getX1());
     	assertEquals(20, patriarch.getY1());
     	assertEquals(30, patriarch.getX2());
     	assertEquals(40, patriarch.getY2());
-    	
+
     	// Check the two groups too
     	assertEquals(2, patriarch.countOfAllChildren());
     	assertEquals(2, patriarch.getChildren().size());
     	assertTrue(patriarch.getChildren().get(0) instanceof HSSFShapeGroup);
     	assertTrue(patriarch.getChildren().get(1) instanceof HSSFShapeGroup);
-    	
+
     	s1 = (HSSFShapeGroup)patriarch.getChildren().get(0);
     	s2 = (HSSFShapeGroup)patriarch.getChildren().get(1);
-    	
+
     	assertEquals(2, s1.getX1());
     	assertEquals(3, s1.getY1());
     	assertEquals(1021, s1.getX2());
@@ -220,7 +213,7 @@
     	assertEquals(0, s2.getY1());
     	assertEquals(1023, s2.getX2());
     	assertEquals(255, s2.getY2());
-    	
+
     	assertEquals(0, s1.getAnchor().getDx1());
     	assertEquals(0, s1.getAnchor().getDy1());
     	assertEquals(1022, s1.getAnchor().getDx2());
@@ -229,8 +222,8 @@
     	assertEquals(30, s2.getAnchor().getDy1());
     	assertEquals(500, s2.getAnchor().getDx2());
     	assertEquals(200, s2.getAnchor().getDy2());
-    	
-    	
+
+
     	// Now add some text to one group, and some more
     	//  to the base, and check we can get it back again
     	HSSFTextbox tbox1 =
@@ -239,37 +232,37 @@
     	HSSFTextbox tbox2 =
     		s2.createTextbox(new HSSFChildAnchor(41,42,43,44));
     	tbox2.setString(new HSSFRichTextString("This is text box 2"));
-    	
+
     	assertEquals(3, patriarch.getChildren().size());
-    	
-    	
+
+
     	baos = new ByteArrayOutputStream();
     	workbook.write(baos);
     	workbook = new HSSFWorkbook(new ByteArrayInputStream(baos.toByteArray()));
     	s = workbook.getSheetAt(0);
-    	
+
     	patriarch = s.getDrawingPatriarch();
-    	
+
     	assertNotNull(patriarch);
     	assertEquals(10, patriarch.getX1());
     	assertEquals(20, patriarch.getY1());
     	assertEquals(30, patriarch.getX2());
     	assertEquals(40, patriarch.getY2());
-    	
+
     	// Check the two groups and the text
     	assertEquals(3, patriarch.countOfAllChildren());
     	assertEquals(2, patriarch.getChildren().size());
-    	
+
     	// Should be two groups and a text
     	assertTrue(patriarch.getChildren().get(0) instanceof HSSFShapeGroup);
     	assertTrue(patriarch.getChildren().get(1) instanceof HSSFTextbox);
 //    	assertTrue(patriarch.getChildren().get(2) instanceof HSSFShapeGroup);
-    	
+
     	s1 = (HSSFShapeGroup)patriarch.getChildren().get(0);
     	tbox1 = (HSSFTextbox)patriarch.getChildren().get(1);
-    	
+
 //    	s2 = (HSSFShapeGroup)patriarch.getChildren().get(1);
-    	
+
     	assertEquals(2, s1.getX1());
     	assertEquals(3, s1.getY1());
     	assertEquals(1021, s1.getX2());
@@ -278,7 +271,7 @@
     	assertEquals(0, s2.getY1());
     	assertEquals(1023, s2.getX2());
     	assertEquals(255, s2.getY2());
-    	
+
     	assertEquals(0, s1.getAnchor().getDx1());
     	assertEquals(0, s1.getAnchor().getDy1());
     	assertEquals(1022, s1.getAnchor().getDx2());
@@ -287,7 +280,7 @@
     	assertEquals(30, s2.getAnchor().getDy1());
     	assertEquals(500, s2.getAnchor().getDx2());
     	assertEquals(200, s2.getAnchor().getDy2());
-    	
+
     	// Not working just yet
     	//assertEquals("I am text box 1", tbox1.getString().getString());
     }

Modified: poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestFontDetails.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestFontDetails.java?rev=805552&r1=805551&r2=805552&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestFontDetails.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestFontDetails.java Tue Aug 18 19:49:28 2009
@@ -26,37 +26,30 @@
  *
  * @author Glen Stampoultzis (glens at apache.org)
  */
-public class TestFontDetails extends TestCase
-{
+public final class TestFontDetails extends TestCase {
     private Properties properties;
     private FontDetails fontDetails;
 
-    protected void setUp() throws Exception
-    {
+    protected void setUp() {
         properties = new Properties();
         properties.setProperty("font.Arial.height", "13");
         properties.setProperty("font.Arial.characters", "a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, Z, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, ");
         properties.setProperty("font.Arial.widths",     "6, 6, 6, 6, 6, 3, 6, 6, 3, 4, 6, 3, 9, 6, 6, 6, 6, 4, 6, 3, 6, 7, 9, 6, 5, 5, 7, 7, 7, 7, 7, 6, 8, 7, 3, 6, 7, 6, 9, 7, 8, 7, 8, 7, 7, 5, 7, 7, 9, 7, 7, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, ");
         fontDetails = FontDetails.create("Arial", properties);
-
     }
 
-    public void testCreate() throws Exception
-    {
+    public void testCreate() {
         assertEquals(13, fontDetails.getHeight());
         assertEquals(6, fontDetails.getCharWidth('a'));
         assertEquals(3, fontDetails.getCharWidth('f'));
     }
 
-    public void testGetStringWidth() throws Exception
-    {
+    public void testGetStringWidth() {
         assertEquals(9, fontDetails.getStringWidth("af"));
     }
 
-    public void testGetCharWidth() throws Exception
-    {
+    public void testGetCharWidth() {
         assertEquals(6, fontDetails.getCharWidth('a'));
         assertEquals(9, fontDetails.getCharWidth('='));
     }
-
 }

Modified: poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestFormulaEvaluatorBugs.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestFormulaEvaluatorBugs.java?rev=805552&r1=805551&r2=805552&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestFormulaEvaluatorBugs.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestFormulaEvaluatorBugs.java Tue Aug 18 19:49:28 2009
@@ -38,7 +38,7 @@
 import org.apache.poi.ss.formula.WorkbookEvaluatorTestHelper;
 
 /**
- * 
+ *
  */
 public final class TestFormulaEvaluatorBugs extends TestCase {
 
@@ -53,7 +53,7 @@
 	/**
 	 * An odd problem with evaluateFormulaCell giving the
 	 *  right values when file is opened, but changes
-	 *  to the source data in some versions of excel 
+	 *  to the source data in some versions of excel
 	 *  doesn't cause them to be updated. However, other
 	 *  versions of excel, and gnumeric, work just fine
 	 * WARNING - tedious bug where you actually have to
@@ -252,7 +252,7 @@
 		assertEquals(true, cell.getBooleanCellValue());
 	}
 
-	public void testClassCast_bug44861() throws Exception {
+	public void testClassCast_bug44861() {
 		HSSFWorkbook wb = HSSFTestDataSamples.openSampleWorkbook("44861.xls");
 
 		// Check direct
@@ -291,7 +291,7 @@
 			throw e;
 		}
 	}
-	
+
 	private static final class EvalListener extends EvaluationListener {
 		private int _countCacheHits;
 		private int _countCacheMisses;
@@ -314,12 +314,12 @@
 			_countCacheMisses++;
 		}
 	}
-	
+
 	/**
 	 * The HSSFFormula evaluator performance benefits greatly from caching of intermediate cell values
 	 */
 	public void testSlowEvaluate45376() {
-		
+
 		// Firstly set up a sequence of formula cells where each depends on the  previous multiple
 		// times.  Without caching, each subsequent cell take about 4 times longer to evaluate.
 		HSSFWorkbook wb = new HSSFWorkbook();
@@ -333,11 +333,11 @@
 			String formula = "IF(DATE(YEAR(" + prevCell + "),MONTH(" + prevCell + ")+1,1)<=$D$3," +
 					"DATE(YEAR(" + prevCell + "),MONTH(" + prevCell + ")+1,1),NA())";
 			cell.setCellFormula(formula);
-			
+
 		}
 		Calendar cal = new GregorianCalendar(2000, 0, 1, 0, 0, 0);
 		row.createCell(0).setCellValue(cal);
-		
+
 		// Choose cell A9, so that the failing test case doesn't take too long to execute.
 		HSSFCell cell = row.getCell(8);
 		EvalListener evalListener = new EvalListener();
@@ -351,9 +351,9 @@
 			throw new AssertionFailedError("Identifed bug 45376 - Formula evaluator should cache values");
 		}
 		// With caching, the evaluationCount is 8 which is a big improvement
-		// Note - these expected values may change if the WorkbookEvaluator is 
+		// Note - these expected values may change if the WorkbookEvaluator is
 		// ever optimised to short circuit 'if' functions.
 		assertEquals(8, evalCount);
 		assertEquals(24, evalListener.getCountCacheHits());
 	}
-}
\ No newline at end of file
+}

Modified: poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestFormulas.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestFormulas.java?rev=805552&r1=805551&r2=805552&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestFormulas.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestFormulas.java Tue Aug 18 19:49:28 2009
@@ -874,7 +874,7 @@
     }
 
     /** MissingArgPtg */
-    public void testMissingArgPtg() throws Exception {
+    public void testMissingArgPtg() {
         HSSFWorkbook wb = new HSSFWorkbook();
         HSSFCell cell = wb.createSheet("Sheet1").createRow(4).createCell(0);
         cell.setCellFormula("IF(A1=\"A\",1,)");
@@ -929,10 +929,10 @@
 
         //check that the formula evaluator returns the correct result
         HSSFFormulaEvaluator evaluator = new HSSFFormulaEvaluator(wb);
-        assertEquals(3.0, evaluator.evaluate(sh1.getRow(0).getCell(1)).getNumberValue());
-        assertEquals(6.0, evaluator.evaluate(sh1.getRow(0).getCell(2)).getNumberValue());
+        assertEquals(3.0, evaluator.evaluate(sh1.getRow(0).getCell(1)).getNumberValue(), 0.0);
+        assertEquals(6.0, evaluator.evaluate(sh1.getRow(0).getCell(2)).getNumberValue(), 0.0);
 
-        assertEquals(5.0, evaluator.evaluate(sh2.getRow(0).getCell(1)).getNumberValue());
-        assertEquals(15.0, evaluator.evaluate(sh2.getRow(0).getCell(2)).getNumberValue());
+        assertEquals(5.0, evaluator.evaluate(sh2.getRow(0).getCell(1)).getNumberValue(), 0.0);
+        assertEquals(15.0, evaluator.evaluate(sh2.getRow(0).getCell(2)).getNumberValue(), 0.0);
     }
 }

Modified: poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFClientAnchor.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFClientAnchor.java?rev=805552&r1=805551&r2=805552&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFClientAnchor.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFClientAnchor.java Tue Aug 18 19:49:28 2009
@@ -27,10 +27,8 @@
  * @author Glen Stampoultzis (glens at apache.org)
  * @author Yegor Kozlov (yegor at apache.org)
  */
-public class TestHSSFClientAnchor extends TestCase
-{
-    public void testGetAnchorHeightInPoints() throws Exception
-    {
+public final class TestHSSFClientAnchor extends TestCase {
+    public void testGetAnchorHeightInPoints() {
         HSSFWorkbook wb = new HSSFWorkbook();
         HSSFSheet sheet = wb.createSheet("test");
         HSSFClientAnchor a = new HSSFClientAnchor(0,0,1023,255,(short)0,0,(short)0,0);
@@ -63,11 +61,10 @@
 
     /**
      * When HSSFClientAnchor is converted into EscherClientAnchorRecord
-     * check that dx1, dx2, dy1 and dy2 are writtem "as is".
-     * (Bug 42999 reported that dx1 ans dx2 are swapped if dx1>dx2. It doesn't make sense for client anchors.)
+     * check that dx1, dx2, dy1 and dy2 are written "as is".
+     * (Bug 42999 reported that dx1 and dx2 are swapped if dx1>dx2. It doesn't make sense for client anchors.)
      */
-    public void testConvertAnchor() throws Exception
-    {
+    public void testConvertAnchor() {
         HSSFClientAnchor[] anchor = {
             new HSSFClientAnchor( 0 , 0 , 0 , 0 ,(short)0, 1,(short)1,3),
             new HSSFClientAnchor( 100 , 0 , 900 , 255 ,(short)0, 1,(short)1,3),
@@ -101,7 +98,5 @@
             float height = anchor[i].getAnchorHeightInPoints(sheet);
             assertEquals(ref[i], height, 0);
         }
-
     }
-
 }

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=805552&r1=805551&r2=805552&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 Tue Aug 18 19:49:28 2009
@@ -34,7 +34,7 @@
 	/**
      * Test setting and getting boolean values.
      */
-    public void testBuiltinFormats() throws Exception {
+    public void testBuiltinFormats() {
         baseBuiltinFormats();
     }
-}
\ No newline at end of file
+}

Modified: poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFHyperlink.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFHyperlink.java?rev=805552&r1=805551&r2=805552&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFHyperlink.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFHyperlink.java Tue Aug 18 19:49:28 2009
@@ -76,7 +76,7 @@
         assertEquals("WebLinks!A1", link.getAddress());
     }
 
-    public void testModify() throws Exception {
+    public void testModify() {
         HSSFWorkbook wb = getTestDataProvider().openSampleWorkbook("HyperlinksOnManySheets.xls");
 
         HSSFSheet sheet;
@@ -105,7 +105,7 @@
      *  or
      *  link.setAddress("'Target Sheet-1'!A1"); //common between XSSF and HSSF
      */
-    public void testCreateDocumentLink() throws Exception {
+    public void testCreateDocumentLink() {
         HSSFWorkbook wb = getTestDataProvider().createWorkbook();
 
         //link to a place in this workbook
@@ -166,7 +166,7 @@
         assertEquals("http://poi.apache.org/hssf/", link.getAddress());
     }
 
-    public void testCreate() throws Exception {
+    public void testCreate() {
         HSSFWorkbook wb = getTestDataProvider().createWorkbook();
 
         HSSFHyperlink link;

Modified: poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFPalette.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFPalette.java?rev=805552&r1=805551&r2=805552&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFPalette.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFPalette.java Tue Aug 18 19:49:28 2009
@@ -17,56 +17,44 @@
 
 package org.apache.poi.hssf.usermodel;
 
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.IOException;
 import java.util.Iterator;
 import java.util.Map;
+
 import junit.framework.TestCase;
 
 import org.apache.poi.hssf.HSSFTestDataSamples;
 import org.apache.poi.hssf.record.PaletteRecord;
 import org.apache.poi.hssf.util.HSSFColor;
-import org.apache.poi.util.TempFile;
 
 /**
  * @author Brian Sanders (bsanders at risklabs dot com)
  */
 public final class TestHSSFPalette extends TestCase {
-    private PaletteRecord palette;
-    private HSSFPalette hssfPalette;
-    
-    
+    private PaletteRecord _palette;
+    private HSSFPalette _hssfPalette;
+
+
     public void setUp()
     {
-        palette = new PaletteRecord();
-        hssfPalette = new HSSFPalette(palette);
+        _palette = new PaletteRecord();
+        _hssfPalette = new HSSFPalette(_palette);
     }
-    
+
     /**
      * Verifies that a custom palette can be created, saved, and reloaded
      */
-    public void testCustomPalette() throws IOException
-    {
+    public void testCustomPalette() {
         //reading sample xls
         HSSFWorkbook book = HSSFTestDataSamples.openSampleWorkbook("Simple.xls");
-        
+
         //creating custom palette
         HSSFPalette palette = book.getCustomPalette();
         palette.setColorAtIndex((short) 0x12, (byte) 101, (byte) 230, (byte) 100);
         palette.setColorAtIndex((short) 0x3b, (byte) 0, (byte) 255, (byte) 52);
-        
+
         //writing to disk; reading in and verifying palette
-        File temp = TempFile.createTempFile("testCustomPalette", ".xls");
-        FileOutputStream fos = new FileOutputStream(temp);
-        book.write(fos);
-        fos.close();
-        
-        FileInputStream fis = new FileInputStream(temp);
-        book = new HSSFWorkbook(fis);
-        fis.close();
-        
+        book = HSSFTestDataSamples.writeOutAndReadBack(book);
+
         palette = book.getCustomPalette();
         HSSFColor color = palette.getColor(HSSFColor.CORAL.index);  //unmodified
         assertNotNull("Unexpected null in custom palette (unmodified index)", color);
@@ -76,7 +64,7 @@
         assertEquals(msg, expectedRGB[0], actualRGB[0]);
         assertEquals(msg, expectedRGB[1], actualRGB[1]);
         assertEquals(msg, expectedRGB[2], actualRGB[2]);
-        
+
         color = palette.getColor((short) 0x12);
         assertNotNull("Unexpected null in custom palette (modified)", color);
         actualRGB = color.getTriplet();
@@ -85,21 +73,21 @@
         assertEquals(msg, (short) 230, actualRGB[1]);
         assertEquals(msg, (short) 100, actualRGB[2]);
     }
-    
+
     /**
      * Uses the palette from cell stylings
      */
     public void testPaletteFromCellColours() {
         HSSFWorkbook book = HSSFTestDataSamples.openSampleWorkbook("SimpleWithColours.xls");
-        
+
         HSSFPalette p = book.getCustomPalette();
-        
+
         HSSFCell cellA = book.getSheetAt(0).getRow(0).getCell(0);
         HSSFCell cellB = book.getSheetAt(0).getRow(1).getCell(0);
         HSSFCell cellC = book.getSheetAt(0).getRow(2).getCell(0);
         HSSFCell cellD = book.getSheetAt(0).getRow(3).getCell(0);
         HSSFCell cellE = book.getSheetAt(0).getRow(4).getCell(0);
-        
+
         // Plain
         assertEquals("I'm plain", cellA.getStringCellValue());
         assertEquals(64, cellA.getCellStyle().getFillForegroundColor());
@@ -108,7 +96,7 @@
         assertEquals(0, cellA.getCellStyle().getFillPattern());
         assertEquals("0:0:0", p.getColor((short)64).getHexString());
         assertEquals(null, p.getColor((short)32767));
-        
+
         // Red
         assertEquals("I'm red", cellB.getStringCellValue());
         assertEquals(64, cellB.getCellStyle().getFillForegroundColor());
@@ -117,7 +105,7 @@
         assertEquals(0, cellB.getCellStyle().getFillPattern());
         assertEquals("0:0:0", p.getColor((short)64).getHexString());
         assertEquals("FFFF:0:0", p.getColor((short)10).getHexString());
-        
+
         // Red + green bg
         assertEquals("I'm red with a green bg", cellC.getStringCellValue());
         assertEquals(11, cellC.getCellStyle().getFillForegroundColor());
@@ -126,7 +114,7 @@
         assertEquals(1, cellC.getCellStyle().getFillPattern());
         assertEquals("0:FFFF:0", p.getColor((short)11).getHexString());
         assertEquals("FFFF:0:0", p.getColor((short)10).getHexString());
-        
+
         // Pink with yellow
         assertEquals("I'm pink with a yellow pattern (none)", cellD.getStringCellValue());
         assertEquals(13, cellD.getCellStyle().getFillForegroundColor());
@@ -135,7 +123,7 @@
         assertEquals(0, cellD.getCellStyle().getFillPattern());
         assertEquals("FFFF:FFFF:0", p.getColor((short)13).getHexString());
         assertEquals("FFFF:0:FFFF", p.getColor((short)14).getHexString());
-        
+
         // Pink with yellow - full
         assertEquals("I'm pink with a yellow pattern (full)", cellE.getStringCellValue());
         assertEquals(13, cellE.getCellStyle().getFillForegroundColor());
@@ -145,56 +133,55 @@
         assertEquals("FFFF:FFFF:0", p.getColor((short)13).getHexString());
         assertEquals("FFFF:0:FFFF", p.getColor((short)14).getHexString());
     }
-    
-    public void testFindSimilar() throws Exception {
+
+    public void testFindSimilar() {
         HSSFWorkbook book = new HSSFWorkbook();
         HSSFPalette p = book.getCustomPalette();
-        
-        
+
+
         // Add a few edge colours in
         p.setColorAtIndex((short)8, (byte)-1, (byte)0, (byte)0);
         p.setColorAtIndex((short)9, (byte)0, (byte)-1, (byte)0);
         p.setColorAtIndex((short)10, (byte)0, (byte)0, (byte)-1);
-        
+
         // And some near a few of them
         p.setColorAtIndex((short)11, (byte)-1, (byte)2, (byte)2);
         p.setColorAtIndex((short)12, (byte)-2, (byte)2, (byte)10);
         p.setColorAtIndex((short)13, (byte)-4, (byte)0, (byte)0);
         p.setColorAtIndex((short)14, (byte)-8, (byte)0, (byte)0);
-        
+
         assertEquals(
                 "FFFF:0:0", p.getColor((short)8).getHexString()
         );
-        
+
         // Now check we get the right stuff back
         assertEquals(
-                p.getColor((short)8).getHexString(), 
+                p.getColor((short)8).getHexString(),
                 p.findSimilarColor((byte)-1, (byte)0, (byte)0).getHexString()
         );
         assertEquals(
-                p.getColor((short)8).getHexString(), 
+                p.getColor((short)8).getHexString(),
                 p.findSimilarColor((byte)-2, (byte)0, (byte)0).getHexString()
         );
         assertEquals(
-                p.getColor((short)8).getHexString(), 
+                p.getColor((short)8).getHexString(),
                 p.findSimilarColor((byte)-1, (byte)1, (byte)0).getHexString()
         );
         assertEquals(
-                p.getColor((short)11).getHexString(), 
+                p.getColor((short)11).getHexString(),
                 p.findSimilarColor((byte)-1, (byte)2, (byte)1).getHexString()
         );
         assertEquals(
-                p.getColor((short)12).getHexString(), 
+                p.getColor((short)12).getHexString(),
                 p.findSimilarColor((byte)-1, (byte)2, (byte)10).getHexString()
         );
     }
-    
+
     /**
      * Verifies that the generated gnumeric-format string values match the
      * hardcoded values in the HSSFColor default color palette
      */
-    public void testGnumericStrings()
-    {
+    public void testGnumericStrings() {
         compareToDefaults(new ColorComparator() {
             public void compare(HSSFColor expected, HSSFColor palette)
             {
@@ -202,18 +189,17 @@
             }
         });
     }
-    
+
     /**
      * Verifies that the palette handles invalid palette indexes
      */
-    public void testBadIndexes()
-    {
+    public void testBadIndexes() {
         //too small
-        hssfPalette.setColorAtIndex((short) 2, (byte) 255, (byte) 255, (byte) 255);
+        _hssfPalette.setColorAtIndex((short) 2, (byte) 255, (byte) 255, (byte) 255);
         //too large
-        hssfPalette.setColorAtIndex((short) 0x45, (byte) 255, (byte) 255, (byte) 255);
-        
-        //should still match defaults; 
+        _hssfPalette.setColorAtIndex((short) 0x45, (byte) 255, (byte) 255, (byte) 255);
+
+        //should still match defaults;
         compareToDefaults(new ColorComparator() {
             public void compare(HSSFColor expected, HSSFColor palette)
             {
@@ -225,35 +211,30 @@
             }
         });
     }
-    
-    private void compareToDefaults(ColorComparator c)
-    {
+
+    private void compareToDefaults(ColorComparator c) {
         Map colors = HSSFColor.getIndexHash();
         Iterator it = colors.keySet().iterator();
         while (it.hasNext())
         {
             Number index = (Number) it.next();
             HSSFColor expectedColor = (HSSFColor) colors.get(index);
-            HSSFColor paletteColor = hssfPalette.getColor(index.shortValue());
+            HSSFColor paletteColor = _hssfPalette.getColor(index.shortValue());
             c.compare(expectedColor, paletteColor);
         }
     }
 
-    public void testAddColor() throws Exception
-    {
+    public void testAddColor() {
         try
         {
-            HSSFColor hssfColor = hssfPalette.addColor((byte)10,(byte)10,(byte)10);
+            _hssfPalette.addColor((byte)10,(byte)10,(byte)10);
             fail();
-        }
-        catch ( RuntimeException e )
-        {
+        } catch (RuntimeException e) {
             // Failing because by default there are no colours left in the palette.
         }
     }
 
-    private static interface ColorComparator
-    {
+    private static interface ColorComparator {
         void compare(HSSFColor expected, HSSFColor palette);
     }
 }

Modified: poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFRichTextString.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFRichTextString.java?rev=805552&r1=805551&r2=805552&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFRichTextString.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFRichTextString.java Tue Aug 18 19:49:28 2009
@@ -19,10 +19,8 @@
 
 import junit.framework.TestCase;
 
-public class TestHSSFRichTextString extends TestCase
-{
-    public void testApplyFont() throws Exception
-    {
+public final class TestHSSFRichTextString extends TestCase {
+    public void testApplyFont() {
 
         HSSFRichTextString r = new HSSFRichTextString("testing");
         assertEquals(0,r.numFormattingRuns());
@@ -64,8 +62,7 @@
 
     }
 
-    public void testClearFormatting() throws Exception
-    {
+    public void testClearFormatting() {
 
       HSSFRichTextString r = new HSSFRichTextString("testing");
       assertEquals(0, r.numFormattingRuns());
@@ -79,7 +76,7 @@
     /**
      * Test case proposed in Bug 40520:  formated twice => will format whole String
      */
-    public void test40520_1(){
+    public void test40520_1() {
 
         short font = 3;
 
@@ -96,7 +93,7 @@
     /**
      * Test case proposed in Bug 40520:  overlapped range => will format whole String
      */
-    public void test40520_2(){
+    public void test40520_2() {
 
         short font = 3;
         HSSFRichTextString r = new HSSFRichTextString("f0_123456789012345678901234567890123456789012345678901234567890");
@@ -113,7 +110,7 @@
     /**
      * Test case proposed in Bug 40520:  formated twice => will format whole String
      */
-    public void test40520_3(){
+    public void test40520_3() {
 
         short font = 3;
         HSSFRichTextString r = new HSSFRichTextString("f0_123456789012345678901234567890123456789012345678901234567890");

Modified: poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestSheetHiding.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestSheetHiding.java?rev=805552&r1=805551&r2=805552&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestSheetHiding.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestSheetHiding.java Tue Aug 18 19:49:28 2009
@@ -1,19 +1,19 @@
-/*
-* Licensed to the Apache Software Foundation (ASF) under one or more
-* contributor license agreements.  See the NOTICE file distributed with
-* this work for additional information regarding copyright ownership.
-* The ASF licenses this file to You under the Apache License, Version 2.0
-* (the "License"); you may not use this file except in compliance with
-* the License.  You may obtain a copy of the License at
-*
-*     http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
+/* ====================================================================
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to You under the Apache License, Version 2.0
+   (the "License"); you may not use this file except in compliance with
+   the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+==================================================================== */
 
 package org.apache.poi.hssf.usermodel;
 
@@ -43,7 +43,7 @@
 	 *  with the right text on them, no matter what
 	 *  the hidden flags are
 	 */
-	public void testTextSheets() throws Exception {
+	public void testTextSheets() {
 		// Both should have two sheets
 		assertEquals(2, wbH.getNumberOfSheets());
 		assertEquals(2, wbU.getNumberOfSheets());
@@ -71,7 +71,7 @@
 	 * Check that we can get and set the hidden flags
 	 *  as expected
 	 */
-	public void testHideUnHideFlags() throws Exception {
+	public void testHideUnHideFlags() {
 		assertTrue(wbH.isSheetHidden(0));
 		assertFalse(wbH.isSheetHidden(1));
 		assertFalse(wbU.isSheetHidden(0));

Modified: poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestUnicodeWorkbook.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestUnicodeWorkbook.java?rev=805552&r1=805551&r2=805552&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestUnicodeWorkbook.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestUnicodeWorkbook.java Tue Aug 18 19:49:28 2009
@@ -1,34 +1,33 @@
-/*
-* Licensed to the Apache Software Foundation (ASF) under one or more
-* contributor license agreements.  See the NOTICE file distributed with
-* this work for additional information regarding copyright ownership.
-* The ASF licenses this file to You under the Apache License, Version 2.0
-* (the "License"); you may not use this file except in compliance with
-* the License.  You may obtain a copy of the License at
-*
-*     http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
+/* ====================================================================
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to You under the Apache License, Version 2.0
+   (the "License"); you may not use this file except in compliance with
+   the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+==================================================================== */
+
 package org.apache.poi.hssf.usermodel;
 
 import junit.framework.TestCase;
 import org.apache.poi.hssf.HSSFTestDataSamples;
 
-public class TestUnicodeWorkbook extends TestCase {
+public final class TestUnicodeWorkbook extends TestCase {
 
-    /** Tests Bug38230
+    /**
+     *  Tests Bug38230
      *  That a Umlat is written  and then read back.
      *  It should have been written as a compressed unicode.
-     *
-     *
-     *
      */
-    public void testUmlatReadWrite() throws Exception {
+    public void testUmlatReadWrite() {
         HSSFWorkbook wb = new HSSFWorkbook();
 
         //Create a unicode sheet name (euro symbol)
@@ -50,5 +49,4 @@
         c = r.getCell(1);
         assertEquals(c.getRichStringCellValue().getString(), "\u00e4");
     }
-
 }

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=805552&r1=805551&r2=805552&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 Tue Aug 18 19:49:28 2009
@@ -33,7 +33,7 @@
      */
     protected abstract ITestDataProvider getTestDataProvider();
 
-    public void baseBuiltinFormats() throws Exception {
+    public void baseBuiltinFormats() {
         Workbook wb = getTestDataProvider().createWorkbook();
 
         DataFormat df = wb.createDataFormat();
@@ -60,4 +60,4 @@
         //read and verify the string representation
         assertEquals(customFmt, df.getFormat((short)customIdx));
     }
-}
\ No newline at end of file
+}

Modified: poi/trunk/src/testcases/org/apache/poi/ss/usermodel/BaseTestSheet.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/ss/usermodel/BaseTestSheet.java?rev=805552&r1=805551&r2=805552&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/ss/usermodel/BaseTestSheet.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/ss/usermodel/BaseTestSheet.java Tue Aug 18 19:49:28 2009
@@ -71,7 +71,7 @@
         assertTrue(it2.hasNext());
         Row row2_ovrewritten_ref = it2.next();
         assertSame(row2_ovrewritten, row2_ovrewritten_ref);
-        assertEquals(100.0, row2_ovrewritten_ref.getCell(0).getNumericCellValue());
+        assertEquals(100.0, row2_ovrewritten_ref.getCell(0).getNumericCellValue(), 0.0);
     }
 
 
@@ -91,7 +91,7 @@
         assertEquals(0, sheet1.getFirstRowNum());
         assertEquals(0, sheet1.getLastRowNum());
 
-        Row row1 = sheet1.createRow(1);
+        sheet1.createRow(1);
         Row row2 = sheet1.createRow(2);
         assertEquals(2, sheet1.getPhysicalNumberOfRows());
         assertEquals(1, sheet1.getFirstRowNum());
@@ -175,7 +175,7 @@
     /**
      * Setting landscape and portrait stuff on new sheets
      */
-    public void testPrintSetupLandscapeNew() throws Exception {
+    public void testPrintSetupLandscapeNew() {
         Workbook workbook = getTestDataProvider().createWorkbook();
         Sheet sheetL = workbook.createSheet("LandscapeS");
         Sheet sheetP = workbook.createSheet("LandscapeP");
@@ -244,7 +244,7 @@
             ;
         }
         assertEquals(1, sheet.getNumMergedRegions());
-        
+
     }
 
     /**
@@ -397,21 +397,21 @@
         Sheet sheet = workbook.createSheet();
         sheet.setDefaultRowHeightInPoints(15);
         assertEquals((short) 300, sheet.getDefaultRowHeight());
-        assertEquals((float) 15, sheet.getDefaultRowHeightInPoints());
+        assertEquals(15.0F, sheet.getDefaultRowHeightInPoints(), 0F);
 
         // Set a new default row height in twips and test getting the value in points
         sheet.setDefaultRowHeight((short) 360);
-        assertEquals(18.0f, sheet.getDefaultRowHeightInPoints());
+        assertEquals(18.0f, sheet.getDefaultRowHeightInPoints(), 0F);
         assertEquals((short) 360, sheet.getDefaultRowHeight());
 
         // Test that defaultRowHeight is a truncated short: E.G. 360inPoints -> 18; 361inPoints -> 18
         sheet.setDefaultRowHeight((short) 361);
-        assertEquals((float)361/20, sheet.getDefaultRowHeightInPoints());
+        assertEquals((float)361/20, sheet.getDefaultRowHeightInPoints(), 0F);
         assertEquals((short) 361, sheet.getDefaultRowHeight());
 
         // Set a new default row height in points and test getting the value in twips
         sheet.setDefaultRowHeightInPoints(17.5f);
-        assertEquals(17.5f, sheet.getDefaultRowHeightInPoints());
+        assertEquals(17.5f, sheet.getDefaultRowHeightInPoints(), 0F);
         assertEquals((short)(17.5f*20), sheet.getDefaultRowHeight());
     }
 
@@ -537,19 +537,19 @@
 
         Workbook workbook = getTestDataProvider().createWorkbook();
         Sheet sheet = workbook.createSheet("Sheet 1");
-        assertEquals(marginLeft, sheet.getMargin(Sheet.LeftMargin));
+        assertEquals(marginLeft, sheet.getMargin(Sheet.LeftMargin), 0.0);
         sheet.setMargin(Sheet.LeftMargin, 10.0);
         //left margin is custom, all others are default
-        assertEquals(10.0, sheet.getMargin(Sheet.LeftMargin));
-        assertEquals(marginRight, sheet.getMargin(Sheet.RightMargin));
-        assertEquals(marginTop, sheet.getMargin(Sheet.TopMargin));
-        assertEquals(marginBottom, sheet.getMargin(Sheet.BottomMargin));
+        assertEquals(10.0, sheet.getMargin(Sheet.LeftMargin), 0.0);
+        assertEquals(marginRight, sheet.getMargin(Sheet.RightMargin), 0.0);
+        assertEquals(marginTop, sheet.getMargin(Sheet.TopMargin), 0.0);
+        assertEquals(marginBottom, sheet.getMargin(Sheet.BottomMargin), 0.0);
         sheet.setMargin(Sheet.RightMargin, 11.0);
-        assertEquals(11.0, sheet.getMargin(Sheet.RightMargin));
+        assertEquals(11.0, sheet.getMargin(Sheet.RightMargin), 0.0);
         sheet.setMargin(Sheet.TopMargin, 12.0);
-        assertEquals(12.0, sheet.getMargin(Sheet.TopMargin));
+        assertEquals(12.0, sheet.getMargin(Sheet.TopMargin), 0.0);
         sheet.setMargin(Sheet.BottomMargin, 13.0);
-        assertEquals(13.0, sheet.getMargin(Sheet.BottomMargin));
+        assertEquals(13.0, sheet.getMargin(Sheet.BottomMargin), 0.0);
 
         // incorrect margin constant
         try {
@@ -618,9 +618,9 @@
     public void testGetFirstLastRowNum() {
         Workbook workbook = getTestDataProvider().createWorkbook();
         Sheet sheet = workbook.createSheet("Sheet 1");
-        Row row10 = sheet.createRow(9);
-        Row row1 = sheet.createRow(0);
-        Row row2 = sheet.createRow(1);
+        sheet.createRow(9);
+        sheet.createRow(0);
+        sheet.createRow(1);
         assertEquals(0, sheet.getFirstRowNum());
         assertEquals(9, sheet.getLastRowNum());
     }
@@ -639,6 +639,4 @@
         sheet.setColumnHidden(2, true);
         assertTrue(sheet.isColumnHidden(2));
     }
-
-
-}
\ No newline at end of file
+}



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


Mime
View raw message