aboutsummaryrefslogtreecommitdiffstats
path: root/src/testcases/org/apache/poi
diff options
context:
space:
mode:
authorPJ Fanning <fanningpj@apache.org>2020-04-29 21:18:18 +0000
committerPJ Fanning <fanningpj@apache.org>2020-04-29 21:18:18 +0000
commit1491160578b837a52af3991a8edb6b147c36f83b (patch)
treed4a96b6756642efea6f0240b72e1b1c92ad37cc5 /src/testcases/org/apache/poi
parentbc654e63da1fe4f7df909fb0f7b24623abd560fc (diff)
downloadpoi-1491160578b837a52af3991a8edb6b147c36f83b.tar.gz
poi-1491160578b837a52af3991a8edb6b147c36f83b.zip
[github-176] Remove limit on number of rules in XSSFSheetConditionalFormatting.
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1877177 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/testcases/org/apache/poi')
-rw-r--r--src/testcases/org/apache/poi/ss/usermodel/BaseTestConditionalFormatting.java22
1 files changed, 17 insertions, 5 deletions
diff --git a/src/testcases/org/apache/poi/ss/usermodel/BaseTestConditionalFormatting.java b/src/testcases/org/apache/poi/ss/usermodel/BaseTestConditionalFormatting.java
index f6e2a48876..04f922713e 100644
--- a/src/testcases/org/apache/poi/ss/usermodel/BaseTestConditionalFormatting.java
+++ b/src/testcases/org/apache/poi/ss/usermodel/BaseTestConditionalFormatting.java
@@ -42,10 +42,12 @@ import org.junit.Test;
public abstract class BaseTestConditionalFormatting {
private final ITestDataProvider _testDataProvider;
- protected BaseTestConditionalFormatting(ITestDataProvider testDataProvider){
+ protected BaseTestConditionalFormatting(ITestDataProvider testDataProvider) {
_testDataProvider = testDataProvider;
}
+ protected boolean applyLimitOf3 = true;
+
protected abstract void assertColour(String hexExpected, Color actual);
@Test
@@ -97,10 +99,20 @@ public abstract class BaseTestConditionalFormatting {
assertTrue(e.getMessage().startsWith("cfRules must not be empty"));
}
- //this is now allowed
- sheetCF.addConditionalFormatting(
- new CellRangeAddress[]{CellRangeAddress.valueOf("A1:A3")},
- new ConditionalFormattingRule[]{rule1, rule2, rule3, rule4});
+ if (applyLimitOf3) {
+ try {
+ sheetCF.addConditionalFormatting(
+ new CellRangeAddress[]{CellRangeAddress.valueOf("A1:A3")},
+ new ConditionalFormattingRule[]{rule1, rule2, rule3, rule4});
+ fail("expected exception");
+ } catch (IllegalArgumentException e) {
+ assertTrue(e.getMessage().startsWith("Number of rules must not exceed 3"));
+ }
+ } else {
+ sheetCF.addConditionalFormatting(
+ new CellRangeAddress[]{CellRangeAddress.valueOf("A1:A3")},
+ new ConditionalFormattingRule[]{rule1, rule2, rule3, rule4});
+ }
}
}