diff options
author | Dominik Stadler <centic@apache.org> | 2016-11-27 11:06:57 +0000 |
---|---|---|
committer | Dominik Stadler <centic@apache.org> | 2016-11-27 11:06:57 +0000 |
commit | f8040a4c41051eef07fcc5c2748407763486af0b (patch) | |
tree | 9e34119caaad1a03b716f223488923e62ffd329e /src/testcases/org | |
parent | 470a17ad436f604cf4c569bb38a5b253f30ac5b2 (diff) | |
download | poi-f8040a4c41051eef07fcc5c2748407763486af0b.tar.gz poi-f8040a4c41051eef07fcc5c2748407763486af0b.zip |
Fix newly introduced Sonar issues and allow text to be null
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1771563 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/testcases/org')
-rw-r--r-- | src/testcases/org/apache/poi/ss/usermodel/BaseTestBugzillaIssues.java | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/testcases/org/apache/poi/ss/usermodel/BaseTestBugzillaIssues.java b/src/testcases/org/apache/poi/ss/usermodel/BaseTestBugzillaIssues.java index 4d465499ac..a1f296355f 100644 --- a/src/testcases/org/apache/poi/ss/usermodel/BaseTestBugzillaIssues.java +++ b/src/testcases/org/apache/poi/ss/usermodel/BaseTestBugzillaIssues.java @@ -1805,6 +1805,9 @@ public abstract class BaseTestBugzillaIssues { checkFailures(dataValidation, TEST_256, TEST_32, true); checkFailures(dataValidation, TEST_32, TEST_256, true); + // null does work + checkFailures(dataValidation, null, null, false); + // more than 32 title fail for HSSFWorkbook checkFailures(dataValidation, TEST_255, TEST_32, wb instanceof HSSFWorkbook); @@ -1838,16 +1841,16 @@ public abstract class BaseTestBugzillaIssues { private void checkFailures(DataValidation dataValidation, String title, String text, boolean shouldFail) { try { dataValidation.createPromptBox(title, text); - assertFalse("Should fail in a length-check, had " + title.length() + " and " + text.length(), shouldFail); + assertFalse("Should fail in a length-check, had " + (title == null ? null : title.length()) + " and " + (text == null ? null : text.length()), shouldFail); } catch (IllegalStateException e) { - assertTrue("Should not fail in a length-check, had " + title.length() + " and " + text.length(), shouldFail); + assertTrue("Should not fail in a length-check, had " + (title == null ? null : title.length()) + " and " + (text == null ? null : text.length()), shouldFail); // expected here } try { dataValidation.createErrorBox(title, text); - assertFalse("Should fail in a length-check, had " + title.length() + " and " + text.length(), shouldFail); + assertFalse("Should fail in a length-check, had " + (title == null ? null : title.length()) + " and " + (text == null ? null : text.length()), shouldFail); } catch (IllegalStateException e) { - assertTrue("Should not fail in a length-check, had " + title.length() + " and " + text.length(), shouldFail); + assertTrue("Should not fail in a length-check, had " + (title == null ? null : title.length()) + " and " + (text == null ? null : text.length()), shouldFail); } } |