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
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});
+ }
}
}