From a6957b5c91cc4b2b6f5bc8e07dcd45df09354374 Mon Sep 17 00:00:00 2001 From: Dominik Stadler Date: Fri, 1 Jan 2016 16:27:35 +0000 Subject: [PATCH] Some more unit tests git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1722501 13f79535-47bb-0310-9956-ffa450edef68 --- .../poi/ss/formula/TestFormulaShifter.java | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/src/testcases/org/apache/poi/ss/formula/TestFormulaShifter.java b/src/testcases/org/apache/poi/ss/formula/TestFormulaShifter.java index 501df6a34..886755850 100644 --- a/src/testcases/org/apache/poi/ss/formula/TestFormulaShifter.java +++ b/src/testcases/org/apache/poi/ss/formula/TestFormulaShifter.java @@ -244,4 +244,35 @@ public final class TestFormulaShifter extends TestCase { assertEquals("formula previously pointing to sheet 3 should be unchanged", 3, ((Ref3DPtg)ptgs[3]).getExternSheetIndex()); } + + public void testInvalidArgument() { + try { + FormulaShifter.createForRowShift(1, "name", 1, 2, 0, SpreadsheetVersion.EXCEL97); + fail("Should catch exception here"); + } catch (IllegalArgumentException e) { + // expected here + } + + try { + FormulaShifter.createForRowShift(1, "name", 2, 1, 2, SpreadsheetVersion.EXCEL97); + fail("Should catch exception here"); + } catch (IllegalArgumentException e) { + // expected here + } + } + + @SuppressWarnings("deprecation") + public void testConstructor() { + assertNotNull(FormulaShifter.createForRowShift(1, "name", 1, 2, 2)); + } + + public void testToString() { + FormulaShifter shifter = FormulaShifter.createForRowShift(0, "sheet", 123, 456, 789, + SpreadsheetVersion.EXCEL2007); + assertNotNull(shifter); + assertNotNull(shifter.toString()); + assertTrue(shifter.toString().contains("123")); + assertTrue(shifter.toString().contains("456")); + assertTrue(shifter.toString().contains("789")); + } }