aboutsummaryrefslogtreecommitdiffstats
path: root/src/testcases/org/apache/poi/ss
diff options
context:
space:
mode:
authorJaven O'Neal <onealj@apache.org>2017-05-20 21:04:14 +0000
committerJaven O'Neal <onealj@apache.org>2017-05-20 21:04:14 +0000
commit254d6ebd4309c433f9a971a09649dcd942b47417 (patch)
treee26b38d6ee7a18aaf7af499a78a26904287106fe /src/testcases/org/apache/poi/ss
parent05e3c83e08cdf934891f40d22ff7f9da390ef6b6 (diff)
downloadpoi-254d6ebd4309c433f9a971a09649dcd942b47417.tar.gz
poi-254d6ebd4309c433f9a971a09649dcd942b47417.zip
github-55: document that CellReference#isRowWithinRange(String rowNum, SpreadsheetVersion ss) expects rowNum to be parseable as an integer
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1795681 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/testcases/org/apache/poi/ss')
-rw-r--r--src/testcases/org/apache/poi/ss/util/TestCellReference.java18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/testcases/org/apache/poi/ss/util/TestCellReference.java b/src/testcases/org/apache/poi/ss/util/TestCellReference.java
index d2f2e462a6..4ebfa00bea 100644
--- a/src/testcases/org/apache/poi/ss/util/TestCellReference.java
+++ b/src/testcases/org/apache/poi/ss/util/TestCellReference.java
@@ -353,8 +353,26 @@ public final class TestCellReference {
assertTrue("first row", CellReference.isRowWithinRange("1", ss));
assertTrue("last row", CellReference.isRowWithinRange("1048576", ss));
assertFalse("1 beyond last row", CellReference.isRowWithinRange("1048577", ss));
+
+ // int versions of above, using 0-based indices
+ assertFalse("1 before first row", CellReference.isRowWithinRange(-1, ss));
+ assertTrue("first row", CellReference.isRowWithinRange(0, ss));
+ assertTrue("last row", CellReference.isRowWithinRange(1048575, ss));
+ assertFalse("1 beyond last row", CellReference.isRowWithinRange(1048576, ss));
+ }
+
+ @Test(expected=NumberFormatException.class)
+ public void isRowWithinRangeNonInteger_BigNumber() {
+ String rowNum = "4000000000";
+ CellReference.isRowWithinRange(rowNum, SpreadsheetVersion.EXCEL2007);
}
+ @Test(expected=NumberFormatException.class)
+ public void isRowWithinRangeNonInteger_Alpha() {
+ String rowNum = "NotANumber";
+ CellReference.isRowWithinRange(rowNum, SpreadsheetVersion.EXCEL2007);
+ }
+
@Test
public void isColWithinRange() {
SpreadsheetVersion ss = SpreadsheetVersion.EXCEL2007;