aboutsummaryrefslogtreecommitdiff
path: root/test-rules
diff options
context:
space:
mode:
authorTobias Thierer <tobiast@google.com>2019-11-21 17:11:16 +0000
committerTobias Thierer <tobiast@google.com>2019-11-25 19:11:55 +0000
commit9bf616ec2d01f5f6e63b85fa4a4fdf37c14557b0 (patch)
tree4878dfea70476b8544c5e4adc40129ce813d6967 /test-rules
parent08299d4dd2bc87732f496286101ce3c295636271 (diff)
downloadlibcore-9bf616ec2d01f5f6e63b85fa4a4fdf37c14557b0.tar.gz
CoreCompatChangeRule: Allow tests without change overrides.
A *Test.java file that uses @EnableCompatChanges or @DisableCompatChanges annotations on just one test case runs this rule on every test case. The rule was enforcing that all test cases must have such an annotation, but most *Test.java will apply annotations to only some of their test cases. Therefore, this CL drops the check for whether a test case carries at least one such annotation. Test: atest CtsLibcoreTestCases:libcore.junit.util.compat.CoreCompatChangeRuleTest Change-Id: I62331a99855d348aa8cc9272628f680eac333b53
Diffstat (limited to 'test-rules')
-rw-r--r--test-rules/src/platform_compat/java/libcore/junit/util/CoreCompatChangeRule.java6
1 files changed, 3 insertions, 3 deletions
diff --git a/test-rules/src/platform_compat/java/libcore/junit/util/CoreCompatChangeRule.java b/test-rules/src/platform_compat/java/libcore/junit/util/CoreCompatChangeRule.java
index 59842c23060..b526707135a 100644
--- a/test-rules/src/platform_compat/java/libcore/junit/util/CoreCompatChangeRule.java
+++ b/test-rules/src/platform_compat/java/libcore/junit/util/CoreCompatChangeRule.java
@@ -79,10 +79,10 @@ public class CoreCompatChangeRule implements TestRule {
}
ChangeConfig config = new ChangeConfig(enabled, disabled);
if (config.isEmpty()) {
- throw new IllegalArgumentException("Added a CompatChangeRule without specifying any "
- + "@EnableCompatChanges or @DisableCompatChanges !");
+ return statement;
+ } else {
+ return createStatementForConfig(statement, config);
}
- return createStatementForConfig(statement, config);
}
protected Statement createStatementForConfig(final Statement statement, ChangeConfig config) {