aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Duffin <paulduffin@google.com>2017-03-24 13:38:29 +0000
committerandroid-build-merger <android-build-merger@google.com>2017-03-24 13:38:29 +0000
commitaf2411168919bcf33aded774058a84d921e85c7e (patch)
treef709289deffa11c315718fd7f30b9ed3493aef6c
parent4be4b8b6c80aac6adae26a4249a63d1122020a7b (diff)
parent2ce40971d60976b2cd84e3194c7c5ed6db36cb33 (diff)
downloadjunit-params-af2411168919bcf33aded774058a84d921e85c7e.tar.gz
Hard code text case name template for AndroidJUnitRunner and CTS am: ab5f9f1d78 am: 67e1cb1101
am: 2ce40971d6 Change-Id: Ib8a42ab6f8d107b9b337219174e84e9cb9db12a9
-rw-r--r--src/main/java/junitparams/naming/MacroSubstitutionNamingStrategy.java11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/main/java/junitparams/naming/MacroSubstitutionNamingStrategy.java b/src/main/java/junitparams/naming/MacroSubstitutionNamingStrategy.java
index ce56847..1bdcafb 100644
--- a/src/main/java/junitparams/naming/MacroSubstitutionNamingStrategy.java
+++ b/src/main/java/junitparams/naming/MacroSubstitutionNamingStrategy.java
@@ -14,7 +14,9 @@ public class MacroSubstitutionNamingStrategy implements TestCaseNamingStrategy {
private static final Pattern MACRO_SPLIT_PATTERN = Pattern.compile(String.format("(?=%s)|(?<=%s)", MACRO_PATTERN, MACRO_PATTERN));
private static final String MACRO_START = "{";
private static final String MACRO_END = "}";
- static final String DEFAULT_TEMPLATE = "[{index}] {params} ({method})";
+ // Android-changed: CTS and AndroidJUnitRunner rely on specific format to test names, changing
+ // them will prevent CTS and AndroidJUnitRunner from working properly; see b/36541809
+ static final String DEFAULT_TEMPLATE = "{method}[{index}]";
private TestMethod method;
public MacroSubstitutionNamingStrategy(TestMethod testMethod) {
@@ -37,7 +39,12 @@ public class MacroSubstitutionNamingStrategy implements TestCaseNamingStrategy {
private String getTemplate(TestCaseName testCaseName) {
if (testCaseName != null) {
- return testCaseName.value();
+ // Android-changed: CTS and AndroidJUnitRunner rely on specific format to test names,
+ // changing them will prevent CTS and AndroidJUnitRunner from working properly;
+ // see b/36541809
+ throw new IllegalStateException(
+ "@TestCaseName not currently supported as it breaks running tests in CTS");
+ // return testCaseName.value();
}
return DEFAULT_TEMPLATE;