From: Nick Burch Date: Thu, 23 Apr 2015 18:02:38 +0000 (+0000) Subject: Fix inconsistent indents X-Git-Tag: REL_3_12_FINAL~44 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=780654a9ea1d745bfeb4a659d8458feb567c1ee3;p=poi.git Fix inconsistent indents git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1675690 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/src/testcases/org/apache/poi/hssf/eventusermodel/TestHSSFEventFactory.java b/src/testcases/org/apache/poi/hssf/eventusermodel/TestHSSFEventFactory.java index 7970aaacd7..0a111beaa6 100644 --- a/src/testcases/org/apache/poi/hssf/eventusermodel/TestHSSFEventFactory.java +++ b/src/testcases/org/apache/poi/hssf/eventusermodel/TestHSSFEventFactory.java @@ -36,99 +36,99 @@ import org.apache.poi.hssf.record.SelectionRecord; import org.apache.poi.hssf.record.WindowTwoRecord; import org.apache.poi.hssf.record.crypto.Biff8EncryptionKey; import org.apache.poi.poifs.filesystem.POIFSFileSystem; + /** - * + * Testing for {@link HSSFEventFactory} */ public final class TestHSSFEventFactory extends TestCase { - - private static final InputStream openSample(String sampleFileName) { - return HSSFTestDataSamples.openSampleFileStream(sampleFileName); - } - - public void testWithMissingRecords() throws Exception { - - HSSFRequest req = new HSSFRequest(); - MockHSSFListener mockListen = new MockHSSFListener(); - req.addListenerForAllRecords(mockListen); - - POIFSFileSystem fs = new POIFSFileSystem(openSample("SimpleWithSkip.xls")); - HSSFEventFactory factory = new HSSFEventFactory(); - factory.processWorkbookEvents(req, fs); - - Record[] recs = mockListen.getRecords(); - // Check we got the records - assertTrue( recs.length > 100 ); - - // Check that the last few records are as we expect - // (Makes sure we don't accidently skip the end ones) - int numRec = recs.length; - assertEquals(WindowTwoRecord.class, recs[numRec-3].getClass()); - assertEquals(SelectionRecord.class, recs[numRec-2].getClass()); - assertEquals(EOFRecord.class, recs[numRec-1].getClass()); - } - - public void testWithCrazyContinueRecords() throws Exception { - // Some files have crazy ordering of their continue records - // Check that we don't break on them (bug #42844) - - HSSFRequest req = new HSSFRequest(); - MockHSSFListener mockListen = new MockHSSFListener(); - req.addListenerForAllRecords(mockListen); - - POIFSFileSystem fs = new POIFSFileSystem(openSample("ContinueRecordProblem.xls")); - HSSFEventFactory factory = new HSSFEventFactory(); - factory.processWorkbookEvents(req, fs); - - Record[] recs = mockListen.getRecords(); - // Check we got the records - assertTrue( recs.length > 100 ); - - // And none of them are continue ones - for(int i=0; i records = new ArrayList(); - - public MockHSSFListener() {} - public Record[] getRecords() { - Record[] result = new Record[records.size()]; - records.toArray(result); - return result; - } - - public void processRecord(Record record) { - records.add(record); - } - } - - public void testWithDifferentWorkbookName() throws Exception { + private static final InputStream openSample(String sampleFileName) { + return HSSFTestDataSamples.openSampleFileStream(sampleFileName); + } + + public void testWithMissingRecords() throws Exception { + + HSSFRequest req = new HSSFRequest(); + MockHSSFListener mockListen = new MockHSSFListener(); + req.addListenerForAllRecords(mockListen); + + POIFSFileSystem fs = new POIFSFileSystem(openSample("SimpleWithSkip.xls")); + HSSFEventFactory factory = new HSSFEventFactory(); + factory.processWorkbookEvents(req, fs); + + Record[] recs = mockListen.getRecords(); + // Check we got the records + assertTrue( recs.length > 100 ); + + // Check that the last few records are as we expect + // (Makes sure we don't accidently skip the end ones) + int numRec = recs.length; + assertEquals(WindowTwoRecord.class, recs[numRec-3].getClass()); + assertEquals(SelectionRecord.class, recs[numRec-2].getClass()); + assertEquals(EOFRecord.class, recs[numRec-1].getClass()); + } + + public void testWithCrazyContinueRecords() throws Exception { + // Some files have crazy ordering of their continue records + // Check that we don't break on them (bug #42844) + + HSSFRequest req = new HSSFRequest(); + MockHSSFListener mockListen = new MockHSSFListener(); + req.addListenerForAllRecords(mockListen); + + POIFSFileSystem fs = new POIFSFileSystem(openSample("ContinueRecordProblem.xls")); + HSSFEventFactory factory = new HSSFEventFactory(); + factory.processWorkbookEvents(req, fs); + + Record[] recs = mockListen.getRecords(); + // Check we got the records + assertTrue( recs.length > 100 ); + + // And none of them are continue ones + for(int i=0; i records = new ArrayList(); + + public MockHSSFListener() {} + public Record[] getRecords() { + Record[] result = new Record[records.size()]; + records.toArray(result); + return result; + } + + public void processRecord(Record record) { + records.add(record); + } + } + + public void testWithDifferentWorkbookName() throws Exception { HSSFRequest req = new HSSFRequest(); MockHSSFListener mockListen = new MockHSSFListener(); req.addListenerForAllRecords(mockListen); @@ -140,14 +140,14 @@ public final class TestHSSFEventFactory extends TestCase { fs = new POIFSFileSystem(openSample("WORKBOOK_in_capitals.xls")); factory = new HSSFEventFactory(); factory.processWorkbookEvents(req, fs); - } - - public void testWithPasswordProtectedWorkbooks() throws Exception { + } + + public void testWithPasswordProtectedWorkbooks() throws Exception { HSSFRequest req = new HSSFRequest(); MockHSSFListener mockListen = new MockHSSFListener(); req.addListenerForAllRecords(mockListen); - - // Without a password, can't be read + + // Without a password, can't be read Biff8EncryptionKey.setCurrentUserPassword(null); POIFSFileSystem fs = new POIFSFileSystem(openSample("xor-encryption-abc.xls")); @@ -156,20 +156,20 @@ public final class TestHSSFEventFactory extends TestCase { factory.processWorkbookEvents(req, fs); fail("Shouldn't be able to process protected workbook without the password"); } catch (EncryptedDocumentException e) {} - - + + // With the password, is properly processed Biff8EncryptionKey.setCurrentUserPassword("abc"); - + req = new HSSFRequest(); mockListen = new MockHSSFListener(); req.addListenerForAllRecords(mockListen); factory.processWorkbookEvents(req, fs); - + // Check we got the sheet and the contents Record[] recs = mockListen.getRecords(); assertTrue( recs.length > 50 ); - + // Has one sheet, with values 1,2,3 in column A rows 1-3 boolean hasSheet=false, hasA1=false, hasA2=false, hasA3=false; for (Record r : recs) { @@ -194,10 +194,10 @@ public final class TestHSSFEventFactory extends TestCase { } } } - + assertTrue("Sheet record not found", hasSheet); assertTrue("Numeric record for A1 not found", hasA1); assertTrue("Numeric record for A2 not found", hasA2); assertTrue("Numeric record for A3 not found", hasA3); - } + } }