diff options
author | Dominik Stadler <centic@apache.org> | 2017-09-17 11:08:23 +0000 |
---|---|---|
committer | Dominik Stadler <centic@apache.org> | 2017-09-17 11:08:23 +0000 |
commit | 467053d91cf5ec1d48cfa979f82032ca7267f441 (patch) | |
tree | 9a3e8f3de0249ac1a8b5eec1defae2f8947fa880 /src/testcases | |
parent | ec42ec1053cdd849923bcbc0ad99ec0613a34af5 (diff) | |
download | poi-467053d91cf5ec1d48cfa979f82032ca7267f441.tar.gz poi-467053d91cf5ec1d48cfa979f82032ca7267f441.zip |
Various code cleanups, "final" for static methods is useless, for-loops, simplify boolean conditions, try-with-resource, javadoc, ...
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1808620 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/testcases')
6 files changed, 11 insertions, 15 deletions
diff --git a/src/testcases/org/apache/poi/hssf/eventusermodel/TestHSSFEventFactory.java b/src/testcases/org/apache/poi/hssf/eventusermodel/TestHSSFEventFactory.java index e57118b835..bf66cecef4 100644 --- a/src/testcases/org/apache/poi/hssf/eventusermodel/TestHSSFEventFactory.java +++ b/src/testcases/org/apache/poi/hssf/eventusermodel/TestHSSFEventFactory.java @@ -42,7 +42,7 @@ import org.junit.After; * Testing for {@link HSSFEventFactory} */ public final class TestHSSFEventFactory extends TestCase { - private static final InputStream openSample(String sampleFileName) { + private static InputStream openSample(String sampleFileName) { return HSSFTestDataSamples.openSampleFileStream(sampleFileName); } diff --git a/src/testcases/org/apache/poi/hssf/record/TestFormulaRecord.java b/src/testcases/org/apache/poi/hssf/record/TestFormulaRecord.java index 2f6a14b769..e0d14b8da9 100644 --- a/src/testcases/org/apache/poi/hssf/record/TestFormulaRecord.java +++ b/src/testcases/org/apache/poi/hssf/record/TestFormulaRecord.java @@ -184,7 +184,7 @@ public final class TestFormulaRecord extends TestCase { fr0.setCachedResultBoolean(false); fr1.setCachedResultBoolean(true); - if (fr0.getCachedBooleanValue() == true && fr1.getCachedBooleanValue() == false) { + if (fr0.getCachedBooleanValue() && !fr1.getCachedBooleanValue()) { throw new AssertionFailedError("Identified bug 46479c"); } assertEquals(false, fr0.getCachedBooleanValue()); diff --git a/src/testcases/org/apache/poi/poifs/filesystem/TestNotOLE2Exception.java b/src/testcases/org/apache/poi/poifs/filesystem/TestNotOLE2Exception.java index cb156728eb..cb61e98ed8 100644 --- a/src/testcases/org/apache/poi/poifs/filesystem/TestNotOLE2Exception.java +++ b/src/testcases/org/apache/poi/poifs/filesystem/TestNotOLE2Exception.java @@ -34,10 +34,10 @@ import org.apache.poi.hssf.OldExcelFormatException; * checks */ public class TestNotOLE2Exception extends TestCase { - private static final InputStream openXLSSampleStream(String sampleFileName) { + private static InputStream openXLSSampleStream(String sampleFileName) { return HSSFTestDataSamples.openSampleFileStream(sampleFileName); } - private static final InputStream openDOCSampleStream(String sampleFileName) { + private static InputStream openDOCSampleStream(String sampleFileName) { return POIDataSamples.getDocumentInstance().openResourceAsStream(sampleFileName); } diff --git a/src/testcases/org/apache/poi/poifs/filesystem/TestOfficeXMLException.java b/src/testcases/org/apache/poi/poifs/filesystem/TestOfficeXMLException.java index e78e19f375..8b53738030 100644 --- a/src/testcases/org/apache/poi/poifs/filesystem/TestOfficeXMLException.java +++ b/src/testcases/org/apache/poi/poifs/filesystem/TestOfficeXMLException.java @@ -34,7 +34,7 @@ import junit.framework.TestCase; */ public class TestOfficeXMLException extends TestCase { - private static final InputStream openSampleStream(String sampleFileName) { + private static InputStream openSampleStream(String sampleFileName) { return HSSFTestDataSamples.openSampleFileStream(sampleFileName); } public void testOOXMLException() throws IOException diff --git a/src/testcases/org/apache/poi/ss/formula/eval/forked/TestForkedEvaluator.java b/src/testcases/org/apache/poi/ss/formula/eval/forked/TestForkedEvaluator.java index 804fcb20fc..3b9a53ff48 100644 --- a/src/testcases/org/apache/poi/ss/formula/eval/forked/TestForkedEvaluator.java +++ b/src/testcases/org/apache/poi/ss/formula/eval/forked/TestForkedEvaluator.java @@ -108,15 +108,11 @@ public class TestForkedEvaluator { public void testMissingInputCellH() throws IOException { expectedEx.expect(UnsupportedOperationException.class); expectedEx.expectMessage("Underlying cell 'A2' is missing in master sheet."); - - Workbook wb = createWorkbook(); - try { - ForkedEvaluator fe = ForkedEvaluator.create(wb, null, null); - // attempt update input at cell A2 (which is missing) - fe.updateCell("Inputs", 1, 0, new NumberEval(4.0)); - } finally { - wb.close(); + try (Workbook wb = createWorkbook()) { + ForkedEvaluator fe = ForkedEvaluator.create(wb, null, null); + // attempt update input at cell A2 (which is missing) + fe.updateCell("Inputs", 1, 0, new NumberEval(4.0)); } } } diff --git a/src/testcases/org/apache/poi/ss/formula/ptg/AbstractPtgTestCase.java b/src/testcases/org/apache/poi/ss/formula/ptg/AbstractPtgTestCase.java index 202a9e06c7..1e4abfae08 100644 --- a/src/testcases/org/apache/poi/ss/formula/ptg/AbstractPtgTestCase.java +++ b/src/testcases/org/apache/poi/ss/formula/ptg/AbstractPtgTestCase.java @@ -36,14 +36,14 @@ public abstract class AbstractPtgTestCase extends TestCase { * @param sampleFileName the filename. * @return the loaded workbook. */ - protected static final HSSFWorkbook loadWorkbook(String sampleFileName) { + protected static HSSFWorkbook loadWorkbook(String sampleFileName) { return HSSFTestDataSamples.openSampleWorkbook(sampleFileName); } /** * Creates a new Workbook and adds one sheet with the specified name */ - protected static final HSSFWorkbook createWorkbookWithSheet(String sheetName) { + protected static HSSFWorkbook createWorkbookWithSheet(String sheetName) { HSSFWorkbook book = new HSSFWorkbook(); book.createSheet(sheetName); return book; |