diff options
author | Josh Micich <josh@apache.org> | 2009-08-18 19:49:28 +0000 |
---|---|---|
committer | Josh Micich <josh@apache.org> | 2009-08-18 19:49:28 +0000 |
commit | 27b61f396a324f7e7882a7e9bbf80c60cef573a0 (patch) | |
tree | cb4869ab9298a8676d18d5385d8e84aa5e850a66 /src/scratchpad/testcases/org/apache/poi | |
parent | a2cd9a942e1cc575254690ea4b7e9053cade05b3 (diff) | |
download | poi-27b61f396a324f7e7882a7e9bbf80c60cef573a0.tar.gz poi-27b61f396a324f7e7882a7e9bbf80c60cef573a0.zip |
Fixed compiler warnings - unnecessary throws declaration
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@805552 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/scratchpad/testcases/org/apache/poi')
58 files changed, 648 insertions, 701 deletions
diff --git a/src/scratchpad/testcases/org/apache/poi/TestPOIDocumentScratchpad.java b/src/scratchpad/testcases/org/apache/poi/TestPOIDocumentScratchpad.java index e66a262664..8c9224fd9d 100644 --- a/src/scratchpad/testcases/org/apache/poi/TestPOIDocumentScratchpad.java +++ b/src/scratchpad/testcases/org/apache/poi/TestPOIDocumentScratchpad.java @@ -49,7 +49,7 @@ public final class TestPOIDocumentScratchpad extends TestCase { * Set things up, using a PowerPoint document and * a Word Document for our testing */ - public void setUp() throws Exception { + public void setUp() throws Exception { String dirnameHSLF = System.getProperty("HSLF.testdata.path"); String filenameHSLF = dirnameHSLF + "/basic_test_ppt_file.ppt"; String dirnameHSSF = System.getProperty("HSSF.testdata.path"); @@ -66,39 +66,35 @@ public final class TestPOIDocumentScratchpad extends TestCase { doc2 = new HWPFDocument(pfs2); } - public void testReadProperties() throws Exception { - // We should have both sets - assertNotNull(doc.getDocumentSummaryInformation()); - assertNotNull(doc.getSummaryInformation()); + public void testReadProperties() { + // We should have both sets + assertNotNull(doc.getDocumentSummaryInformation()); + assertNotNull(doc.getSummaryInformation()); - // Check they are as expected for the test doc - assertEquals("Hogwarts", doc.getSummaryInformation().getAuthor()); - assertEquals(10598, doc.getDocumentSummaryInformation().getByteCount()); - } + // Check they are as expected for the test doc + assertEquals("Hogwarts", doc.getSummaryInformation().getAuthor()); + assertEquals(10598, doc.getDocumentSummaryInformation().getByteCount()); + } - public void testReadProperties2() throws Exception { - // Check again on the word one - assertNotNull(doc2.getDocumentSummaryInformation()); - assertNotNull(doc2.getSummaryInformation()); + public void testReadProperties2() { + // Check again on the word one + assertNotNull(doc2.getDocumentSummaryInformation()); + assertNotNull(doc2.getSummaryInformation()); - assertEquals("Hogwarts", doc2.getSummaryInformation().getAuthor()); - assertEquals("", doc2.getSummaryInformation().getKeywords()); - assertEquals(0, doc2.getDocumentSummaryInformation().getByteCount()); - } + assertEquals("Hogwarts", doc2.getSummaryInformation().getAuthor()); + assertEquals("", doc2.getSummaryInformation().getKeywords()); + assertEquals(0, doc2.getDocumentSummaryInformation().getByteCount()); + } - public void testWriteProperties() throws Exception { - // Just check we can write them back out into a filesystem - POIFSFileSystem outFS = new POIFSFileSystem(); - doc.writeProperties(outFS); + public void testWriteProperties() throws Exception { + // Just check we can write them back out into a filesystem + POIFSFileSystem outFS = new POIFSFileSystem(); + doc.writeProperties(outFS); - // Should now hold them - assertNotNull( - outFS.createDocumentInputStream("\005SummaryInformation") - ); - assertNotNull( - outFS.createDocumentInputStream("\005DocumentSummaryInformation") - ); - } + // Should now hold them + assertNotNull(outFS.createDocumentInputStream("\005SummaryInformation")); + assertNotNull(outFS.createDocumentInputStream("\005DocumentSummaryInformation")); + } public void testWriteReadProperties() throws Exception { ByteArrayOutputStream baos = new ByteArrayOutputStream(); diff --git a/src/scratchpad/testcases/org/apache/poi/hdgf/TestHDGFLZW.java b/src/scratchpad/testcases/org/apache/poi/hdgf/TestHDGFLZW.java index bbdeadad09..f3af7c375f 100644 --- a/src/scratchpad/testcases/org/apache/poi/hdgf/TestHDGFLZW.java +++ b/src/scratchpad/testcases/org/apache/poi/hdgf/TestHDGFLZW.java @@ -106,7 +106,7 @@ public final class TestHDGFLZW extends TestCase { 0, 0, 42, 1, 0, 0, 84, 0, 0, 0, 0, 0 }; - public void testFromToInt() throws Exception { + public void testFromToInt() { byte b255 = -1; assertEquals(255, HDGFLZW.fromByte(b255)); assertEquals(-1, HDGFLZW.fromInt( HDGFLZW.fromByte(b255) )); diff --git a/src/scratchpad/testcases/org/apache/poi/hdgf/extractor/TestVisioExtractor.java b/src/scratchpad/testcases/org/apache/poi/hdgf/extractor/TestVisioExtractor.java index a24733c919..16bd9a961e 100644 --- a/src/scratchpad/testcases/org/apache/poi/hdgf/extractor/TestVisioExtractor.java +++ b/src/scratchpad/testcases/org/apache/poi/hdgf/extractor/TestVisioExtractor.java @@ -30,7 +30,7 @@ import org.apache.poi.poifs.filesystem.POIFSFileSystem; public final class TestVisioExtractor extends TestCase { private String dirname; private String defFilename; - protected void setUp() throws Exception { + protected void setUp() { dirname = System.getProperty("HDGF.testdata.path"); defFilename = dirname + "/Test_Visio-Some_Random_Text.vsd"; } diff --git a/src/scratchpad/testcases/org/apache/poi/hdgf/pointers/TestPointerFactory.java b/src/scratchpad/testcases/org/apache/poi/hdgf/pointers/TestPointerFactory.java index aaed0fd6f8..b8aa155888 100644 --- a/src/scratchpad/testcases/org/apache/poi/hdgf/pointers/TestPointerFactory.java +++ b/src/scratchpad/testcases/org/apache/poi/hdgf/pointers/TestPointerFactory.java @@ -40,7 +40,7 @@ public final class TestPointerFactory extends TestCase { -1, 0, 0, 0, -84, -1, 79, 1, 0, 0, 0, 0, 0, 0, 0, 0, 96, 0 }; - public void testCreateV4() throws Exception { + public void testCreateV4() { PointerFactory pf = new PointerFactory(4); try { pf.createPointer(new byte[]{}, 0); @@ -50,7 +50,7 @@ public final class TestPointerFactory extends TestCase { } } - public void testCreateV5() throws Exception { + public void testCreateV5() { PointerFactory pf = new PointerFactory(5); try { pf.createPointer(new byte[]{}, 0); @@ -61,7 +61,7 @@ public final class TestPointerFactory extends TestCase { } } - public void testCreateV6() throws Exception { + public void testCreateV6() { PointerFactory pf = new PointerFactory(6); Pointer a = pf.createPointer(vp6_a, 0); @@ -117,7 +117,7 @@ public final class TestPointerFactory extends TestCase { assertFalse(d.destinationHasPointers()); } - public void testCreateV6FromMid() throws Exception { + public void testCreateV6FromMid() { PointerFactory pf = new PointerFactory(11); // Create a from part way down the byte stream diff --git a/src/scratchpad/testcases/org/apache/poi/hdgf/streams/TestStreamBugs.java b/src/scratchpad/testcases/org/apache/poi/hdgf/streams/TestStreamBugs.java index 507c2e9579..66c3907082 100644 --- a/src/scratchpad/testcases/org/apache/poi/hdgf/streams/TestStreamBugs.java +++ b/src/scratchpad/testcases/org/apache/poi/hdgf/streams/TestStreamBugs.java @@ -52,17 +52,17 @@ public final class TestStreamBugs extends StreamTest { filesystem.createDocumentInputStream("VisioDocument").read(contents); } - public void testGetTrailer() throws Exception { + public void testGetTrailer() { Pointer trailerPointer = ptrFactory.createPointer(contents, 0x24); Stream.createStream(trailerPointer, contents, chunkFactory, ptrFactory); } - public void TOIMPLEMENTtestGetCertainChunks() throws Exception { + public void TOIMPLEMENTtestGetCertainChunks() { int offsetA = 3708; int offsetB = 3744; } - public void testGetChildren() throws Exception { + public void testGetChildren() { Pointer trailerPointer = ptrFactory.createPointer(contents, 0x24); TrailerStream trailer = (TrailerStream) Stream.createStream(trailerPointer, contents, chunkFactory, ptrFactory); diff --git a/src/scratchpad/testcases/org/apache/poi/hdgf/streams/TestStreamComplex.java b/src/scratchpad/testcases/org/apache/poi/hdgf/streams/TestStreamComplex.java index 8f1897e00e..a06c03aa24 100644 --- a/src/scratchpad/testcases/org/apache/poi/hdgf/streams/TestStreamComplex.java +++ b/src/scratchpad/testcases/org/apache/poi/hdgf/streams/TestStreamComplex.java @@ -205,7 +205,7 @@ public final class TestStreamComplex extends StreamTest { assertTrue(s8451.getPointedToStreams()[1] instanceof StringsStream); } - public void testChunkWithText() throws Exception { + public void testChunkWithText() { // Parent ChunkStream is at 0x7194 // This is one of the last children of the trailer Pointer trailerPtr = ptrFactory.createPointer(contents, trailerPointerAt); diff --git a/src/scratchpad/testcases/org/apache/poi/hpbf/TestHPBFDocument.java b/src/scratchpad/testcases/org/apache/poi/hpbf/TestHPBFDocument.java index 29ab7a8aca..96e1591e02 100644 --- a/src/scratchpad/testcases/org/apache/poi/hpbf/TestHPBFDocument.java +++ b/src/scratchpad/testcases/org/apache/poi/hpbf/TestHPBFDocument.java @@ -25,7 +25,7 @@ import junit.framework.TestCase; public final class TestHPBFDocument extends TestCase { private String dir; - protected void setUp() throws Exception { + protected void setUp() { dir = System.getProperty("HPBF.testdata.path"); } diff --git a/src/scratchpad/testcases/org/apache/poi/hpbf/extractor/TextPublisherTextExtractor.java b/src/scratchpad/testcases/org/apache/poi/hpbf/extractor/TextPublisherTextExtractor.java index 6bd05612e0..7aceb66d43 100644 --- a/src/scratchpad/testcases/org/apache/poi/hpbf/extractor/TextPublisherTextExtractor.java +++ b/src/scratchpad/testcases/org/apache/poi/hpbf/extractor/TextPublisherTextExtractor.java @@ -27,7 +27,7 @@ import junit.framework.TestCase; public final class TextPublisherTextExtractor extends TestCase { private String dir; - protected void setUp() throws Exception { + protected void setUp() { dir = System.getProperty("HPBF.testdata.path"); } diff --git a/src/scratchpad/testcases/org/apache/poi/hpbf/model/TestEscherParts.java b/src/scratchpad/testcases/org/apache/poi/hpbf/model/TestEscherParts.java index e803cae156..702c5fd8f3 100644 --- a/src/scratchpad/testcases/org/apache/poi/hpbf/model/TestEscherParts.java +++ b/src/scratchpad/testcases/org/apache/poi/hpbf/model/TestEscherParts.java @@ -27,7 +27,7 @@ import junit.framework.TestCase; public final class TestEscherParts extends TestCase { private String dir; - protected void setUp() throws Exception { + protected void setUp() { dir = System.getProperty("HPBF.testdata.path"); } diff --git a/src/scratchpad/testcases/org/apache/poi/hpbf/model/TestQuillContents.java b/src/scratchpad/testcases/org/apache/poi/hpbf/model/TestQuillContents.java index 69d46d0923..6a80c86286 100644 --- a/src/scratchpad/testcases/org/apache/poi/hpbf/model/TestQuillContents.java +++ b/src/scratchpad/testcases/org/apache/poi/hpbf/model/TestQuillContents.java @@ -32,7 +32,7 @@ import junit.framework.TestCase; public final class TestQuillContents extends TestCase { private String dir; - protected void setUp() throws Exception { + protected void setUp() { dir = System.getProperty("HPBF.testdata.path"); } diff --git a/src/scratchpad/testcases/org/apache/poi/hslf/TestRecordCounts.java b/src/scratchpad/testcases/org/apache/poi/hslf/TestRecordCounts.java index 60b93dea64..16e0c2785c 100644 --- a/src/scratchpad/testcases/org/apache/poi/hslf/TestRecordCounts.java +++ b/src/scratchpad/testcases/org/apache/poi/hslf/TestRecordCounts.java @@ -31,13 +31,13 @@ public final class TestRecordCounts extends TestCase { // HSLFSlideShow primed on the test data private HSLFSlideShow ss; - public TestRecordCounts() throws Exception { + public TestRecordCounts() throws Exception { String dirname = System.getProperty("HSLF.testdata.path"); String filename = dirname + "/basic_test_ppt_file.ppt"; ss = new HSLFSlideShow(filename); - } + } - public void testSheetsCount() throws Exception { + public void testSheetsCount() { // Top level Record[] r = ss.getRecords(); @@ -51,7 +51,7 @@ public final class TestRecordCounts extends TestCase { assertEquals(3,count); } - public void testNotesCount() throws Exception { + public void testNotesCount() { // Top level Record[] r = ss.getRecords(); @@ -66,7 +66,7 @@ public final class TestRecordCounts extends TestCase { assertEquals(3,count); } - public void testSlideListWithTextCount() throws Exception { + public void testSlideListWithTextCount() { // Second level Record[] rt = ss.getRecords(); Record[] r = rt[0].getChildRecords(); diff --git a/src/scratchpad/testcases/org/apache/poi/hslf/extractor/TestCruddyExtractor.java b/src/scratchpad/testcases/org/apache/poi/hslf/extractor/TestCruddyExtractor.java index e45ca51d12..fdcc45e0b9 100644 --- a/src/scratchpad/testcases/org/apache/poi/hslf/extractor/TestCruddyExtractor.java +++ b/src/scratchpad/testcases/org/apache/poi/hslf/extractor/TestCruddyExtractor.java @@ -61,7 +61,7 @@ public final class TestCruddyExtractor extends TestCase { te = new QuickButCruddyTextExtractor(filename); } - public void testReadAsVector() throws Exception { + public void testReadAsVector() { // Extract the text from the file as a vector Vector foundTextV = te.getTextAsVector(); @@ -73,7 +73,7 @@ public final class TestCruddyExtractor extends TestCase { } } - public void testReadAsString() throws Exception { + public void testReadAsString() { // Extract the text as a String String foundText = te.getTextAsString(); diff --git a/src/scratchpad/testcases/org/apache/poi/hslf/model/TestBackground.java b/src/scratchpad/testcases/org/apache/poi/hslf/model/TestBackground.java index 7871b05976..e1ac1914f6 100644 --- a/src/scratchpad/testcases/org/apache/poi/hslf/model/TestBackground.java +++ b/src/scratchpad/testcases/org/apache/poi/hslf/model/TestBackground.java @@ -35,7 +35,7 @@ public final class TestBackground extends TestCase { /** * Default background for slide, shape and slide master. */ - public void testDefaults() throws Exception { + public void testDefaults() { SlideShow ppt = new SlideShow(); assertEquals(Fill.FILL_SOLID, ppt.getSlidesMasters()[0].getBackground().getFill().getFillType()); diff --git a/src/scratchpad/testcases/org/apache/poi/hslf/model/TestPPFont.java b/src/scratchpad/testcases/org/apache/poi/hslf/model/TestPPFont.java index f445f2b62b..aff848dfc5 100755 --- a/src/scratchpad/testcases/org/apache/poi/hslf/model/TestPPFont.java +++ b/src/scratchpad/testcases/org/apache/poi/hslf/model/TestPPFont.java @@ -20,8 +20,6 @@ package org.apache.poi.hslf.model; import junit.framework.TestCase; import org.apache.poi.hslf.usermodel.SlideShow; -import java.io.IOException; - /** * Test adding fonts to the presenataion resources * @@ -29,7 +27,7 @@ import java.io.IOException; */ public final class TestPPFont extends TestCase{ - public void testCreate() throws IOException { + public void testCreate() { SlideShow ppt = new SlideShow(); assertEquals(1, ppt.getNumberOfFonts()); assertEquals("Arial", ppt.getFont(0).getFontName()); diff --git a/src/scratchpad/testcases/org/apache/poi/hslf/model/TestPicture.java b/src/scratchpad/testcases/org/apache/poi/hslf/model/TestPicture.java index 9d80f7dc72..3be128921b 100755 --- a/src/scratchpad/testcases/org/apache/poi/hslf/model/TestPicture.java +++ b/src/scratchpad/testcases/org/apache/poi/hslf/model/TestPicture.java @@ -21,7 +21,6 @@ import java.awt.Graphics2D; import java.awt.Rectangle; import java.awt.image.BufferedImage; import java.io.File; -import java.io.IOException; import junit.framework.TestCase; diff --git a/src/scratchpad/testcases/org/apache/poi/hslf/model/TestShapes.java b/src/scratchpad/testcases/org/apache/poi/hslf/model/TestShapes.java index 565445f7b4..292b7fd63d 100644 --- a/src/scratchpad/testcases/org/apache/poi/hslf/model/TestShapes.java +++ b/src/scratchpad/testcases/org/apache/poi/hslf/model/TestShapes.java @@ -183,7 +183,7 @@ public final class TestShapes extends TestCase { /** * Test with an empty text box */ - public void testEmptyTextBox() throws Exception { + public void testEmptyTextBox() { assertEquals(2, pptB.getSlides().length); Slide s1 = pptB.getSlides()[0]; Slide s2 = pptB.getSlides()[1]; @@ -310,7 +310,7 @@ public final class TestShapes extends TestCase { assertEquals("expected 0 shaped in " + file, 0, sl.getShapes().length); } - public void testLineWidth() throws IOException { + public void testLineWidth() { SimpleShape sh = new AutoShape(ShapeTypes.RightTriangle); EscherOptRecord opt = (EscherOptRecord)SimpleShape.getEscherChild(sh.getSpContainer(), EscherOptRecord.RECORD_ID); @@ -324,7 +324,7 @@ public final class TestShapes extends TestCase { assertEquals(1.0, sh.getLineWidth()); } - public void testShapeId() throws IOException { + public void testShapeId() { SlideShow ppt = new SlideShow(); Slide slide = ppt.createSlide(); Shape shape = null; diff --git a/src/scratchpad/testcases/org/apache/poi/hslf/model/TestSheet.java b/src/scratchpad/testcases/org/apache/poi/hslf/model/TestSheet.java index 0282c2a7e6..667478b043 100644 --- a/src/scratchpad/testcases/org/apache/poi/hslf/model/TestSheet.java +++ b/src/scratchpad/testcases/org/apache/poi/hslf/model/TestSheet.java @@ -17,6 +17,7 @@ package org.apache.poi.hslf.model; +import junit.framework.AssertionFailedError; import junit.framework.TestCase; import java.io.FileInputStream; @@ -34,7 +35,7 @@ import org.apache.poi.hslf.usermodel.SlideShow; * * @author Yegor Kozlov */ -public final class TestSheet extends TestCase{ +public final class TestSheet extends TestCase { /** * For each ppt in the test directory check that all sheets are properly initialized @@ -59,7 +60,7 @@ public final class TestSheet extends TestCase{ } } - private void doSlideShow(SlideShow ppt) throws Exception { + private void doSlideShow(SlideShow ppt) { Slide[] slide = ppt.getSlides(); for (int i = 0; i < slide.length; i++) { verify(slide[i]); @@ -89,19 +90,22 @@ public final class TestSheet extends TestCase{ assertTrue(sheet._getSheetRefId() != 0); TextRun[] txt = sheet.getTextRuns(); - assertTrue(txt != null); + if (txt == null) { + throw new AssertionFailedError("no text runs"); + } for (int i = 0; i < txt.length; i++) { assertNotNull(txt[i].getSheet()); } Shape[] shape = sheet.getShapes(); - assertTrue(shape != null); + if (shape == null) { + throw new AssertionFailedError("no shapes"); + } for (int i = 0; i < shape.length; i++) { assertNotNull(shape[i].getSpContainer()); assertNotNull(shape[i].getSheet()); assertNotNull(shape[i].getShapeName()); assertNotNull(shape[i].getAnchor()); } - } } diff --git a/src/scratchpad/testcases/org/apache/poi/hslf/model/TestTextRun.java b/src/scratchpad/testcases/org/apache/poi/hslf/model/TestTextRun.java index 2fcc6927c7..770a44803e 100644 --- a/src/scratchpad/testcases/org/apache/poi/hslf/model/TestTextRun.java +++ b/src/scratchpad/testcases/org/apache/poi/hslf/model/TestTextRun.java @@ -18,6 +18,8 @@ package org.apache.poi.hslf.model; +import java.io.IOException; + import junit.framework.TestCase; import org.apache.poi.hslf.HSLFSlideShow; @@ -37,27 +39,35 @@ public final class TestTextRun extends TestCase { // SlideShow primed on the test data private SlideShow ss; private SlideShow ssRich; - private HSLFSlideShow hss; - private HSLFSlideShow hssRich; - protected void setUp() throws Exception { + // TODO - use this or similar through rest of hslf tests + private static SlideShow openSampleSlideShow(String name) { String dirname = System.getProperty("HSLF.testdata.path"); // Basic (non rich) test file - String filename = dirname + "/basic_test_ppt_file.ppt"; - hss = new HSLFSlideShow(filename); - ss = new SlideShow(hss); + String filename = dirname + "/" + name; + HSLFSlideShow x; + try { + x = new HSLFSlideShow(filename); + } catch (IOException e) { + throw new RuntimeException(e); + } + return new SlideShow(x); + } + + protected void setUp() { + + // Basic (non rich) test file + ss = openSampleSlideShow("basic_test_ppt_file.ppt"); // Rich test file - filename = dirname + "/Single_Coloured_Page.ppt"; - hssRich = new HSLFSlideShow(filename); - ssRich = new SlideShow(hssRich); + ssRich = openSampleSlideShow("Single_Coloured_Page.ppt"); } - /** - * Test to ensure that getting the text works correctly - */ - public void testGetText() throws Exception { + /** + * Test to ensure that getting the text works correctly + */ + public void testGetText() { Slide slideOne = ss.getSlides()[0]; TextRun[] textRuns = slideOne.getTextRuns(); @@ -81,12 +91,12 @@ public final class TestTextRun extends TestCase { assertEquals("This is the subtitle, in bold\nThis bit is blue and italic\nThis bit is red (normal)", textRunsR[1].getText()); assertEquals("This is a title, it\u2019s in black", textRunsR[0].getRawText()); assertEquals("This is the subtitle, in bold\rThis bit is blue and italic\rThis bit is red (normal)", textRunsR[1].getRawText()); - } + } - /** - * Test to ensure changing non rich text bytes->bytes works correctly - */ - public void testSetText() throws Exception { + /** + * Test to ensure changing non rich text bytes->bytes works correctly + */ + public void testSetText() { Slide slideOne = ss.getSlides()[0]; TextRun[] textRuns = slideOne.getTextRuns(); TextRun run = textRuns[0]; @@ -102,13 +112,13 @@ public final class TestTextRun extends TestCase { // Ensure trailing \n's get stripped run.setText(changeTo + "\n"); assertEquals(changeTo, run.getText()); - } + } - /** - * Test to ensure that changing non rich text between bytes and - * chars works correctly - */ - public void testAdvancedSetText() throws Exception { + /** + * Test to ensure that changing non rich text between bytes and + * chars works correctly + */ + public void testAdvancedSetText() { Slide slideOne = ss.getSlides()[0]; TextRun run = slideOne.getTextRuns()[0]; @@ -116,7 +126,7 @@ public final class TestTextRun extends TestCase { TextBytesAtom tba = run._byteAtom; TextCharsAtom tca = run._charAtom; - // Bytes -> Bytes + // Bytes -> Bytes assertNull(tca); assertNotNull(tba); assertFalse(run._isUnicode); @@ -132,7 +142,7 @@ public final class TestTextRun extends TestCase { assertNull(tca); assertNotNull(tba); - // Bytes -> Chars + // Bytes -> Chars assertNull(tca); assertNotNull(tba); assertFalse(run._isUnicode); @@ -148,7 +158,7 @@ public final class TestTextRun extends TestCase { assertNotNull(tca); assertNull(tba); - // Chars -> Chars + // Chars -> Chars assertNull(tba); assertNotNull(tca); assertTrue(run._isUnicode); @@ -163,13 +173,13 @@ public final class TestTextRun extends TestCase { assertTrue(run._isUnicode); assertNotNull(tca); assertNull(tba); - } + } - /** - * Tests to ensure that non rich text has the right default rich text run - * set up for it - */ - public void testGetRichTextNonRich() throws Exception { + /** + * Tests to ensure that non rich text has the right default rich text run + * set up for it + */ + public void testGetRichTextNonRich() { Slide slideOne = ss.getSlides()[0]; TextRun[] textRuns = slideOne.getTextRuns(); @@ -191,12 +201,12 @@ public final class TestTextRun extends TestCase { assertNull(rtrA._getRawParagraphStyle()); assertNull(rtrB._getRawCharacterStyle()); assertNull(rtrB._getRawParagraphStyle()); - } + } - /** - * Tests to ensure that the rich text runs are built up correctly - */ - public void testGetRichText() throws Exception { + /** + * Tests to ensure that the rich text runs are built up correctly + */ + public void testGetRichText() { Slide slideOne = ssRich.getSlides()[0]; TextRun[] textRuns = slideOne.getTextRuns(); @@ -236,13 +246,13 @@ public final class TestTextRun extends TestCase { assertFalse( rtrB._getRawCharacterStyle().equals( rtrC._getRawCharacterStyle() )); assertFalse( rtrB._getRawCharacterStyle().equals( rtrD._getRawCharacterStyle() )); assertFalse( rtrC._getRawCharacterStyle().equals( rtrD._getRawCharacterStyle() )); - } + } - /** - * Tests to ensure that setting the text where the text isn't rich, - * ensuring that everything stays with the same default styling - */ - public void testSetTextWhereNotRich() throws Exception { + /** + * Tests to ensure that setting the text where the text isn't rich, + * ensuring that everything stays with the same default styling + */ + public void testSetTextWhereNotRich() { Slide slideOne = ss.getSlides()[0]; TextRun[] textRuns = slideOne.getTextRuns(); TextRun trB = textRuns[1]; @@ -260,13 +270,13 @@ public final class TestTextRun extends TestCase { assertEquals("Test Foo Test", rtrB.getText()); assertNull(rtrB._getRawCharacterStyle()); assertNull(rtrB._getRawParagraphStyle()); - } + } - /** - * Tests to ensure that setting the text where the text is rich - * sets everything to the same styling - */ - public void testSetTextWhereRich() throws Exception { + /** + * Tests to ensure that setting the text where the text is rich + * sets everything to the same styling + */ + public void testSetTextWhereRich() { Slide slideOne = ssRich.getSlides()[0]; TextRun[] textRuns = slideOne.getTextRuns(); TextRun trB = textRuns[1]; @@ -308,13 +318,13 @@ public final class TestTextRun extends TestCase { assertNotNull(rtrB._getRawParagraphStyle()); assertEquals( tpBP, rtrB._getRawParagraphStyle() ); assertEquals( tpBC, rtrB._getRawCharacterStyle() ); - } + } - /** - * Test to ensure the right stuff happens if we change the text - * in a rich text run, that doesn't happen to actually be rich - */ - public void testChangeTextInRichTextRunNonRich() throws Exception { + /** + * Test to ensure the right stuff happens if we change the text + * in a rich text run, that doesn't happen to actually be rich + */ + public void testChangeTextInRichTextRunNonRich() { Slide slideOne = ss.getSlides()[0]; TextRun[] textRuns = slideOne.getTextRuns(); TextRun trB = textRuns[1]; @@ -333,13 +343,13 @@ public final class TestTextRun extends TestCase { // Will now have dummy props assertNotNull(rtrB._getRawCharacterStyle()); assertNotNull(rtrB._getRawParagraphStyle()); - } + } - /** - * Tests to ensure changing the text within rich text runs works - * correctly - */ - public void testChangeTextInRichTextRun() throws Exception { + /** + * Tests to ensure changing the text within rich text runs works + * correctly + */ + public void testChangeTextInRichTextRun() { Slide slideOne = ssRich.getSlides()[0]; TextRun[] textRuns = slideOne.getTextRuns(); TextRun trB = textRuns[1]; @@ -409,7 +419,7 @@ public final class TestTextRun extends TestCase { assertEquals(tpBC.getTextPropList(), ntpBC.getTextPropList()); assertEquals(tpCC.getTextPropList(), ntpCC.getTextPropList()); assertEquals(tpDC.getTextPropList(), ntpDC.getTextPropList()); - } + } /** @@ -419,10 +429,10 @@ public final class TestTextRun extends TestCase { * of the wrong list of potential paragraph properties defined in StyleTextPropAtom. * */ - public void testBug41015() throws Exception { + public void testBug41015() { RichTextRun[] rt; - SlideShow ppt = new SlideShow(new HSLFSlideShow(System.getProperty("HSLF.testdata.path") + "/bug-41015.ppt")); + SlideShow ppt = openSampleSlideShow("bug-41015.ppt"); Slide sl = ppt.getSlides()[0]; TextRun[] txt = sl.getTextRuns(); assertEquals(2, txt.length); @@ -436,61 +446,61 @@ public final class TestTextRun extends TestCase { assertEquals(2, rt.length); assertEquals(0, rt[0].getIndentLevel()); assertEquals("Sdfsdfsdf\n" + - "Dfgdfg\n" + - "Dfgdfgdfg\n", rt[0].getText()); + "Dfgdfg\n" + + "Dfgdfgdfg\n", rt[0].getText()); assertEquals(1, rt[1].getIndentLevel()); assertEquals("Sdfsdfs\n" + - "Sdfsdf\n", rt[1].getText()); + "Sdfsdf\n", rt[1].getText()); } - /** - * Test creation of TextRun objects. - */ - public void testAddTextRun() throws Exception{ - SlideShow ppt = new SlideShow(); - Slide slide = ppt.createSlide(); - - assertNull(slide.getTextRuns()); - - TextBox shape1 = new TextBox(); - TextRun run1 = shape1.getTextRun(); - assertSame(run1, shape1.createTextRun()); - run1.setText("Text 1"); - slide.addShape(shape1); - - //The array of Slide's text runs must be updated when new text shapes are added. - TextRun[] runs = slide.getTextRuns(); - assertNotNull(runs); - assertSame(run1, runs[0]); - - TextBox shape2 = new TextBox(); - TextRun run2 = shape2.getTextRun(); - assertSame(run2, shape2.createTextRun()); - run2.setText("Text 2"); - slide.addShape(shape2); - - runs = slide.getTextRuns(); - assertEquals(2, runs.length); - - assertSame(run1, runs[0]); - assertSame(run2, runs[1]); - - //as getShapes() - Shape[] sh = slide.getShapes(); - assertEquals(2, sh.length); - assertTrue(sh[0] instanceof TextBox); - TextBox box1 = (TextBox)sh[0]; - assertSame(run1, box1.getTextRun()); - TextBox box2 = (TextBox)sh[1]; - assertSame(run2, box2.getTextRun()); - - //test Table - a complex group of shapes containing text objects - Slide slide2 = ppt.createSlide(); - assertNull(slide2.getTextRuns()); - Table table = new Table(2, 2); - slide2.addShape(table); - runs = slide2.getTextRuns(); - assertNotNull(runs); - assertEquals(4, runs.length); - } + /** + * Test creation of TextRun objects. + */ + public void testAddTextRun() { + SlideShow ppt = new SlideShow(); + Slide slide = ppt.createSlide(); + + assertNull(slide.getTextRuns()); + + TextBox shape1 = new TextBox(); + TextRun run1 = shape1.getTextRun(); + assertSame(run1, shape1.createTextRun()); + run1.setText("Text 1"); + slide.addShape(shape1); + + //The array of Slide's text runs must be updated when new text shapes are added. + TextRun[] runs = slide.getTextRuns(); + assertNotNull(runs); + assertSame(run1, runs[0]); + + TextBox shape2 = new TextBox(); + TextRun run2 = shape2.getTextRun(); + assertSame(run2, shape2.createTextRun()); + run2.setText("Text 2"); + slide.addShape(shape2); + + runs = slide.getTextRuns(); + assertEquals(2, runs.length); + + assertSame(run1, runs[0]); + assertSame(run2, runs[1]); + + //as getShapes() + Shape[] sh = slide.getShapes(); + assertEquals(2, sh.length); + assertTrue(sh[0] instanceof TextBox); + TextBox box1 = (TextBox)sh[0]; + assertSame(run1, box1.getTextRun()); + TextBox box2 = (TextBox)sh[1]; + assertSame(run2, box2.getTextRun()); + + //test Table - a complex group of shapes containing text objects + Slide slide2 = ppt.createSlide(); + assertNull(slide2.getTextRuns()); + Table table = new Table(2, 2); + slide2.addShape(table); + runs = slide2.getTextRuns(); + assertNotNull(runs); + assertEquals(4, runs.length); + } } diff --git a/src/scratchpad/testcases/org/apache/poi/hslf/record/TestCString.java b/src/scratchpad/testcases/org/apache/poi/hslf/record/TestCString.java index 5fffb13427..13090c812a 100644 --- a/src/scratchpad/testcases/org/apache/poi/hslf/record/TestCString.java +++ b/src/scratchpad/testcases/org/apache/poi/hslf/record/TestCString.java @@ -35,13 +35,13 @@ public final class TestCString extends TestCase { 0x43, 00, 0x6F, 00, 0x6D, 00, 0x6D, 00, 0x65, 00, 0x6E, 00, 0x74, 00, 0x73, 00 }; - public void testRecordType() throws Exception { + public void testRecordType() { CString ca = new CString(data_a, 0, data_a.length); assertEquals(4026l, ca.getRecordType()); CString cb = new CString(data_b, 0, data_a.length); assertEquals(4026l, cb.getRecordType()); } - public void testCount() throws Exception { + public void testCount() { CString ca = new CString(data_a, 0, data_a.length); assertEquals(0, ca.getOptions()); CString cb = new CString(data_b, 0, data_a.length); @@ -51,7 +51,7 @@ public final class TestCString extends TestCase { assertEquals(28, ca.getOptions()); } - public void testText() throws Exception { + public void testText() { CString ca = new CString(data_a, 0, data_a.length); assertEquals("Hogwarts", ca.getText()); CString cb = new CString(data_b, 0, data_a.length); diff --git a/src/scratchpad/testcases/org/apache/poi/hslf/record/TestColorSchemeAtom.java b/src/scratchpad/testcases/org/apache/poi/hslf/record/TestColorSchemeAtom.java index 22e6347dec..e506075e04 100644 --- a/src/scratchpad/testcases/org/apache/poi/hslf/record/TestColorSchemeAtom.java +++ b/src/scratchpad/testcases/org/apache/poi/hslf/record/TestColorSchemeAtom.java @@ -35,12 +35,12 @@ public final class TestColorSchemeAtom extends TestCase { 00, 0x99-256, 0x99-256, 00, 0x99-256, 0xCC-256, 00, 00 }; - public void testRecordType() throws Exception { + public void testRecordType() { ColorSchemeAtom csa = new ColorSchemeAtom(data_a,0,data_a.length); assertEquals(2032l, csa.getRecordType()); } - public void testToRGB() throws Exception { + public void testToRGB() { byte[] rgb = ColorSchemeAtom.splitRGB(3669760); assertEquals(3,rgb.length); @@ -49,7 +49,7 @@ public final class TestColorSchemeAtom extends TestCase { assertEquals(55, rgb[2]); } - public void testFromRGB() throws Exception { + public void testFromRGB() { byte[] rgb_a = new byte[] { 0, 255-256, 55 }; byte[] rgb_b = new byte[] { 255-256, 127, 79 }; @@ -60,7 +60,7 @@ public final class TestColorSchemeAtom extends TestCase { assertEquals( 5210111, ColorSchemeAtom.joinRGB( rgb_b[0], rgb_b[1], rgb_b[2] ) ); } - public void testRGBs() throws Exception { + public void testRGBs() { ColorSchemeAtom csa = new ColorSchemeAtom(data_a,0,data_a.length); assertEquals( 16777215 , csa.getBackgroundColourRGB() ); diff --git a/src/scratchpad/testcases/org/apache/poi/hslf/record/TestComment2000.java b/src/scratchpad/testcases/org/apache/poi/hslf/record/TestComment2000.java index f4fff8ca59..a3e1f2d8ae 100644 --- a/src/scratchpad/testcases/org/apache/poi/hslf/record/TestComment2000.java +++ b/src/scratchpad/testcases/org/apache/poi/hslf/record/TestComment2000.java @@ -84,16 +84,16 @@ public final class TestComment2000 extends TestCase { private SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS"); - public void testRecordType() throws Exception { + public void testRecordType() { Comment2000 ca = new Comment2000(data_a, 0, data_a.length); assertEquals(12000l, ca.getRecordType()); } - public void testAuthor() throws Exception { + public void testAuthor() { Comment2000 ca = new Comment2000(data_a, 0, data_a.length); assertEquals("Dumbledore", ca.getAuthor()); assertEquals("D", ca.getAuthorInitials()); } - public void testText() throws Exception { + public void testText() { Comment2000 ca = new Comment2000(data_a, 0, data_a.length); assertEquals("Yes, they certainly are, aren't they!", ca.getText()); } diff --git a/src/scratchpad/testcases/org/apache/poi/hslf/record/TestComment2000Atom.java b/src/scratchpad/testcases/org/apache/poi/hslf/record/TestComment2000Atom.java index a5749ee2e7..0e5f946a5f 100644 --- a/src/scratchpad/testcases/org/apache/poi/hslf/record/TestComment2000Atom.java +++ b/src/scratchpad/testcases/org/apache/poi/hslf/record/TestComment2000Atom.java @@ -47,35 +47,35 @@ public final class TestComment2000Atom extends TestCase { private SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS"); - public void testRecordType() throws Exception { + public void testRecordType() { Comment2000Atom ca = new Comment2000Atom(data_a, 0, data_a.length); assertEquals(12001l, ca.getRecordType()); } - public void testGetDate() throws Exception { + public void testGetDate() throws Exception { Comment2000Atom ca = new Comment2000Atom(data_a, 0, data_a.length); Comment2000Atom cb = new Comment2000Atom(data_b, 0, data_b.length); - // A is 2006-01-24 (2nd day of week) 10:26:15.205 + // A is 2006-01-24 (2nd day of week) 10:26:15.205 Date exp_a = sdf.parse("2006-01-24 10:26:15.205"); // B is 2006-01-24 (2nd day of week) 21:25:03.725 Date exp_b = sdf.parse("2006-01-24 21:25:03.725"); assertEquals(exp_a, ca.getDate()); assertEquals(exp_b, cb.getDate()); - } + } - public void testGetNums() throws Exception { + public void testGetNums() { Comment2000Atom ca = new Comment2000Atom(data_a, 0, data_a.length); Comment2000Atom cb = new Comment2000Atom(data_b, 0, data_b.length); - // A is number 1 + // A is number 1 assertEquals(1, ca.getNumber()); - // B is number 5 + // B is number 5 assertEquals(5, cb.getNumber()); - } + } - public void testGetPos() throws Exception { + public void testGetPos() { Comment2000Atom ca = new Comment2000Atom(data_a, 0, data_a.length); Comment2000Atom cb = new Comment2000Atom(data_b, 0, data_b.length); @@ -86,7 +86,7 @@ public final class TestComment2000Atom extends TestCase { // B is at 0x0A, 0x0E assertEquals(0x0A, cb.getXOffset()); assertEquals(0x0E, cb.getYOffset()); - } + } public void testWrite() throws Exception { Comment2000Atom ca = new Comment2000Atom(data_a, 0, data_a.length); @@ -101,15 +101,15 @@ public final class TestComment2000Atom extends TestCase { } // Create A from scratch - public void testCreate() throws Exception { - Comment2000Atom a = new Comment2000Atom(); + public void testCreate() throws Exception { + Comment2000Atom a = new Comment2000Atom(); - // Set number, x and y - a.setNumber(1); - a.setXOffset(0x92); - a.setYOffset(0x92); + // Set number, x and y + a.setNumber(1); + a.setXOffset(0x92); + a.setYOffset(0x92); - // Set the date + // Set the date Date date_a = sdf.parse("2006-01-24 10:26:15.205"); a.setDate(date_a); @@ -122,7 +122,7 @@ public final class TestComment2000Atom extends TestCase { for(int i=0; i<data_a.length; i++) { assertEquals(data_a[i],b[i]); } - } + } // Try to turn a into b public void testChange() throws Exception { diff --git a/src/scratchpad/testcases/org/apache/poi/hslf/record/TestDocument.java b/src/scratchpad/testcases/org/apache/poi/hslf/record/TestDocument.java index e068e8984b..e61273bb50 100644 --- a/src/scratchpad/testcases/org/apache/poi/hslf/record/TestDocument.java +++ b/src/scratchpad/testcases/org/apache/poi/hslf/record/TestDocument.java @@ -17,7 +17,6 @@ package org.apache.poi.hslf.record; - import junit.framework.TestCase; import java.io.*; @@ -25,8 +24,7 @@ import org.apache.poi.hslf.HSLFSlideShow; import org.apache.poi.poifs.filesystem.*; /** - * Tests that Document works properly - * (Also tests Environment while we're at it) + * Tests that Document works properly (Also tests Environment while we're at it) * * @author Nick Burch (nick at torchbox dot com) */ @@ -36,55 +34,49 @@ public final class TestDocument extends TestCase { // POIFS primed on the test data private POIFSFileSystem pfs; - public TestDocument() throws Exception { + public TestDocument() throws Exception { String dirname = System.getProperty("HSLF.testdata.path"); String filename = dirname + "/basic_test_ppt_file.ppt"; FileInputStream fis = new FileInputStream(filename); pfs = new POIFSFileSystem(fis); ss = new HSLFSlideShow(pfs); - } + } - private Document getDocRecord() { - Record[] r = ss.getRecords(); - for(int i=(r.length-1); i>=0; i--) { - if(r[i] instanceof Document) { - return (Document)r[i]; - } - } - throw new IllegalStateException("No Document record found"); - } + private Document getDocRecord() { + Record[] r = ss.getRecords(); + for (int i = (r.length - 1); i >= 0; i--) { + if (r[i] instanceof Document) { + return (Document) r[i]; + } + } + throw new IllegalStateException("No Document record found"); + } - public void testRecordType() throws Exception { - Document dr = getDocRecord(); - assertEquals(1000, dr.getRecordType()); + public void testRecordType() { + Document dr = getDocRecord(); + assertEquals(1000, dr.getRecordType()); } - public void testChildRecords() throws Exception { - Document dr = getDocRecord(); - assertNotNull(dr.getDocumentAtom()); - assertTrue(dr.getDocumentAtom() instanceof DocumentAtom); + public void testChildRecords() { + Document dr = getDocRecord(); + assertNotNull(dr.getDocumentAtom()); - assertNotNull(dr.getEnvironment()); - assertTrue(dr.getEnvironment() instanceof Environment); + assertNotNull(dr.getEnvironment()); - assertNotNull(dr.getSlideListWithTexts()); - assertEquals(3, dr.getSlideListWithTexts().length); - assertNotNull(dr.getSlideListWithTexts()[0]); - assertTrue(dr.getSlideListWithTexts()[0] instanceof SlideListWithText); - assertNotNull(dr.getSlideListWithTexts()[1]); - assertTrue(dr.getSlideListWithTexts()[1] instanceof SlideListWithText); - assertNotNull(dr.getSlideListWithTexts()[2]); - assertTrue(dr.getSlideListWithTexts()[2] instanceof SlideListWithText); - } + assertNotNull(dr.getSlideListWithTexts()); + assertEquals(3, dr.getSlideListWithTexts().length); + assertNotNull(dr.getSlideListWithTexts()[0]); + assertNotNull(dr.getSlideListWithTexts()[1]); + assertNotNull(dr.getSlideListWithTexts()[2]); + } - public void testEnvironment() throws Exception { - Document dr = getDocRecord(); - Environment env = dr.getEnvironment(); + public void testEnvironment() { + Document dr = getDocRecord(); + Environment env = dr.getEnvironment(); - assertEquals(1010, env.getRecordType()); - assertNotNull(env.getFontCollection()); - assertTrue(env.getFontCollection() instanceof FontCollection); - } + assertEquals(1010, env.getRecordType()); + assertNotNull(env.getFontCollection()); + } - // No need to check re-writing - hslf.TestReWrite does all that for us + // No need to check re-writing - hslf.TestReWrite does all that for us } diff --git a/src/scratchpad/testcases/org/apache/poi/hslf/record/TestDocumentAtom.java b/src/scratchpad/testcases/org/apache/poi/hslf/record/TestDocumentAtom.java index 9b28d431ad..890c0a73b7 100644 --- a/src/scratchpad/testcases/org/apache/poi/hslf/record/TestDocumentAtom.java +++ b/src/scratchpad/testcases/org/apache/poi/hslf/record/TestDocumentAtom.java @@ -34,11 +34,11 @@ public final class TestDocumentAtom extends TestCase { 0x05, 0, 0, 0, 0x0A, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1 }; - public void testRecordType() throws Exception { + public void testRecordType() { DocumentAtom da = new DocumentAtom(data_a, 0, data_a.length); assertEquals(1001l, da.getRecordType()); } - public void testSizeAndZoom() throws Exception { + public void testSizeAndZoom() { DocumentAtom da = new DocumentAtom(data_a, 0, data_a.length); assertEquals(5760l, da.getSlideSizeX()); assertEquals(4320l, da.getSlideSizeY()); @@ -48,17 +48,17 @@ public final class TestDocumentAtom extends TestCase { assertEquals(5l, da.getServerZoomFrom()); assertEquals(10l, da.getServerZoomTo()); } - public void testMasterPersist() throws Exception { + public void testMasterPersist() { DocumentAtom da = new DocumentAtom(data_a, 0, data_a.length); assertEquals(2l, da.getNotesMasterPersist()); assertEquals(0l, da.getHandoutMasterPersist()); } - public void testSlideDetails() throws Exception { + public void testSlideDetails() { DocumentAtom da = new DocumentAtom(data_a, 0, data_a.length); assertEquals(1, da.getFirstSlideNum()); assertEquals(0, da.getSlideSizeType()); } - public void testBooleans() throws Exception { + public void testBooleans() { DocumentAtom da = new DocumentAtom(data_a, 0, data_a.length); assertEquals(false, da.getSaveWithFonts()); assertEquals(false, da.getOmitTitlePlace()); diff --git a/src/scratchpad/testcases/org/apache/poi/hslf/record/TestExControl.java b/src/scratchpad/testcases/org/apache/poi/hslf/record/TestExControl.java index 9aa03a9887..81a939a4d0 100755 --- a/src/scratchpad/testcases/org/apache/poi/hslf/record/TestExControl.java +++ b/src/scratchpad/testcases/org/apache/poi/hslf/record/TestExControl.java @@ -69,23 +69,23 @@ public final class TestExControl extends TestCase { 0x65, 0x00, 0x63, 0x00, 0x74, 0x00 }; - public void testRead() throws Exception { + public void testRead() { ExControl record = new ExControl(data, 0, data.length); assertEquals(RecordTypes.ExControl.typeID, record.getRecordType()); - assertNotNull(record.getExControlAtom()); - assertEquals(256, record.getExControlAtom().getSlideId()); + assertNotNull(record.getExControlAtom()); + assertEquals(256, record.getExControlAtom().getSlideId()); - ExOleObjAtom oleObj = record.getExOleObjAtom(); - assertNotNull(oleObj); - assertEquals(oleObj.getDrawAspect(), ExOleObjAtom.DRAW_ASPECT_VISIBLE); - assertEquals(oleObj.getType(), ExOleObjAtom.TYPE_CONTROL); - assertEquals(oleObj.getSubType(), ExOleObjAtom.SUBTYPE_DEFAULT); + ExOleObjAtom oleObj = record.getExOleObjAtom(); + assertNotNull(oleObj); + assertEquals(oleObj.getDrawAspect(), ExOleObjAtom.DRAW_ASPECT_VISIBLE); + assertEquals(oleObj.getType(), ExOleObjAtom.TYPE_CONTROL); + assertEquals(oleObj.getSubType(), ExOleObjAtom.SUBTYPE_DEFAULT); - assertEquals("Shockwave Flash Object", record.getMenuName()); - assertEquals("ShockwaveFlash.ShockwaveFlash.9", record.getProgId()); - assertEquals("Shockwave Flash Object", record.getClipboardName()); - } + assertEquals("Shockwave Flash Object", record.getMenuName()); + assertEquals("ShockwaveFlash.ShockwaveFlash.9", record.getProgId()); + assertEquals("Shockwave Flash Object", record.getClipboardName()); + } public void testWrite() throws Exception { ExControl record = new ExControl(data, 0, data.length); @@ -93,32 +93,31 @@ public final class TestExControl extends TestCase { record.writeOut(baos); byte[] b = baos.toByteArray(); - assertTrue(Arrays.equals(data, b)); + assertTrue(Arrays.equals(data, b)); } - public void testNewRecord() throws Exception { - ExControl record = new ExControl(); - ExControlAtom ctrl = record.getExControlAtom(); - ctrl.setSlideId(256); - - ExOleObjAtom oleObj = record.getExOleObjAtom(); - oleObj.setDrawAspect(ExOleObjAtom.DRAW_ASPECT_VISIBLE); - oleObj.setType(ExOleObjAtom.TYPE_CONTROL); - oleObj.setObjID(1); - oleObj.setSubType(ExOleObjAtom.SUBTYPE_DEFAULT); - oleObj.setObjStgDataRef(2); - oleObj.setOptions(1283584); + public void testNewRecord() throws Exception { + ExControl record = new ExControl(); + ExControlAtom ctrl = record.getExControlAtom(); + ctrl.setSlideId(256); - record.setMenuName("Shockwave Flash Object"); - record.setProgId("ShockwaveFlash.ShockwaveFlash.9"); - record.setClipboardName("Shockwave Flash Object"); + ExOleObjAtom oleObj = record.getExOleObjAtom(); + oleObj.setDrawAspect(ExOleObjAtom.DRAW_ASPECT_VISIBLE); + oleObj.setType(ExOleObjAtom.TYPE_CONTROL); + oleObj.setObjID(1); + oleObj.setSubType(ExOleObjAtom.SUBTYPE_DEFAULT); + oleObj.setObjStgDataRef(2); + oleObj.setOptions(1283584); - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - record.writeOut(baos); - byte[] b = baos.toByteArray(); + record.setMenuName("Shockwave Flash Object"); + record.setProgId("ShockwaveFlash.ShockwaveFlash.9"); + record.setClipboardName("Shockwave Flash Object"); - assertEquals(data.length, b.length); - assertTrue(Arrays.equals(data, b)); - } + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + record.writeOut(baos); + byte[] b = baos.toByteArray(); + assertEquals(data.length, b.length); + assertTrue(Arrays.equals(data, b)); + } } diff --git a/src/scratchpad/testcases/org/apache/poi/hslf/record/TestExVideoContainer.java b/src/scratchpad/testcases/org/apache/poi/hslf/record/TestExVideoContainer.java index 3c903f41ee..d566a1f054 100755 --- a/src/scratchpad/testcases/org/apache/poi/hslf/record/TestExVideoContainer.java +++ b/src/scratchpad/testcases/org/apache/poi/hslf/record/TestExVideoContainer.java @@ -48,9 +48,9 @@ public final class TestExVideoContainer extends TestCase { - public void testRead() throws Exception { - ExVideoContainer record = new ExVideoContainer(data, 0, data.length); - assertEquals(RecordTypes.ExVideoContainer.typeID, record.getRecordType()); + public void testRead() { + ExVideoContainer record = new ExVideoContainer(data, 0, data.length); + assertEquals(RecordTypes.ExVideoContainer.typeID, record.getRecordType()); ExMediaAtom exMedia = record.getExMediaAtom(); assertEquals(1, exMedia.getObjectId()); @@ -64,14 +64,14 @@ public final class TestExVideoContainer extends TestCase { assertEquals("D:\\projects\\SchulerAG\\mcom_v_1_0_4\\view\\data\\tests\\images\\cards.mpg", path.getText()); } - public void testWrite() throws Exception { - ExVideoContainer record = new ExVideoContainer(data, 0, data.length); - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - record.writeOut(baos); - byte[] b = baos.toByteArray(); + public void testWrite() throws Exception { + ExVideoContainer record = new ExVideoContainer(data, 0, data.length); + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + record.writeOut(baos); + byte[] b = baos.toByteArray(); - assertTrue(Arrays.equals(data, b)); - } + assertTrue(Arrays.equals(data, b)); + } public void testNewRecord() throws Exception { ExVideoContainer record = new ExVideoContainer(); diff --git a/src/scratchpad/testcases/org/apache/poi/hslf/record/TestFontCollection.java b/src/scratchpad/testcases/org/apache/poi/hslf/record/TestFontCollection.java index 75af7afa0c..d0d47b7d71 100644 --- a/src/scratchpad/testcases/org/apache/poi/hslf/record/TestFontCollection.java +++ b/src/scratchpad/testcases/org/apache/poi/hslf/record/TestFontCollection.java @@ -40,7 +40,7 @@ public final class TestFontCollection extends TestCase { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7C, 0xDA-256, 0x12, 0x00, 0x28, 0xDD-256, 0x0D, 0x30, 0x00, 0x00, 0x04, 0x00 }; - public void testFonts() throws Exception { + public void testFonts() { FontCollection fonts = new FontCollection(data, 0, data.length); Record[] child = fonts.getChildRecords(); assertEquals(child.length, 1); @@ -49,7 +49,7 @@ public final class TestFontCollection extends TestCase { assertEquals(fnt.getFontName(), "Times New Roman"); } - public void testAddFont() throws Exception { + public void testAddFont() { FontCollection fonts = new FontCollection(data, 0, data.length); int idx = fonts.addFont("Times New Roman"); assertEquals(idx, 0); diff --git a/src/scratchpad/testcases/org/apache/poi/hslf/record/TestHeadersFootersAtom.java b/src/scratchpad/testcases/org/apache/poi/hslf/record/TestHeadersFootersAtom.java index 5db87e136d..b391c06ed7 100644 --- a/src/scratchpad/testcases/org/apache/poi/hslf/record/TestHeadersFootersAtom.java +++ b/src/scratchpad/testcases/org/apache/poi/hslf/record/TestHeadersFootersAtom.java @@ -33,7 +33,7 @@ public final class TestHeadersFootersAtom extends TestCase { 0x00, 0x00, (byte)0xDA, 0x0F, 0x04, 0x00, 0x00, 00, 0x00, 0x00, 0x23, 0x00 }; - public void testRead() throws Exception { + public void testRead() { HeadersFootersAtom record = new HeadersFootersAtom(data, 0, data.length); assertEquals(RecordTypes.HeadersFootersAtom.typeID, record.getRecordType()); @@ -70,7 +70,7 @@ public final class TestHeadersFootersAtom extends TestCase { assertTrue(Arrays.equals(data, b)); } - public void testFlags() throws Exception { + public void testFlags() { HeadersFootersAtom record = new HeadersFootersAtom(); //in a new record all the bits are 0 @@ -87,6 +87,5 @@ public final class TestHeadersFootersAtom extends TestCase { record.setFlag(HeadersFootersAtom.fHasTodayDate, false); assertFalse(record.getFlag(HeadersFootersAtom.fHasTodayDate)); - } } diff --git a/src/scratchpad/testcases/org/apache/poi/hslf/record/TestHeadersFootersContainer.java b/src/scratchpad/testcases/org/apache/poi/hslf/record/TestHeadersFootersContainer.java index 921b08929b..5ac5c22b48 100644 --- a/src/scratchpad/testcases/org/apache/poi/hslf/record/TestHeadersFootersContainer.java +++ b/src/scratchpad/testcases/org/apache/poi/hslf/record/TestHeadersFootersContainer.java @@ -50,7 +50,7 @@ public final class TestHeadersFootersContainer extends TestCase { 0x6F, 0x00, 0x6F, 0x00, 0x74, 0x00, 0x65, 0x00, 0x72, 0x00 }; - public void testReadSlideHeadersFootersContainer() throws Exception { + public void testReadSlideHeadersFootersContainer() { HeadersFootersContainer record = new HeadersFootersContainer(slideData, 0, slideData.length); assertEquals(RecordTypes.HeadersFooters.typeID, record.getRecordType()); assertEquals(HeadersFootersContainer.SlideHeadersFootersContainer, record.getOptions()); @@ -103,7 +103,7 @@ public final class TestHeadersFootersContainer extends TestCase { assertTrue(Arrays.equals(slideData, b)); } - public void testReadNotesHeadersFootersContainer() throws Exception { + public void testReadNotesHeadersFootersContainer() { HeadersFootersContainer record = new HeadersFootersContainer(notesData, 0, notesData.length); assertEquals(RecordTypes.HeadersFooters.typeID, record.getRecordType()); assertEquals(HeadersFootersContainer.NotesHeadersFootersContainer, record.getOptions()); diff --git a/src/scratchpad/testcases/org/apache/poi/hslf/record/TestInteractiveInfo.java b/src/scratchpad/testcases/org/apache/poi/hslf/record/TestInteractiveInfo.java index ad48bd1dcd..9ecb03b22c 100644 --- a/src/scratchpad/testcases/org/apache/poi/hslf/record/TestInteractiveInfo.java +++ b/src/scratchpad/testcases/org/apache/poi/hslf/record/TestInteractiveInfo.java @@ -15,7 +15,7 @@ See the License for the specific language governing permissions and limitations under the License. ==================================================================== */ - + package org.apache.poi.hslf.record; @@ -38,19 +38,19 @@ public class TestInteractiveInfo extends TestCase { 00, 00, 00, 00, 01, 00, 00, 00, 04, 00, 00, 00, 8, 00, 00, 00 }; - - public void testRecordType() throws Exception { + + public void testRecordType() { InteractiveInfo ii = new InteractiveInfo(data_a, 0, data_a.length); assertEquals(4082, ii.getRecordType()); } - - public void testGetChildDetails() throws Exception { + + public void testGetChildDetails() { InteractiveInfo ii = new InteractiveInfo(data_a, 0, data_a.length); InteractiveInfoAtom ia = ii.getInteractiveInfoAtom(); - + assertEquals(1, ia.getHyperlinkID()); - } - + } + public void testWrite() throws Exception { InteractiveInfo ii = new InteractiveInfo(data_a, 0, data_a.length); ByteArrayOutputStream baos = new ByteArrayOutputStream(); @@ -64,24 +64,24 @@ public class TestInteractiveInfo extends TestCase { } // Create A from scratch - public void testCreate() throws Exception { - InteractiveInfo ii = new InteractiveInfo(); - InteractiveInfoAtom ia = ii.getInteractiveInfoAtom(); - - // Set values - ia.setHyperlinkID(1); - ia.setSoundRef(0); - ia.setAction((byte)4); - ia.setHyperlinkType((byte)8); - + public void testCreate() throws Exception { + InteractiveInfo ii = new InteractiveInfo(); + InteractiveInfoAtom ia = ii.getInteractiveInfoAtom(); + + // Set values + ia.setHyperlinkID(1); + ia.setSoundRef(0); + ia.setAction((byte)4); + ia.setHyperlinkType((byte)8); + // Check it's now the same as a ByteArrayOutputStream baos = new ByteArrayOutputStream(); ii.writeOut(baos); byte[] b = baos.toByteArray(); - + assertEquals(data_a.length, b.length); for(int i=0; i<data_a.length; i++) { assertEquals(data_a[i],b[i]); } - } + } } diff --git a/src/scratchpad/testcases/org/apache/poi/hslf/record/TestNotesAtom.java b/src/scratchpad/testcases/org/apache/poi/hslf/record/TestNotesAtom.java index 90deb5253e..e12ecd75c5 100644 --- a/src/scratchpad/testcases/org/apache/poi/hslf/record/TestNotesAtom.java +++ b/src/scratchpad/testcases/org/apache/poi/hslf/record/TestNotesAtom.java @@ -31,11 +31,11 @@ public final class TestNotesAtom extends TestCase { private byte[] data_a = new byte[] { 1, 0, 0xF1-256, 3, 8, 0, 0, 0, 0, 0, 0, 0x80-256, 0, 0, 0x0D, 0x30 }; - public void testRecordType() throws Exception { + public void testRecordType() { NotesAtom na = new NotesAtom(data_a, 0, data_a.length); assertEquals(1009l, na.getRecordType()); } - public void testFlags() throws Exception { + public void testFlags() { NotesAtom na = new NotesAtom(data_a, 0, data_a.length); assertEquals(0x80000000, na.getSlideID()); assertEquals(false, na.getFollowMasterObjects()); diff --git a/src/scratchpad/testcases/org/apache/poi/hslf/record/TestRecordTypes.java b/src/scratchpad/testcases/org/apache/poi/hslf/record/TestRecordTypes.java index 464cac41dd..45522dfd81 100644 --- a/src/scratchpad/testcases/org/apache/poi/hslf/record/TestRecordTypes.java +++ b/src/scratchpad/testcases/org/apache/poi/hslf/record/TestRecordTypes.java @@ -26,19 +26,19 @@ import junit.framework.TestCase; * @author Nick Burch (nick at torchbox dot com) */ public final class TestRecordTypes extends TestCase { - public void testPPTNameLookups() throws Exception { + public void testPPTNameLookups() { assertEquals("MainMaster", RecordTypes.recordName(1016)); assertEquals("TextBytesAtom", RecordTypes.recordName(4008)); assertEquals("VBAInfo", RecordTypes.recordName(1023)); } - public void testEscherNameLookups() throws Exception { + public void testEscherNameLookups() { assertEquals("EscherDggContainer", RecordTypes.recordName(0xf000)); assertEquals("EscherClientTextbox", RecordTypes.recordName(0xf00d)); assertEquals("EscherSelection", RecordTypes.recordName(0xf119)); } - public void testPPTClassLookups() throws Exception { + public void testPPTClassLookups() { assertEquals(Slide.class, RecordTypes.recordHandlingClass(1006)); assertEquals(TextCharsAtom.class, RecordTypes.recordHandlingClass(4000)); assertEquals(TextBytesAtom.class, RecordTypes.recordHandlingClass(4008)); @@ -49,7 +49,7 @@ public final class TestRecordTypes extends TestCase { assertEquals(UnknownRecordPlaceholder.class, RecordTypes.recordHandlingClass(2019)); } - public void testEscherClassLookups() throws Exception { + public void testEscherClassLookups() { // Should all come back with null, as DDF handles them assertEquals(null, RecordTypes.recordHandlingClass(0xf000)); assertEquals(null, RecordTypes.recordHandlingClass(0xf001)); diff --git a/src/scratchpad/testcases/org/apache/poi/hslf/record/TestSlideAtom.java b/src/scratchpad/testcases/org/apache/poi/hslf/record/TestSlideAtom.java index d9840d22d3..28b122abae 100644 --- a/src/scratchpad/testcases/org/apache/poi/hslf/record/TestSlideAtom.java +++ b/src/scratchpad/testcases/org/apache/poi/hslf/record/TestSlideAtom.java @@ -33,11 +33,11 @@ public final class TestSlideAtom extends TestCase { 0, 0, 0, 0, 0x0F, 0x10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x80-256, 0, 1, 0, 0, 7, 0, 0x0C, 0x30 }; - public void testRecordType() throws Exception { + public void testRecordType() { SlideAtom sa = new SlideAtom(data_a, 0, data_a.length); assertEquals(1007l, sa.getRecordType()); } - public void testFlags() throws Exception { + public void testFlags() { SlideAtom sa = new SlideAtom(data_a, 0, data_a.length); // First 12 bytes are a SSlideLayoutAtom, checked elsewhere @@ -51,7 +51,7 @@ public final class TestSlideAtom extends TestCase { assertEquals(true, sa.getFollowMasterScheme()); assertEquals(true, sa.getFollowMasterBackground()); } - public void testSSlideLayoutAtom() throws Exception { + public void testSSlideLayoutAtom() { SlideAtom sa = new SlideAtom(data_a, 0, data_a.length); SSlideLayoutAtom ssla = sa.getSSlideLayoutAtom(); diff --git a/src/scratchpad/testcases/org/apache/poi/hslf/record/TestSlidePersistAtom.java b/src/scratchpad/testcases/org/apache/poi/hslf/record/TestSlidePersistAtom.java index aad4aec623..25aa8a5350 100644 --- a/src/scratchpad/testcases/org/apache/poi/hslf/record/TestSlidePersistAtom.java +++ b/src/scratchpad/testcases/org/apache/poi/hslf/record/TestSlidePersistAtom.java @@ -32,11 +32,11 @@ public final class TestSlidePersistAtom extends TestCase { 4, 0, 0, 0, 4, 0, 0, 0, 2, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0 }; - public void testRecordType() throws Exception { + public void testRecordType() { SlidePersistAtom spa = new SlidePersistAtom(data_a, 0, data_a.length); assertEquals(1011l, spa.getRecordType()); } - public void testFlags() throws Exception { + public void testFlags() { SlidePersistAtom spa = new SlidePersistAtom(data_a, 0, data_a.length); assertEquals(4, spa.getRefID() ); assertEquals(true, spa.getHasShapesOtherThanPlaceholders() ); diff --git a/src/scratchpad/testcases/org/apache/poi/hslf/record/TestStyleTextPropAtom.java b/src/scratchpad/testcases/org/apache/poi/hslf/record/TestStyleTextPropAtom.java index 2a48923194..a95186c306 100644 --- a/src/scratchpad/testcases/org/apache/poi/hslf/record/TestStyleTextPropAtom.java +++ b/src/scratchpad/testcases/org/apache/poi/hslf/record/TestStyleTextPropAtom.java @@ -36,7 +36,7 @@ import org.apache.poi.util.HexDump; */ public final class TestStyleTextPropAtom extends TestCase { /** From a real file: a paragraph with 4 different styles */ - private byte[] data_a = new byte[] { + private static final byte[] data_a = new byte[] { 0, 0, 0xA1-256, 0x0F, 0x2A, 0, 0, 0, 0x36, 00, 00, 00, // paragraph is 54 long 00, 00, // (paragraph reserved field) @@ -50,7 +50,7 @@ public final class TestStyleTextPropAtom extends TestCase { 00, 00, 0x04, 00, // font.color only 0xFF-256, 0x33, 00, 0xFE-256 // red }; - private int data_a_text_len = 0x36-1; + private static final int data_a_text_len = 0x36-1; /** * From a real file: 4 paragraphs with text in 4 different styles: @@ -60,7 +60,7 @@ public final class TestStyleTextPropAtom extends TestCase { * left aligned+underlined+larger font size (96) * left aligned+underlined+larger font size+red (1) */ - private byte[] data_b = new byte[] { + private static final byte[] data_b = new byte[] { 0, 0, 0xA1-256, 0x0F, 0x80-256, 0, 0, 0, 0x1E, 00, 00, 00, // paragraph is 30 long 00, 00, // paragraph reserved field @@ -108,14 +108,14 @@ public final class TestStyleTextPropAtom extends TestCase { 0x18, 00, // font size 24 0xFF-256, 0x33, 00, 0xFE-256 // colour red }; - private int data_b_text_len = 0xB3; + private static final int data_b_text_len = 0xB3; /** * From a real file. Has a mask with more bits * set than it actually has data for. Shouldn't do, * but some real files do :( */ - private byte[] data_c = new byte[] { + private static final byte[] data_c = new byte[] { 0, 0, -95, 15, 62, 0, 0, 0, 123, 0, 0, 0, 0, 0, 48, 8, 10, 0, 1, 0, 0, 0, 0, 0, @@ -131,15 +131,15 @@ public final class TestStyleTextPropAtom extends TestCase { /** * From a real file supplied for Bug 40143 by tales@great.ufc.br */ - private byte[] data_d = { + private static final byte[] data_d = { 0x00, 0x00, 0xA1-256, 0x0F, 0x1E, 0x00, 0x00, 0x00, //header (byte)0xA0, 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x08 , 0x00 , 0x00 , 0x01 , 0x00, (byte)0xA0 , 0x00 , 0x00 , 0x00 , 0x01 , 0x00 , 0x63 , 0x00 , 0x01 , 0x00, 0x01 , 0x00 , 0x00, 0x00 , 0x01 , 0x00 , 0x14 , 0x00 }; - private int data_d_text_len = 0xA0-1; + private static final int data_d_text_len = 0xA0-1; - public void testRecordType() throws Exception { + public void testRecordType() { StyleTextPropAtom stpa = new StyleTextPropAtom(data_a,0,data_a.length); StyleTextPropAtom stpb = new StyleTextPropAtom(data_b,0,data_b.length); StyleTextPropAtom stpc = new StyleTextPropAtom(data_c,0,data_c.length); @@ -149,7 +149,7 @@ public final class TestStyleTextPropAtom extends TestCase { } - public void testCharacterStyleCounts() throws Exception { + public void testCharacterStyleCounts() { StyleTextPropAtom stpa = new StyleTextPropAtom(data_a,0,data_a.length); StyleTextPropAtom stpb = new StyleTextPropAtom(data_b,0,data_b.length); @@ -223,7 +223,6 @@ public final class TestStyleTextPropAtom extends TestCase { TextProp tp_1_1 = (TextProp)b_ch_1.getTextPropList().get(0); TextProp tp_1_2 = (TextProp)b_ch_1.getTextPropList().get(1); assertEquals(true, tp_1_1 instanceof CharFlagsTextProp); - assertEquals(true, tp_1_2 instanceof TextProp); assertEquals("font.size", tp_1_2.getName()); assertEquals(20, tp_1_2.getValue()); @@ -233,8 +232,6 @@ public final class TestStyleTextPropAtom extends TestCase { TextProp tp_2_2 = (TextProp)b_ch_2.getTextPropList().get(1); TextProp tp_2_3 = (TextProp)b_ch_2.getTextPropList().get(2); assertEquals(true, tp_2_1 instanceof CharFlagsTextProp); - assertEquals(true, tp_2_2 instanceof TextProp); - assertEquals(true, tp_2_3 instanceof TextProp); assertEquals("font.size", tp_2_2.getName()); assertEquals("font.color", tp_2_3.getName()); assertEquals(20, tp_2_2.getValue()); @@ -243,8 +240,6 @@ public final class TestStyleTextPropAtom extends TestCase { assertEquals(2,b_ch_3.getTextPropList().size()); TextProp tp_3_1 = (TextProp)b_ch_3.getTextPropList().get(0); TextProp tp_3_2 = (TextProp)b_ch_3.getTextPropList().get(1); - assertEquals(true, tp_3_1 instanceof TextProp); - assertEquals(true, tp_3_2 instanceof TextProp); assertEquals("font.size", tp_3_1.getName()); assertEquals("font.color", tp_3_2.getName()); assertEquals(20, tp_3_1.getValue()); @@ -255,8 +250,6 @@ public final class TestStyleTextPropAtom extends TestCase { TextProp tp_4_2 = (TextProp)b_ch_4.getTextPropList().get(1); TextProp tp_4_3 = (TextProp)b_ch_4.getTextPropList().get(2); assertEquals(true, tp_4_1 instanceof CharFlagsTextProp); - assertEquals(true, tp_4_2 instanceof TextProp); - assertEquals(true, tp_4_3 instanceof TextProp); assertEquals("font.index", tp_4_2.getName()); assertEquals("font.size", tp_4_3.getName()); assertEquals(24, tp_4_3.getValue()); @@ -276,8 +269,6 @@ public final class TestStyleTextPropAtom extends TestCase { assertEquals(2,b_p_1.getTextPropList().size()); TextProp tp_1_1 = (TextProp)b_p_1.getTextPropList().get(0); TextProp tp_1_2 = (TextProp)b_p_1.getTextPropList().get(1); - assertEquals(true, tp_1_1 instanceof TextProp); - assertEquals(true, tp_1_2 instanceof TextProp); assertEquals("alignment", tp_1_1.getName()); assertEquals("linespacing", tp_1_2.getName()); assertEquals(0, tp_1_1.getValue()); @@ -286,8 +277,6 @@ public final class TestStyleTextPropAtom extends TestCase { // 2nd is centre aligned (default) + normal line spacing assertEquals(1,b_p_2.getTextPropList().size()); TextProp tp_2_1 = (TextProp)b_p_2.getTextPropList().get(0); - assertEquals(true, tp_2_1 instanceof TextProp); - assertEquals(true, tp_1_2 instanceof TextProp); assertEquals("linespacing", tp_2_1.getName()); assertEquals(80, tp_2_1.getValue()); @@ -295,8 +284,6 @@ public final class TestStyleTextPropAtom extends TestCase { assertEquals(2,b_p_3.getTextPropList().size()); TextProp tp_3_1 = (TextProp)b_p_3.getTextPropList().get(0); TextProp tp_3_2 = (TextProp)b_p_3.getTextPropList().get(1); - assertEquals(true, tp_3_1 instanceof TextProp); - assertEquals(true, tp_3_2 instanceof TextProp); assertEquals("alignment", tp_3_1.getName()); assertEquals("linespacing", tp_3_2.getName()); assertEquals(2, tp_3_1.getValue()); @@ -306,8 +293,6 @@ public final class TestStyleTextPropAtom extends TestCase { assertEquals(2,b_p_4.getTextPropList().size()); TextProp tp_4_1 = (TextProp)b_p_4.getTextPropList().get(0); TextProp tp_4_2 = (TextProp)b_p_4.getTextPropList().get(1); - assertEquals(true, tp_4_1 instanceof TextProp); - assertEquals(true, tp_4_2 instanceof TextProp); assertEquals("alignment", tp_4_1.getName()); assertEquals("linespacing", tp_4_2.getName()); assertEquals(0, tp_4_1.getValue()); diff --git a/src/scratchpad/testcases/org/apache/poi/hslf/record/TestTextBytesAtom.java b/src/scratchpad/testcases/org/apache/poi/hslf/record/TestTextBytesAtom.java index 1df2ad0c51..85d5b7a552 100644 --- a/src/scratchpad/testcases/org/apache/poi/hslf/record/TestTextBytesAtom.java +++ b/src/scratchpad/testcases/org/apache/poi/hslf/record/TestTextBytesAtom.java @@ -38,16 +38,16 @@ public final class TestTextBytesAtom extends TestCase { 0x74, 0x65, 0x73, 0x74, 0x20, 0x74, 0x69, 0x74, 0x6C, 0x65 }; private String alt_text = "This is a test title"; - public void testRecordType() throws Exception { + public void testRecordType() { TextBytesAtom tba = new TextBytesAtom(data,0,data.length); assertEquals(4008l, tba.getRecordType()); } - public void testTextA() throws Exception { + public void testTextA() { TextBytesAtom tba = new TextBytesAtom(data,0,data.length); assertEquals(data_text, tba.getText()); } - public void testTextB() throws Exception { + public void testTextB() { TextBytesAtom tba = new TextBytesAtom(alt_data,0,alt_data.length); assertEquals(alt_text, tba.getText()); } diff --git a/src/scratchpad/testcases/org/apache/poi/hslf/record/TestTextCharsAtom.java b/src/scratchpad/testcases/org/apache/poi/hslf/record/TestTextCharsAtom.java index 2f29dfd3c7..b37a234ba5 100644 --- a/src/scratchpad/testcases/org/apache/poi/hslf/record/TestTextCharsAtom.java +++ b/src/scratchpad/testcases/org/apache/poi/hslf/record/TestTextCharsAtom.java @@ -35,16 +35,16 @@ public final class TestTextCharsAtom extends TestCase { 0x54, 0x00, 0x68, 0x00, 0x69, 0x00, 0x73, 0x00, 0xa3-256, 0x01 }; private String alt_text = "This\u01A3"; - public void testRecordType() throws Exception { + public void testRecordType() { TextCharsAtom tca = new TextCharsAtom(data,0,data.length); assertEquals(4000l, tca.getRecordType()); } - public void testTextA() throws Exception { + public void testTextA() { TextCharsAtom tca = new TextCharsAtom(data,0,data.length); assertEquals(data_text, tca.getText()); } - public void testTextB() throws Exception { + public void testTextB() { TextCharsAtom tca = new TextCharsAtom(alt_data,0,alt_data.length); assertEquals(alt_text, tca.getText()); } diff --git a/src/scratchpad/testcases/org/apache/poi/hslf/record/TestTextHeaderAtom.java b/src/scratchpad/testcases/org/apache/poi/hslf/record/TestTextHeaderAtom.java index 22947132d4..b2c819439f 100644 --- a/src/scratchpad/testcases/org/apache/poi/hslf/record/TestTextHeaderAtom.java +++ b/src/scratchpad/testcases/org/apache/poi/hslf/record/TestTextHeaderAtom.java @@ -32,11 +32,11 @@ public final class TestTextHeaderAtom extends TestCase { private byte[] title_data = new byte[] { 0, 0, 0x9f-256, 0x0f, 4, 0, 0, 0, 0, 0, 0, 0 }; private byte[] body_data = new byte[] { 0, 0, 0x9f-256, 0x0f, 4, 0, 0, 0, 1, 0, 0, 0 }; - public void testRecordType() throws Exception { + public void testRecordType() { TextHeaderAtom tha = new TextHeaderAtom(notes_data,0,12); assertEquals(3999l, tha.getRecordType()); } - public void testTypes() throws Exception { + public void testTypes() { TextHeaderAtom n_tha = new TextHeaderAtom(notes_data,0,12); TextHeaderAtom t_tha = new TextHeaderAtom(title_data,0,12); TextHeaderAtom b_tha = new TextHeaderAtom(body_data,0,12); diff --git a/src/scratchpad/testcases/org/apache/poi/hslf/record/TestUserEditAtom.java b/src/scratchpad/testcases/org/apache/poi/hslf/record/TestUserEditAtom.java index b82e29b5c4..3607dd4e3a 100644 --- a/src/scratchpad/testcases/org/apache/poi/hslf/record/TestUserEditAtom.java +++ b/src/scratchpad/testcases/org/apache/poi/hslf/record/TestUserEditAtom.java @@ -33,11 +33,11 @@ public final class TestUserEditAtom extends TestCase { 00, 00, 00, 00, 00, 0x18, 00, 00, 01, 00, 00, 00, 05, 00, 00, 00, 01, 00, 0xF6-256, 77 }; - public void testRecordType() throws Exception { + public void testRecordType() { UserEditAtom uea = new UserEditAtom(data_a, 0, data_a.length); assertEquals(4085l, uea.getRecordType()); } - public void testFlags() throws Exception { + public void testFlags() { UserEditAtom uea = new UserEditAtom(data_a, 0, data_a.length); assertEquals(256, uea.getLastViewedSlideID() ); diff --git a/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestCounts.java b/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestCounts.java index 5b43a6ad50..4863c41a54 100644 --- a/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestCounts.java +++ b/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestCounts.java @@ -31,16 +31,16 @@ public final class TestCounts extends TestCase { // SlideShow primed on the test data private SlideShow ss; - public TestCounts() throws Exception { + public TestCounts() throws Exception { String dirname = System.getProperty("HSLF.testdata.path"); String filename = dirname + "/basic_test_ppt_file.ppt"; HSLFSlideShow hss = new HSLFSlideShow(filename); ss = new SlideShow(hss); - } + } - public void testSheetsCount() throws Exception { + public void testSheetsCount() { Slide[] slides = ss.getSlides(); - // Two sheets - master sheet is seperate + // Two sheets - master sheet is separate assertEquals(2, slides.length); // They are slides 1+2 @@ -56,7 +56,7 @@ public final class TestCounts extends TestCase { assertEquals(257, slides[1]._getSheetNumber()); } - public void testNotesCount() throws Exception { + public void testNotesCount() { Notes[] notes = ss.getNotes(); // Two sheets -> two notes // Note: there are also notes on the slide master diff --git a/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestMostRecentRecords.java b/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestMostRecentRecords.java index 78c2935727..fac33c5e07 100644 --- a/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestMostRecentRecords.java +++ b/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestMostRecentRecords.java @@ -33,14 +33,14 @@ public final class TestMostRecentRecords extends TestCase { // SlideShow primed on the test data private SlideShow ss; - public TestMostRecentRecords() throws Exception { + public TestMostRecentRecords() throws Exception { String dirname = System.getProperty("HSLF.testdata.path"); String filename = dirname + "/basic_test_ppt_file.ppt"; hss = new HSLFSlideShow(filename); ss = new SlideShow(hss); - } + } - public void testCount() throws Exception { + public void testCount() { // Most recent core records Record[] mrcr = ss.getMostRecentCoreRecords(); @@ -48,7 +48,7 @@ public final class TestMostRecentRecords extends TestCase { assertEquals(7, mrcr.length); } - public void testRightRecordTypes() throws Exception { + public void testRightRecordTypes() { // Most recent core records Record[] mrcr = ss.getMostRecentCoreRecords(); @@ -69,7 +69,7 @@ public final class TestMostRecentRecords extends TestCase { assertEquals(1008, mrcr[6].getRecordType()); } - public void testCorrectRecords() throws Exception { + public void testCorrectRecords() { // Most recent core records Record[] mrcr = ss.getMostRecentCoreRecords(); diff --git a/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestNotesText.java b/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestNotesText.java index 56638e2e98..e024c910d2 100644 --- a/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestNotesText.java +++ b/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestNotesText.java @@ -31,14 +31,14 @@ public final class TestNotesText extends TestCase { // SlideShow primed on the test data private SlideShow ss; - public TestNotesText() throws Exception { + public TestNotesText() throws Exception { String dirname = System.getProperty("HSLF.testdata.path"); String filename = dirname + "/basic_test_ppt_file.ppt"; HSLFSlideShow hss = new HSLFSlideShow(filename); ss = new SlideShow(hss); - } + } - public void testNotesOne() throws Exception { + public void testNotesOne() { Notes notes = ss.getNotes()[0]; String[] expectText = new String[] {"These are the notes for page 1"}; @@ -46,9 +46,9 @@ public final class TestNotesText extends TestCase { for(int i=0; i<expectText.length; i++) { assertEquals(expectText[i], notes.getTextRuns()[i].getText()); } - } + } - public void testNotesTwo() throws Exception { + public void testNotesTwo() { Notes notes = ss.getNotes()[1]; String[] expectText = new String[] {"These are the notes on page two, again lacking formatting"}; assertEquals(expectText.length, notes.getTextRuns().length); diff --git a/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestPictures.java b/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestPictures.java index 24189ad2c8..bcd7616d56 100644 --- a/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestPictures.java +++ b/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestPictures.java @@ -34,7 +34,7 @@ public final class TestPictures extends TestCase{ protected File cwd; - public void setUp() throws Exception { + public void setUp() { cwd = new File(System.getProperty("HSLF.testdata.path")); } diff --git a/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestRecordSetup.java b/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestRecordSetup.java index da04a33d10..72e6bd488e 100644 --- a/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestRecordSetup.java +++ b/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestRecordSetup.java @@ -36,30 +36,30 @@ public final class TestRecordSetup extends TestCase { private SlideShow ss; private HSLFSlideShow hss; - public TestRecordSetup() throws Exception { + public TestRecordSetup() throws Exception { String dirname = System.getProperty("HSLF.testdata.path"); String filename = dirname + "/basic_test_ppt_file.ppt"; hss = new HSLFSlideShow(filename); ss = new SlideShow(hss); - } + } - public void testHandleParentAwareRecords() throws Exception { - Record[] records = hss.getRecords(); - for(int i=0; i<records.length; i++) { - ensureParentAware(records[i],null); - } + public void testHandleParentAwareRecords() { + Record[] records = hss.getRecords(); + for(int i=0; i<records.length; i++) { + ensureParentAware(records[i],null); + } + } + private void ensureParentAware(Record r,RecordContainer parent) { + if(r instanceof ParentAwareRecord) { + ParentAwareRecord pr = (ParentAwareRecord)r; + assertEquals(parent, pr.getParentRecord()); + } + if(r instanceof RecordContainer) { + RecordContainer rc = (RecordContainer)r; + Record[] children = rc.getChildRecords(); + for(int i=0; i<children.length; i++) { + ensureParentAware(children[i], rc); + } + } } - private void ensureParentAware(Record r,RecordContainer parent) { - if(r instanceof ParentAwareRecord) { - ParentAwareRecord pr = (ParentAwareRecord)r; - assertEquals(parent, pr.getParentRecord()); - } - if(r instanceof RecordContainer) { - RecordContainer rc = (RecordContainer)r; - Record[] children = rc.getChildRecords(); - for(int i=0; i<children.length; i++) { - ensureParentAware(children[i], rc); - } - } - } } diff --git a/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestSheetText.java b/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestSheetText.java index 9c10f8b036..bb78de0bcc 100644 --- a/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestSheetText.java +++ b/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestSheetText.java @@ -31,14 +31,14 @@ public final class TestSheetText extends TestCase { // SlideShow primed on the test data private SlideShow ss; - public TestSheetText() throws Exception { + public TestSheetText() throws Exception { String dirname = System.getProperty("HSLF.testdata.path"); String filename = dirname + "/basic_test_ppt_file.ppt"; HSLFSlideShow hss = new HSLFSlideShow(filename); ss = new SlideShow(hss); - } + } - public void testSheetOne() throws Exception { + public void testSheetOne() { Sheet slideOne = ss.getSlides()[0]; String[] expectText = new String[] {"This is a test title","This is a test subtitle\nThis is on page 1"}; @@ -46,9 +46,9 @@ public final class TestSheetText extends TestCase { for(int i=0; i<expectText.length; i++) { assertEquals(expectText[i], slideOne.getTextRuns()[i].getText()); } - } + } - public void testSheetTwo() throws Exception { + public void testSheetTwo() { Sheet slideTwo = ss.getSlides()[1]; String[] expectText = new String[] {"This is the title on page 2","This is page two\nIt has several blocks of text\nNone of them have formatting"}; assertEquals(expectText.length, slideTwo.getTextRuns().length); @@ -80,7 +80,7 @@ public final class TestSheetText extends TestCase { "Can they co-exist?\n\n" + "Gay Harley\n" + "Clean Development Alliance\n" + - "COP 11 \u2013 MOP 1\n" + // special long hyphon + "COP 11 \u2013 MOP 1\n" + // special long hyphen "December 5, 2005\n"; assertEquals(1, s.getTextRuns().length); diff --git a/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestSlideOrdering.java b/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestSlideOrdering.java index 7eab827f1c..2cc111afbd 100644 --- a/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestSlideOrdering.java +++ b/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestSlideOrdering.java @@ -17,7 +17,6 @@ package org.apache.poi.hslf.usermodel; - import junit.framework.TestCase; import org.apache.poi.hslf.*; import org.apache.poi.hslf.model.*; @@ -33,7 +32,7 @@ public final class TestSlideOrdering extends TestCase { // Complex slideshow, record order doesn't match slide order private SlideShow ssB; - public TestSlideOrdering() throws Exception { + public TestSlideOrdering() throws Exception { String dirname = System.getProperty("HSLF.testdata.path"); String filenameA = dirname + "/basic_test_ppt_file.ppt"; @@ -43,112 +42,93 @@ public final class TestSlideOrdering extends TestCase { String filenameB = dirname + "/incorrect_slide_order.ppt"; HSLFSlideShow hssB = new HSLFSlideShow(filenameB); ssB = new SlideShow(hssB); - } - - /** - * Test the simple case - record order matches slide order - */ - public void testSimpleCase() throws Exception { - assertEquals(2, ssA.getSlides().length); - - Slide s1 = ssA.getSlides()[0]; - Slide s2 = ssA.getSlides()[1]; - - String[] firstTRs = new String[] { - "This is a test title", - "This is the title on page 2" - }; - - assertEquals(firstTRs[0], s1.getTextRuns()[0].getText()); - assertEquals(firstTRs[1], s2.getTextRuns()[0].getText()); - } - - /** - * Test the complex case - record order differs from slide order - */ - public void testComplexCase() throws Exception { - assertEquals(3, ssB.getSlides().length); - - Slide s1 = ssB.getSlides()[0]; - Slide s2 = ssB.getSlides()[1]; - Slide s3 = ssB.getSlides()[2]; - - String[] firstTRs = new String[] { - "Slide 1", - "Slide 2", - "Slide 3" - }; - - assertEquals(firstTRs[0], s1.getTextRuns()[0].getText()); - assertEquals(firstTRs[1], s2.getTextRuns()[0].getText()); - assertEquals(firstTRs[2], s3.getTextRuns()[0].getText()); - } - - /** - * Assert that the order of slides is correct. - * - * @param filename file name of the slide show to assert - * @param titles array of reference slide titles - */ - protected void assertSlideOrdering(String filename, String[] titles) throws Exception { - SlideShow ppt = new SlideShow(new HSLFSlideShow(filename)); - Slide[] slide = ppt.getSlides(); - - assertEquals(titles.length, slide.length); - for (int i = 0; i < slide.length; i++) { - String title = slide[i].getTitle(); - assertEquals("Wrong slide title in " + filename, titles[i], title); - } - } - - public void testTitles() throws Exception{ - String dirname = System.getProperty("HSLF.testdata.path"); - - assertSlideOrdering(dirname + "/basic_test_ppt_file.ppt", - new String[]{ - "This is a test title", - "This is the title on page 2" - }); - - assertSlideOrdering(dirname + "/incorrect_slide_order.ppt", - new String[]{ - "Slide 1", - "Slide 2", - "Slide 3" - }); - - assertSlideOrdering(dirname + "/next_test_ppt_file.ppt", - new String[]{ - "This is a test title", - "This is the title on page 2" - }); - - assertSlideOrdering(dirname + "/Single_Coloured_Page.ppt", - new String[]{ - "This is a title, it" + (char)0x2019 +"s in black" - }); - - assertSlideOrdering(dirname + "/Single_Coloured_Page_With_Fonts_and_Alignments.ppt", - new String[]{ - "This is a title, it"+ (char)0x2019 +"s in black" - }); - - assertSlideOrdering(dirname + "/ParagraphStylesShorterThanCharStyles.ppt", - new String[]{ - "ROMANCE: AN ANALYSIS", - "AGENDA", - "You are an important supplier of various items that I need", - '\n' + "Although The Psycho set back my relationship process, recovery is luckily enough under way", - "Since the time that we seriously go out together, you rank highly among existing relationships", - "Although our personal interests are mostly compatible, the greatest gap exists in Sex and Shopping", - "Your physical characteristics are strong when compared with your competition", - "The combination of your high physical appearance and personality rank you highly, although your sister is also a top prospect", - "When people found out that we were going out, their responses have been mixed", - "The benchmark of relationship lifecycles, suggests that we are on schedule", - "In summary we can say that we are on the right track, but we must remain aware of possible roadblocks ", - "THE ANSWER", - "Unfortunately a huge disconnect exists between my needs and your existing service", - "SUMMARY", - }); - } + } + + /** + * Test the simple case - record order matches slide order + */ + public void testSimpleCase() { + assertEquals(2, ssA.getSlides().length); + + Slide s1 = ssA.getSlides()[0]; + Slide s2 = ssA.getSlides()[1]; + + String[] firstTRs = new String[] { "This is a test title", "This is the title on page 2" }; + + assertEquals(firstTRs[0], s1.getTextRuns()[0].getText()); + assertEquals(firstTRs[1], s2.getTextRuns()[0].getText()); + } + + /** + * Test the complex case - record order differs from slide order + */ + public void testComplexCase() { + assertEquals(3, ssB.getSlides().length); + + Slide s1 = ssB.getSlides()[0]; + Slide s2 = ssB.getSlides()[1]; + Slide s3 = ssB.getSlides()[2]; + + String[] firstTRs = new String[] { "Slide 1", "Slide 2", "Slide 3" }; + + assertEquals(firstTRs[0], s1.getTextRuns()[0].getText()); + assertEquals(firstTRs[1], s2.getTextRuns()[0].getText()); + assertEquals(firstTRs[2], s3.getTextRuns()[0].getText()); + } + + /** + * Assert that the order of slides is correct. + * + * @param filename + * file name of the slide show to assert + * @param titles + * array of reference slide titles + */ + protected void assertSlideOrdering(String filename, String[] titles) throws Exception { + SlideShow ppt = new SlideShow(new HSLFSlideShow(filename)); + Slide[] slide = ppt.getSlides(); + + assertEquals(titles.length, slide.length); + for (int i = 0; i < slide.length; i++) { + String title = slide[i].getTitle(); + assertEquals("Wrong slide title in " + filename, titles[i], title); + } + } + + public void testTitles() throws Exception { + String dirname = System.getProperty("HSLF.testdata.path"); + + assertSlideOrdering(dirname + "/basic_test_ppt_file.ppt", new String[] { + "This is a test title", "This is the title on page 2" }); + + assertSlideOrdering(dirname + "/incorrect_slide_order.ppt", new String[] { "Slide 1", + "Slide 2", "Slide 3" }); + + assertSlideOrdering(dirname + "/next_test_ppt_file.ppt", new String[] { + "This is a test title", "This is the title on page 2" }); + + assertSlideOrdering(dirname + "/Single_Coloured_Page.ppt", + new String[] { "This is a title, it" + (char) 0x2019 + "s in black" }); + + assertSlideOrdering(dirname + "/Single_Coloured_Page_With_Fonts_and_Alignments.ppt", + new String[] { "This is a title, it" + (char) 0x2019 + "s in black" }); + + assertSlideOrdering( + dirname + "/ParagraphStylesShorterThanCharStyles.ppt", + new String[] { + "ROMANCE: AN ANALYSIS", + "AGENDA", + "You are an important supplier of various items that I need", + '\n' + "Although The Psycho set back my relationship process, recovery is luckily enough under way", + "Since the time that we seriously go out together, you rank highly among existing relationships", + "Although our personal interests are mostly compatible, the greatest gap exists in Sex and Shopping", + "Your physical characteristics are strong when compared with your competition", + "The combination of your high physical appearance and personality rank you highly, although your sister is also a top prospect", + "When people found out that we were going out, their responses have been mixed", + "The benchmark of relationship lifecycles, suggests that we are on schedule", + "In summary we can say that we are on the right track, but we must remain aware of possible roadblocks ", + "THE ANSWER", + "Unfortunately a huge disconnect exists between my needs and your existing service", + "SUMMARY", }); + } } diff --git a/src/scratchpad/testcases/org/apache/poi/hsmf/model/TestBlankFileRead.java b/src/scratchpad/testcases/org/apache/poi/hsmf/model/TestBlankFileRead.java index 5cb99cbf83..73c3a03e70 100644 --- a/src/scratchpad/testcases/org/apache/poi/hsmf/model/TestBlankFileRead.java +++ b/src/scratchpad/testcases/org/apache/poi/hsmf/model/TestBlankFileRead.java @@ -27,107 +27,96 @@ import junit.framework.TestCase; /** * Tests to verify that the library can read blank msg files. - * + * * @author Travis Ferguson * */ -public class TestBlankFileRead extends TestCase { +public final class TestBlankFileRead extends TestCase { private MAPIMessage mapiMessage; - + /** * Initialize this test, load up the blank.msg mapi message. - * @throws IOException */ public TestBlankFileRead() throws IOException { String dirname = System.getProperty("HSMF.testdata.path"); this.mapiMessage = new MAPIMessage(dirname + "/blank.msg"); } - - /** + + /** * Check if we can read the body of the blank message, we expect "". - * - * @throws Exception */ public void testReadBody() throws Exception { try { - mapiMessage.getTextBody(); + mapiMessage.getTextBody(); } catch(ChunkNotFoundException exp) { return; } - + TestCase.fail("Should have thrown a ChunkNotFoundException but didn't"); } - + /** * Test to see if we can read the CC Chunk. - * @throws ChunkNotFoundException - * */ public void testReadDisplayCC() throws ChunkNotFoundException { String obtained = mapiMessage.getDisplayCC(); String expected = ""; - + TestCase.assertEquals(expected, obtained); } - + /** * Test to see if we can read the CC Chunk. - * @throws ChunkNotFoundException - * */ public void testReadDisplayTo() throws ChunkNotFoundException { String obtained = mapiMessage.getDisplayTo(); String expected = ""; - + TestCase.assertEquals(expected, obtained); } - + /** * Test to see if we can read the FROM Chunk. - * @throws ChunkNotFoundException - * */ - public void testReadDisplayFrom() throws ChunkNotFoundException { + public void testReadDisplayFrom() { try { - mapiMessage.getDisplayFrom(); + mapiMessage.getDisplayFrom(); } catch(ChunkNotFoundException exp) { return; } - + TestCase.fail("Should have thrown a ChunkNotFoundException but didn't"); } - + /** * Test to see if we can read the CC Chunk. - * @throws ChunkNotFoundException - * */ public void testReadDisplayBCC() throws ChunkNotFoundException { String obtained = mapiMessage.getDisplayBCC(); String expected = ""; - + TestCase.assertEquals(expected, obtained); } - - + + /** * Check if we can read the subject line of the blank message, we expect "" - * + * * @throws Exception */ public void testReadSubject() throws Exception { String obtained = mapiMessage.getSubject(); TestCase.assertEquals("", obtained); } - - + + /** * Check if we can read the subject line of the blank message, we expect "" - * + * * @throws Exception */ - public void testReadConversationTopic() throws Exception { + public void testReadConversationTopic() { try { mapiMessage.getConversationTopic(); } catch(ChunkNotFoundException exp) { @@ -135,6 +124,6 @@ public class TestBlankFileRead extends TestCase { } TestCase.fail("We shouldn't have a ConversationTopic node on the blank.msg file."); } - - + + } diff --git a/src/scratchpad/testcases/org/apache/poi/hwpf/TestHWPFPictures.java b/src/scratchpad/testcases/org/apache/poi/hwpf/TestHWPFPictures.java index 1adb68b809..0819d58fa5 100644 --- a/src/scratchpad/testcases/org/apache/poi/hwpf/TestHWPFPictures.java +++ b/src/scratchpad/testcases/org/apache/poi/hwpf/TestHWPFPictures.java @@ -19,13 +19,14 @@ package org.apache.poi.hwpf; import java.io.ByteArrayOutputStream; import java.io.FileInputStream; +import java.io.IOException; import java.util.List; +import junit.framework.TestCase; + import org.apache.poi.hwpf.model.PicturesTable; import org.apache.poi.hwpf.usermodel.Picture; -import junit.framework.TestCase; - /** * Test picture support in HWPF * @author nick @@ -34,25 +35,25 @@ public final class TestHWPFPictures extends TestCase { private String docAFile; private String docBFile; private String docCFile; - private String docDFile; + private String docDFile; private String imgAFile; private String imgBFile; private String imgCFile; - private String imgDFile; + private String imgDFile; - protected void setUp() throws Exception { + protected void setUp() { String dirname = System.getProperty("HWPF.testdata.path"); docAFile = dirname + "/testPictures.doc"; docBFile = dirname + "/two_images.doc"; docCFile = dirname + "/vector_image.doc"; - docDFile = dirname + "/GaiaTest.doc"; + docDFile = dirname + "/GaiaTest.doc"; imgAFile = dirname + "/simple_image.jpg"; imgBFile = dirname + "/simple_image.png"; imgCFile = dirname + "/vector_image.emf"; - imgDFile = dirname + "/GaiaTestImg.png"; + imgDFile = dirname + "/GaiaTestImg.png"; } /** @@ -134,21 +135,20 @@ public final class TestHWPFPictures extends TestCase { * Pending the missing files being uploaded to * bug #44937 */ - public void BROKENtestEscherDrawing() throws Exception - { - HWPFDocument docD = new HWPFDocument(new FileInputStream(docDFile)); - List allPictures = docD.getPicturesTable().getAllPictures(); + public void BROKENtestEscherDrawing() throws Exception { + HWPFDocument docD = new HWPFDocument(new FileInputStream(docDFile)); + List allPictures = docD.getPicturesTable().getAllPictures(); - assertEquals(1, allPictures.size()); + assertEquals(1, allPictures.size()); - Picture pic = (Picture) allPictures.get(0); - assertNotNull(pic); - byte[] picD = readFile(imgDFile); + Picture pic = (Picture) allPictures.get(0); + assertNotNull(pic); + byte[] picD = readFile(imgDFile); - assertEquals(picD.length, pic.getContent().length); + assertEquals(picD.length, pic.getContent().length); - assertBytesSame(picD, pic.getContent()); - } + assertBytesSame(picD, pic.getContent()); + } private void assertBytesSame(byte[] a, byte[] b) { assertEquals(a.length, b.length); @@ -157,17 +157,22 @@ public final class TestHWPFPictures extends TestCase { } } - private byte[] readFile(String file) throws Exception { + private static byte[] readFile(String file) { ByteArrayOutputStream baos = new ByteArrayOutputStream(); - FileInputStream fis = new FileInputStream(file); - byte[] buffer = new byte[1024]; - - int read = 0; - while(read > -1) { - read = fis.read(buffer); - if(read > 0) { - baos.write(buffer,0,read); + try { + FileInputStream fis = new FileInputStream(file); + byte[] buffer = new byte[1024]; + + int read = 0; + while(read > -1) { + read = fis.read(buffer); + if(read > 0) { + baos.write(buffer,0,read); + } } + fis.close(); + } catch (IOException e) { + throw new RuntimeException(e); } return baos.toByteArray(); diff --git a/src/scratchpad/testcases/org/apache/poi/hwpf/TestHWPFRangeParts.java b/src/scratchpad/testcases/org/apache/poi/hwpf/TestHWPFRangeParts.java index 283cae027f..bda9465301 100644 --- a/src/scratchpad/testcases/org/apache/poi/hwpf/TestHWPFRangeParts.java +++ b/src/scratchpad/testcases/org/apache/poi/hwpf/TestHWPFRangeParts.java @@ -65,12 +65,12 @@ public final class TestHWPFRangeParts extends TestCase { "The trick with this one is that it contains some Unicode based strings in it.\r" + "Firstly, some currency symbols:\r" + "\tGBP - \u00a3\r" + - "\tEUR - \u20ac\r" + - "Now, we\u2019ll have some French text, in bold and big:\r" + - "\tMoli\u00e8re\r" + - "And some normal French text:\r" + - "\tL'Avare ou l'\u00c9cole du mensonge\r" + - "That\u2019s it for page one\r" + "\tEUR - \u20ac\r" + + "Now, we\u2019ll have some French text, in bold and big:\r" + + "\tMoli\u00e8re\r" + + "And some normal French text:\r" + + "\tL'Avare ou l'\u00c9cole du mensonge\r" + + "That\u2019s it for page one\r" ; private static final String u_page_2 = "This is page two. Les Pr\u00e9cieuses ridicules. The end.\r" @@ -109,7 +109,7 @@ public final class TestHWPFRangeParts extends TestCase { ); } - public void testBasics() throws Exception { + public void testBasics() { // First check the start and end bits assertEquals( 0, @@ -142,7 +142,7 @@ public final class TestHWPFRangeParts extends TestCase { ); } - public void testContents() throws Exception { + public void testContents() { Range r; // Now check the real ranges @@ -179,7 +179,7 @@ public final class TestHWPFRangeParts extends TestCase { ); } - public void testBasicsUnicode() throws Exception { + public void testBasicsUnicode() { // First check the start and end bits assertEquals( 0, @@ -213,7 +213,7 @@ public final class TestHWPFRangeParts extends TestCase { ); } - public void testContentsUnicode() throws Exception { + public void testContentsUnicode() { Range r; // Now check the real ranges diff --git a/src/scratchpad/testcases/org/apache/poi/hwpf/extractor/TestWordExtractor.java b/src/scratchpad/testcases/org/apache/poi/hwpf/extractor/TestWordExtractor.java index 261c9e6b66..a945540a0a 100644 --- a/src/scratchpad/testcases/org/apache/poi/hwpf/extractor/TestWordExtractor.java +++ b/src/scratchpad/testcases/org/apache/poi/hwpf/extractor/TestWordExtractor.java @@ -111,7 +111,7 @@ public final class TestWordExtractor extends TestCase { /** * Test textPieces based extraction */ - public void testExtractFromTextPieces() throws Exception { + public void testExtractFromTextPieces() { String text = extractor.getTextFromPieces(); assertEquals(p_text1_block, text); } diff --git a/src/scratchpad/testcases/org/apache/poi/hwpf/extractor/TestWordExtractorBugs.java b/src/scratchpad/testcases/org/apache/poi/hwpf/extractor/TestWordExtractorBugs.java index 585c534ed9..6cae52ccd3 100644 --- a/src/scratchpad/testcases/org/apache/poi/hwpf/extractor/TestWordExtractorBugs.java +++ b/src/scratchpad/testcases/org/apache/poi/hwpf/extractor/TestWordExtractorBugs.java @@ -28,11 +28,11 @@ import junit.framework.TestCase; */ public final class TestWordExtractorBugs extends TestCase { private String dirname; - protected void setUp() throws Exception { + protected void setUp() { dirname = System.getProperty("HWPF.testdata.path"); - } + } - public void testProblemMetadata() throws Exception { + public void testProblemMetadata() throws Exception { String filename = dirname + "/ProblemExtracting.doc"; WordExtractor extractor = new WordExtractor(new FileInputStream(filename)); @@ -41,6 +41,5 @@ public final class TestWordExtractorBugs extends TestCase { extractor.getText(); extractor.getParagraphText(); extractor.getTextFromPieces(); - } - + } } diff --git a/src/scratchpad/testcases/org/apache/poi/hwpf/usermodel/TestBug46610.java b/src/scratchpad/testcases/org/apache/poi/hwpf/usermodel/TestBug46610.java index f750a59a6d..779847e27e 100755 --- a/src/scratchpad/testcases/org/apache/poi/hwpf/usermodel/TestBug46610.java +++ b/src/scratchpad/testcases/org/apache/poi/hwpf/usermodel/TestBug46610.java @@ -29,7 +29,7 @@ import org.apache.poi.hwpf.HWPFDocument; public class TestBug46610 extends TestCase { private String dirname; - protected void setUp() throws Exception { + protected void setUp() { dirname = System.getProperty("HWPF.testdata.path"); } diff --git a/src/scratchpad/testcases/org/apache/poi/hwpf/usermodel/TestHeaderStories.java b/src/scratchpad/testcases/org/apache/poi/hwpf/usermodel/TestHeaderStories.java index 1a48ab6b60..13913eab04 100644 --- a/src/scratchpad/testcases/org/apache/poi/hwpf/usermodel/TestHeaderStories.java +++ b/src/scratchpad/testcases/org/apache/poi/hwpf/usermodel/TestHeaderStories.java @@ -25,8 +25,7 @@ import junit.framework.TestCase; import org.apache.poi.hwpf.HWPFDocument; /** - * Tests for the handling of header stories into - * headers, footers etc + * Tests for the handling of header stories into headers, footers etc */ public final class TestHeaderStories extends TestCase { private HWPFDocument none; @@ -38,71 +37,60 @@ public final class TestHeaderStories extends TestCase { private HWPFDocument unicode; private HWPFDocument withFields; - protected void setUp() throws Exception { + protected void setUp() throws Exception { String dirname = System.getProperty("HWPF.testdata.path"); - none = new HWPFDocument( - new FileInputStream(new File(dirname, "NoHeadFoot.doc")) - ); - header = new HWPFDocument( - new FileInputStream(new File(dirname, "ThreeColHead.doc")) - ); - footer = new HWPFDocument( - new FileInputStream(new File(dirname, "ThreeColFoot.doc")) - ); - headerFooter = new HWPFDocument( - new FileInputStream(new File(dirname, "SimpleHeadThreeColFoot.doc")) - ); - oddEven = new HWPFDocument( - new FileInputStream(new File(dirname, "PageSpecificHeadFoot.doc")) - ); - diffFirst = new HWPFDocument( - new FileInputStream(new File(dirname, "DiffFirstPageHeadFoot.doc")) - ); + none = new HWPFDocument(new FileInputStream(new File(dirname, "NoHeadFoot.doc"))); + header = new HWPFDocument(new FileInputStream(new File(dirname, "ThreeColHead.doc"))); + footer = new HWPFDocument(new FileInputStream(new File(dirname, "ThreeColFoot.doc"))); + headerFooter = new HWPFDocument(new FileInputStream(new File(dirname, + "SimpleHeadThreeColFoot.doc"))); + oddEven = new HWPFDocument(new FileInputStream( + new File(dirname, "PageSpecificHeadFoot.doc"))); + diffFirst = new HWPFDocument(new FileInputStream(new File(dirname, + "DiffFirstPageHeadFoot.doc"))); unicode = new HWPFDocument( - new FileInputStream(new File(dirname, "HeaderFooterUnicode.doc")) - ); + new FileInputStream(new File(dirname, "HeaderFooterUnicode.doc"))); withFields = new HWPFDocument( - new FileInputStream(new File(dirname, "HeaderWithMacros.doc")) - ); - } + new FileInputStream(new File(dirname, "HeaderWithMacros.doc"))); + } - public void testNone() throws Exception { - HeaderStories hs = new HeaderStories(none); + public void testNone() { + HeaderStories hs = new HeaderStories(none); - assertNull(hs.getPlcfHdd()); - assertEquals(0, hs.getRange().text().length()); - } + assertNull(hs.getPlcfHdd()); + assertEquals(0, hs.getRange().text().length()); + } - public void testHeader() throws Exception { - HeaderStories hs = new HeaderStories(header); + public void testHeader() { + HeaderStories hs = new HeaderStories(header); - assertEquals(60, hs.getRange().text().length()); + assertEquals(60, hs.getRange().text().length()); - // Should have the usual 6 separaters - // Then all 6 of the different header/footer kinds - // Finally a terminater - assertEquals(13, hs.getPlcfHdd().length()); + // Should have the usual 6 separaters + // Then all 6 of the different header/footer kinds + // Finally a terminater + assertEquals(13, hs.getPlcfHdd().length()); - assertEquals(215, hs.getRange().getStartOffset()); + assertEquals(215, hs.getRange().getStartOffset()); - assertEquals(0, hs.getPlcfHdd().getProperty(0).getStart()); - assertEquals(3, hs.getPlcfHdd().getProperty(1).getStart()); - assertEquals(6, hs.getPlcfHdd().getProperty(2).getStart()); - assertEquals(6, hs.getPlcfHdd().getProperty(3).getStart()); - assertEquals(9, hs.getPlcfHdd().getProperty(4).getStart()); - assertEquals(12, hs.getPlcfHdd().getProperty(5).getStart()); + assertEquals(0, hs.getPlcfHdd().getProperty(0).getStart()); + assertEquals(3, hs.getPlcfHdd().getProperty(1).getStart()); + assertEquals(6, hs.getPlcfHdd().getProperty(2).getStart()); + assertEquals(6, hs.getPlcfHdd().getProperty(3).getStart()); + assertEquals(9, hs.getPlcfHdd().getProperty(4).getStart()); + assertEquals(12, hs.getPlcfHdd().getProperty(5).getStart()); - assertEquals(12, hs.getPlcfHdd().getProperty(6).getStart()); - assertEquals(12, hs.getPlcfHdd().getProperty(7).getStart()); - assertEquals(59, hs.getPlcfHdd().getProperty(8).getStart()); - assertEquals(59, hs.getPlcfHdd().getProperty(9).getStart()); - assertEquals(59, hs.getPlcfHdd().getProperty(10).getStart()); - assertEquals(59, hs.getPlcfHdd().getProperty(11).getStart()); + assertEquals(12, hs.getPlcfHdd().getProperty(6).getStart()); + assertEquals(12, hs.getPlcfHdd().getProperty(7).getStart()); + assertEquals(59, hs.getPlcfHdd().getProperty(8).getStart()); + assertEquals(59, hs.getPlcfHdd().getProperty(9).getStart()); + assertEquals(59, hs.getPlcfHdd().getProperty(10).getStart()); + assertEquals(59, hs.getPlcfHdd().getProperty(11).getStart()); - assertEquals(59, hs.getPlcfHdd().getProperty(12).getStart()); + assertEquals(59, hs.getPlcfHdd().getProperty(12).getStart()); - assertEquals("\u0003\r\r", hs.getFootnoteSeparator()); + assertEquals("\u0003\r\r", hs.getFootnoteSeparator()); assertEquals("\u0004\r\r", hs.getFootnoteContSeparator()); assertEquals("", hs.getFootnoteContNote()); assertEquals("\u0003\r\r", hs.getEndnoteSeparator()); @@ -113,63 +101,65 @@ public final class TestHeaderStories extends TestCase { assertEquals("", hs.getEvenHeader()); assertEquals("First header column!\tMid header Right header!\r\r", hs.getOddHeader()); - assertEquals("", hs.getFirstFooter()); assertEquals("", hs.getEvenFooter()); assertEquals("", hs.getOddFooter()); - } + } - public void testFooter() throws Exception { - HeaderStories hs = new HeaderStories(footer); + public void testFooter() { + HeaderStories hs = new HeaderStories(footer); assertEquals("", hs.getFirstHeader()); assertEquals("", hs.getEvenHeader()); assertEquals("", hs.getOddHeader()); // Was \r\r but gets emptied - assertEquals("", hs.getFirstFooter()); assertEquals("", hs.getEvenFooter()); assertEquals("Footer Left\tFooter Middle Footer Right\r\r", hs.getOddFooter()); - } + } - public void testHeaderFooter() throws Exception { - HeaderStories hs = new HeaderStories(headerFooter); + public void testHeaderFooter() { + HeaderStories hs = new HeaderStories(headerFooter); assertEquals("", hs.getFirstHeader()); assertEquals("", hs.getEvenHeader()); assertEquals("I am some simple header text here\r\r\r", hs.getOddHeader()); - assertEquals("", hs.getFirstFooter()); assertEquals("", hs.getEvenFooter()); assertEquals("Footer Left\tFooter Middle Footer Right\r\r", hs.getOddFooter()); - } + } - public void testOddEven() throws Exception { - HeaderStories hs = new HeaderStories(oddEven); + public void testOddEven() { + HeaderStories hs = new HeaderStories(oddEven); assertEquals("", hs.getFirstHeader()); - assertEquals("[This is an Even Page, with a Header]\u0007August 20, 2008\u0007\u0007\r\r", hs.getEvenHeader()); - assertEquals("August 20, 2008\u0007[ODD Page Header text]\u0007\u0007\r\r", hs.getOddHeader()); - + assertEquals("[This is an Even Page, with a Header]\u0007August 20, 2008\u0007\u0007\r\r", + hs.getEvenHeader()); + assertEquals("August 20, 2008\u0007[ODD Page Header text]\u0007\u0007\r\r", hs + .getOddHeader()); assertEquals("", hs.getFirstFooter()); - assertEquals("\u0007Page \u0013 PAGE \\* MERGEFORMAT \u00142\u0015\u0007\u0007\u0007\u0007\u0007\u0007\u0007This is a simple footer on the second page\r\r", hs.getEvenFooter()); + assertEquals( + "\u0007Page \u0013 PAGE \\* MERGEFORMAT \u00142\u0015\u0007\u0007\u0007\u0007\u0007\u0007\u0007This is a simple footer on the second page\r\r", + hs.getEvenFooter()); assertEquals("Footer Left\tFooter Middle Footer Right\r\r", hs.getOddFooter()); assertEquals("Footer Left\tFooter Middle Footer Right\r\r", hs.getFooter(1)); - assertEquals("\u0007Page \u0013 PAGE \\* MERGEFORMAT \u00142\u0015\u0007\u0007\u0007\u0007\u0007\u0007\u0007This is a simple footer on the second page\r\r", hs.getFooter(2)); + assertEquals( + "\u0007Page \u0013 PAGE \\* MERGEFORMAT \u00142\u0015\u0007\u0007\u0007\u0007\u0007\u0007\u0007This is a simple footer on the second page\r\r", + hs.getFooter(2)); assertEquals("Footer Left\tFooter Middle Footer Right\r\r", hs.getFooter(3)); - } + } - public void testFirst() throws Exception { - HeaderStories hs = new HeaderStories(diffFirst); + public void testFirst() { + HeaderStories hs = new HeaderStories(diffFirst); - assertEquals("I am the header on the first page, and I\u2019m nice and simple\r\r", hs.getFirstHeader()); + assertEquals("I am the header on the first page, and I\u2019m nice and simple\r\r", hs + .getFirstHeader()); assertEquals("", hs.getEvenHeader()); assertEquals("First header column!\tMid header Right header!\r\r", hs.getOddHeader()); - assertEquals("The footer of the first page\r\r", hs.getFirstFooter()); assertEquals("", hs.getEvenFooter()); assertEquals("Footer Left\tFooter Middle Footer Right\r\r", hs.getOddFooter()); @@ -177,29 +167,31 @@ public final class TestHeaderStories extends TestCase { assertEquals("The footer of the first page\r\r", hs.getFooter(1)); assertEquals("Footer Left\tFooter Middle Footer Right\r\r", hs.getFooter(2)); assertEquals("Footer Left\tFooter Middle Footer Right\r\r", hs.getFooter(3)); - } + } - public void testUnicode() throws Exception { - HeaderStories hs = new HeaderStories(unicode); + public void testUnicode() { + HeaderStories hs = new HeaderStories(unicode); assertEquals("", hs.getFirstHeader()); assertEquals("", hs.getEvenHeader()); - assertEquals("This is a simple header, with a \u20ac euro symbol in it.\r\r\r", hs.getOddHeader()); - + assertEquals("This is a simple header, with a \u20ac euro symbol in it.\r\r\r", hs + .getOddHeader()); assertEquals("", hs.getFirstFooter()); assertEquals("", hs.getEvenFooter()); assertEquals("The footer, with Moli\u00e8re, has Unicode in it.\r\r", hs.getOddFooter()); - } + } - public void testWithFields() throws Exception { - HeaderStories hs = new HeaderStories(withFields); - assertFalse(hs.areFieldsStripped()); + public void testWithFields() { + HeaderStories hs = new HeaderStories(withFields); + assertFalse(hs.areFieldsStripped()); - assertEquals("HEADER GOES HERE. 8/12/2008 \u0013 AUTHOR \\* MERGEFORMAT \u0014Eric Roch\u0015\r\r\r", hs.getOddHeader()); + assertEquals( + "HEADER GOES HERE. 8/12/2008 \u0013 AUTHOR \\* MERGEFORMAT \u0014Eric Roch\u0015\r\r\r", + hs.getOddHeader()); - // Now turn on stripping - hs.setAreFieldsStripped(true); - assertEquals("HEADER GOES HERE. 8/12/2008 Eric Roch\r\r\r", hs.getOddHeader()); - } + // Now turn on stripping + hs.setAreFieldsStripped(true); + assertEquals("HEADER GOES HERE. 8/12/2008 Eric Roch\r\r\r", hs.getOddHeader()); + } } diff --git a/src/scratchpad/testcases/org/apache/poi/hwpf/usermodel/TestRange.java b/src/scratchpad/testcases/org/apache/poi/hwpf/usermodel/TestRange.java index 7fc362e3b7..0ae09c8f4c 100644 --- a/src/scratchpad/testcases/org/apache/poi/hwpf/usermodel/TestRange.java +++ b/src/scratchpad/testcases/org/apache/poi/hwpf/usermodel/TestRange.java @@ -24,7 +24,7 @@ import junit.framework.TestCase; * text replacement or textual contents */ public final class TestRange extends TestCase { - public void testFieldStripping() throws Exception { + public void testFieldStripping() { String exp = "This is some text."; String single = "This is some \u0013Blah!\u0015text."; diff --git a/src/scratchpad/testcases/org/apache/poi/hwpf/usermodel/TestRangeDelete.java b/src/scratchpad/testcases/org/apache/poi/hwpf/usermodel/TestRangeDelete.java index 6468e3e370..5e08588a29 100644 --- a/src/scratchpad/testcases/org/apache/poi/hwpf/usermodel/TestRangeDelete.java +++ b/src/scratchpad/testcases/org/apache/poi/hwpf/usermodel/TestRangeDelete.java @@ -47,7 +47,7 @@ public final class TestRangeDelete extends TestCase { private String illustrativeDocFile; - protected void setUp() throws Exception { + protected void setUp() { String dirname = System.getProperty("HWPF.testdata.path"); diff --git a/src/scratchpad/testcases/org/apache/poi/hwpf/usermodel/TestRangeInsertion.java b/src/scratchpad/testcases/org/apache/poi/hwpf/usermodel/TestRangeInsertion.java index 76452622f7..cdae245ece 100644 --- a/src/scratchpad/testcases/org/apache/poi/hwpf/usermodel/TestRangeInsertion.java +++ b/src/scratchpad/testcases/org/apache/poi/hwpf/usermodel/TestRangeInsertion.java @@ -39,7 +39,7 @@ public final class TestRangeInsertion extends TestCase { private String illustrativeDocFile; - protected void setUp() throws Exception { + protected void setUp() { String dirname = System.getProperty("HWPF.testdata.path"); diff --git a/src/scratchpad/testcases/org/apache/poi/hwpf/usermodel/TestRangeProperties.java b/src/scratchpad/testcases/org/apache/poi/hwpf/usermodel/TestRangeProperties.java index 05e3d2ca24..96f1493bdf 100644 --- a/src/scratchpad/testcases/org/apache/poi/hwpf/usermodel/TestRangeProperties.java +++ b/src/scratchpad/testcases/org/apache/poi/hwpf/usermodel/TestRangeProperties.java @@ -79,7 +79,7 @@ public final class TestRangeProperties extends TestCase { } - public void testAsciiTextParagraphs() throws Exception { + public void testAsciiTextParagraphs() { Range r = a.getRange(); assertEquals( a_page_1 + @@ -138,7 +138,7 @@ public final class TestRangeProperties extends TestCase { ); } - public void testAsciiStyling() throws Exception { + public void testAsciiStyling() { Range r = a.getRange(); Paragraph p1 = r.getParagraph(0); @@ -160,7 +160,7 @@ public final class TestRangeProperties extends TestCase { * Tests the raw definitions of the paragraphs of * a unicode document */ - public void testUnicodeParagraphDefinitions() throws Exception { + public void testUnicodeParagraphDefinitions() { Range r = u.getRange(); String[] p1_parts = u_page_1.split("\r"); String[] p2_parts = u_page_2.split("\r"); @@ -251,7 +251,7 @@ public final class TestRangeProperties extends TestCase { /** * Tests the paragraph text of a unicode document */ - public void testUnicodeTextParagraphs() throws Exception { + public void testUnicodeTextParagraphs() { Range r = u.getRange(); assertEquals( u_page_1 + @@ -281,7 +281,7 @@ public final class TestRangeProperties extends TestCase { assertEquals(page_break + "\r", r.getParagraph(10).text()); assertEquals(p2_parts[0] + "\r", r.getParagraph(11).text()); } - public void testUnicodeStyling() throws Exception { + public void testUnicodeStyling() { Range r = u.getRange(); String[] p1_parts = u_page_1.split("\r"); diff --git a/src/scratchpad/testcases/org/apache/poi/hwpf/usermodel/TestRangeReplacement.java b/src/scratchpad/testcases/org/apache/poi/hwpf/usermodel/TestRangeReplacement.java index 794979d0fa..dc32b24a3d 100644 --- a/src/scratchpad/testcases/org/apache/poi/hwpf/usermodel/TestRangeReplacement.java +++ b/src/scratchpad/testcases/org/apache/poi/hwpf/usermodel/TestRangeReplacement.java @@ -42,7 +42,7 @@ public final class TestRangeReplacement extends TestCase { private String illustrativeDocFile; - protected void setUp() throws Exception { + protected void setUp() { String dirname = System.getProperty("HWPF.testdata.path"); |