From 5cb5ab6807e8f1d5e0e1427fe8af6add70e7e13d Mon Sep 17 00:00:00 2001 From: Nick Burch Date: Wed, 29 Apr 2015 20:13:42 +0000 Subject: [PATCH] Fix inconsistent indents git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1676845 13f79535-47bb-0310-9956-ffa450edef68 --- .../apache/poi/ss/TestWorkbookFactory.java | 206 +++++++++--------- 1 file changed, 103 insertions(+), 103 deletions(-) diff --git a/src/ooxml/testcases/org/apache/poi/ss/TestWorkbookFactory.java b/src/ooxml/testcases/org/apache/poi/ss/TestWorkbookFactory.java index 1c7e4b7a87..068a70910b 100644 --- a/src/ooxml/testcases/org/apache/poi/ss/TestWorkbookFactory.java +++ b/src/ooxml/testcases/org/apache/poi/ss/TestWorkbookFactory.java @@ -31,117 +31,117 @@ import org.apache.poi.openxml4j.opc.OPCPackage; import junit.framework.TestCase; public final class TestWorkbookFactory extends TestCase { - private String xls; - private String xlsx; + private String xls; + private String xlsx; private String[] xls_prot; private String[] xlsx_prot; - private String txt; - - protected void setUp() { - xls = "SampleSS.xls"; - xlsx = "SampleSS.xlsx"; - xls_prot = new String[] {"password.xls", "password"}; - xlsx_prot = new String[]{"protected_passtika.xlsx", "tika"}; - txt = "SampleSS.txt"; - } - - public void testCreateNative() throws Exception { - Workbook wb; - - // POIFS -> hssf - wb = WorkbookFactory.create( - new POIFSFileSystem(HSSFTestDataSamples.openSampleFileStream(xls)) - ); - assertNotNull(wb); - assertTrue(wb instanceof HSSFWorkbook); - wb.close(); - - // Package -> xssf - wb = WorkbookFactory.create( - OPCPackage.open( + private String txt; + + protected void setUp() { + xls = "SampleSS.xls"; + xlsx = "SampleSS.xlsx"; + xls_prot = new String[] {"password.xls", "password"}; + xlsx_prot = new String[]{"protected_passtika.xlsx", "tika"}; + txt = "SampleSS.txt"; + } + + public void testCreateNative() throws Exception { + Workbook wb; + + // POIFS -> hssf + wb = WorkbookFactory.create( + new POIFSFileSystem(HSSFTestDataSamples.openSampleFileStream(xls)) + ); + assertNotNull(wb); + assertTrue(wb instanceof HSSFWorkbook); + wb.close(); + + // Package -> xssf + wb = WorkbookFactory.create( + OPCPackage.open( HSSFTestDataSamples.openSampleFileStream(xlsx)) - ); - assertNotNull(wb); - assertTrue(wb instanceof XSSFWorkbook); - // TODO: this re-writes the sample-file?! wb.close(); - } - - /** - * Creates the appropriate kind of Workbook, but - * checking the mime magic at the start of the - * InputStream, then creating what's required. - */ - public void testCreateGeneric() throws Exception { - Workbook wb; - - // InputStream -> either - wb = WorkbookFactory.create( - HSSFTestDataSamples.openSampleFileStream(xls) - ); - assertNotNull(wb); - assertTrue(wb instanceof HSSFWorkbook); - wb.close(); - - wb = WorkbookFactory.create( - HSSFTestDataSamples.openSampleFileStream(xlsx) - ); - assertNotNull(wb); - assertTrue(wb instanceof XSSFWorkbook); - // TODO: this re-writes the sample-file?! wb.close(); - - // File -> either - wb = WorkbookFactory.create( - HSSFTestDataSamples.getSampleFile(xls) - ); - assertNotNull(wb); - assertTrue(wb instanceof HSSFWorkbook); - wb.close(); - - wb = WorkbookFactory.create( - HSSFTestDataSamples.getSampleFile(xlsx) - ); - assertNotNull(wb); - assertTrue(wb instanceof XSSFWorkbook); - - // TODO: close() re-writes the sample-file?! Resort to revert() for now to close file handle... - ((XSSFWorkbook)wb).getPackage().revert(); - - // Invalid type -> exception - try { - InputStream stream = HSSFTestDataSamples.openSampleFileStream(txt); - try { + ); + assertNotNull(wb); + assertTrue(wb instanceof XSSFWorkbook); + // TODO: this re-writes the sample-file?! wb.close(); + } + + /** + * Creates the appropriate kind of Workbook, but + * checking the mime magic at the start of the + * InputStream, then creating what's required. + */ + public void testCreateGeneric() throws Exception { + Workbook wb; + + // InputStream -> either + wb = WorkbookFactory.create( + HSSFTestDataSamples.openSampleFileStream(xls) + ); + assertNotNull(wb); + assertTrue(wb instanceof HSSFWorkbook); + wb.close(); + + wb = WorkbookFactory.create( + HSSFTestDataSamples.openSampleFileStream(xlsx) + ); + assertNotNull(wb); + assertTrue(wb instanceof XSSFWorkbook); + // TODO: this re-writes the sample-file?! wb.close(); + + // File -> either + wb = WorkbookFactory.create( + HSSFTestDataSamples.getSampleFile(xls) + ); + assertNotNull(wb); + assertTrue(wb instanceof HSSFWorkbook); + wb.close(); + + wb = WorkbookFactory.create( + HSSFTestDataSamples.getSampleFile(xlsx) + ); + assertNotNull(wb); + assertTrue(wb instanceof XSSFWorkbook); + + // TODO: close() re-writes the sample-file?! Resort to revert() for now to close file handle... + ((XSSFWorkbook)wb).getPackage().revert(); + + // Invalid type -> exception + try { + InputStream stream = HSSFTestDataSamples.openSampleFileStream(txt); + try { wb = WorkbookFactory.create(stream); - } finally { - stream.close(); - } - fail(); - } catch(IllegalArgumentException e) { - // Good - } - } - - /** - * Check that the overloaded stream methods which take passwords work properly - */ - public void testCreateWithPasswordFromStream() throws Exception { + } finally { + stream.close(); + } + fail(); + } catch(IllegalArgumentException e) { + // Good + } + } + + /** + * Check that the overloaded stream methods which take passwords work properly + */ + public void testCreateWithPasswordFromStream() throws Exception { Workbook wb; - - // Unprotected, no password given, opens normally + + // Unprotected, no password given, opens normally wb = WorkbookFactory.create( HSSFTestDataSamples.openSampleFileStream(xls), null ); assertNotNull(wb); assertTrue(wb instanceof HSSFWorkbook); wb.close(); - + wb = WorkbookFactory.create( HSSFTestDataSamples.openSampleFileStream(xlsx), null ); assertNotNull(wb); assertTrue(wb instanceof XSSFWorkbook); - - + + // Unprotected, wrong password, opens normally wb = WorkbookFactory.create( HSSFTestDataSamples.openSampleFileStream(xls), "wrong" @@ -149,14 +149,14 @@ public final class TestWorkbookFactory extends TestCase { assertNotNull(wb); assertTrue(wb instanceof HSSFWorkbook); wb.close(); - + wb = WorkbookFactory.create( HSSFTestDataSamples.openSampleFileStream(xlsx), "wrong" ); assertNotNull(wb); assertTrue(wb instanceof XSSFWorkbook); - - + + // Protected, correct password, opens fine wb = WorkbookFactory.create( HSSFTestDataSamples.openSampleFileStream(xls_prot[0]), xls_prot[1] @@ -164,14 +164,14 @@ public final class TestWorkbookFactory extends TestCase { assertNotNull(wb); assertTrue(wb instanceof HSSFWorkbook); wb.close(); - + wb = WorkbookFactory.create( HSSFTestDataSamples.openSampleFileStream(xlsx_prot[0]), xlsx_prot[1] ); assertNotNull(wb); assertTrue(wb instanceof XSSFWorkbook); - - + + // Protected, wrong password, throws Exception try { wb = WorkbookFactory.create( @@ -186,14 +186,14 @@ public final class TestWorkbookFactory extends TestCase { ); fail("Shouldn't be able to open with the wrong password"); } catch (EncryptedDocumentException e) {} - } - + } + /** * Check that the overloaded file methods which take passwords work properly */ public void testCreateWithPasswordFromFile() throws Exception { Workbook wb; - + // TODO } } -- 2.39.5