From a0c00d58b7b499cbc84d58db6cc0488e6a40e5a3 Mon Sep 17 00:00:00 2001 From: Paul Duffin Date: Fri, 26 May 2017 12:43:54 +0000 Subject: Ignore tests that no longer work am: 2a75dcb2fd am: f3cfecad10 am: 5a47920cc4 am: a4bb7ac645 Bug:38419944 Change-Id: If74ffd92284a9254fb8f0df776bf88b36b386558 (cherry picked from commit 20b7a9576f4fdddc13b32e159fb31852d2f50f97) --- README.google | 3 +++ .../java/junitparams/SamplesOfUsageVerificationTest.java | 5 +++-- src/test/java/junitparams/internal/TestMethodTest.java | 6 ++++++ .../naming/MacroSubstitutionNamingStrategyTest.java | 4 ++++ src/test/java/junitparams/usage/SamplesOfUsageTest.java | 15 +++++++++++++-- 5 files changed, 29 insertions(+), 4 deletions(-) diff --git a/README.google b/README.google index 3f85ec8..1b6a564 100644 --- a/README.google +++ b/README.google @@ -14,3 +14,6 @@ Local Modifications: java.beans.PropertyEditorManager classes by removing the usages of them. 36074730 - Make sure that filters affect the Description. + 36541809 - Hard code the description name to be compatible with CTS + and prevent use of @TestCaseName. + Ignore tests broken by the above change. diff --git a/src/test/java/junitparams/SamplesOfUsageVerificationTest.java b/src/test/java/junitparams/SamplesOfUsageVerificationTest.java index a485d4e..459a0cd 100644 --- a/src/test/java/junitparams/SamplesOfUsageVerificationTest.java +++ b/src/test/java/junitparams/SamplesOfUsageVerificationTest.java @@ -15,8 +15,9 @@ public class SamplesOfUsageVerificationTest { Result result = JUnitCore.runClasses(SamplesOfUsageTest.class); assertEquals(0, result.getFailureCount()); - // TODO(JUnit4.10) - 2 tests are ignored because they do not work when run on the device. - assertEquals(2, result.getIgnoreCount()); + // Android-changed: 5 tests are ignored, see the @Ignore annotated methods in + // SamplesOfUsageTest for more details. + assertEquals(5, result.getIgnoreCount()); } } diff --git a/src/test/java/junitparams/internal/TestMethodTest.java b/src/test/java/junitparams/internal/TestMethodTest.java index 2964781..abfe5a3 100644 --- a/src/test/java/junitparams/internal/TestMethodTest.java +++ b/src/test/java/junitparams/internal/TestMethodTest.java @@ -54,6 +54,9 @@ public class TestMethodTest { } + // 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 + @Ignore @Test public void hierarchicalTestMethodStructure() throws Exception { System.clearProperty("JUnitParams.flat"); @@ -64,6 +67,9 @@ public class TestMethodTest { assertEquals("[1] b (forOthersToWork)(junitparams.internal.TestMethodTest)", description.getChildren().get(1).getDisplayName()); } + // 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 + @Ignore @Test public void hierarchicalArrayTestMethodStructure() throws Exception { System.clearProperty("JUnitParams.flat"); diff --git a/src/test/java/junitparams/naming/MacroSubstitutionNamingStrategyTest.java b/src/test/java/junitparams/naming/MacroSubstitutionNamingStrategyTest.java index b6c5c5c..418b946 100644 --- a/src/test/java/junitparams/naming/MacroSubstitutionNamingStrategyTest.java +++ b/src/test/java/junitparams/naming/MacroSubstitutionNamingStrategyTest.java @@ -3,6 +3,7 @@ package junitparams.naming; import junitparams.JUnitParamsRunner; import junitparams.Parameters; import junitparams.internal.TestMethod; +import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.model.FrameworkMethod; @@ -30,6 +31,9 @@ public class MacroSubstitutionNamingStrategyTest { new Object[]{"whenGivenMacroDoesntExist", "{not_existing_macro}"}}; } + // 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 + @Ignore @Test @Parameters public void testNaming(String methodName, String expectedTestCaseName) throws NoSuchMethodException { diff --git a/src/test/java/junitparams/usage/SamplesOfUsageTest.java b/src/test/java/junitparams/usage/SamplesOfUsageTest.java index 3c5f410..9a96961 100644 --- a/src/test/java/junitparams/usage/SamplesOfUsageTest.java +++ b/src/test/java/junitparams/usage/SamplesOfUsageTest.java @@ -102,12 +102,14 @@ public class SamplesOfUsageTest { return new Object[]{new Object[]{"first", 1}, new Object[]{"second", 2}}; } - @Ignore("does not work when run on device as it does not have access to the file") + // Android-changed: does not work when run on device as it does not have access to the file + @Ignore @Test @FileParameters("src/test/resources/test.csv") public void loadParamsFromCsv(int age, String name) { } - @Ignore("does not work when run on device as it does not have access to the file") + // Android-changed: does not work when run on device as it does not have access to the file + @Ignore @Test @FileParameters(value = "src/test/resources/test.csv", mapper = PersonMapper.class) public void loadParamsFromAnyFile(PersonTest.Person person) { } @@ -128,11 +130,17 @@ public class SamplesOfUsageTest { @Parameters("please\\, escape commas if you use it here and don't want your parameters to be splitted") public void commasInParametersUsage(String phrase) { } + // 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 + @Ignore @Test @Parameters({ "1,1", "2,2", "3,6" }) @TestCaseName("factorial({0}) = {1}") public void customNamesForTestCase(int argument, int result) { } + // 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 + @Ignore @Test @Parameters({ "value1, value2", "value3, value4" }) @TestCaseName("[{index}] {method}: {params}") @@ -148,6 +156,9 @@ public class SamplesOfUsageTest { ); } + // 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 + @Ignore @Test @Parameters(method = "mixedParameters") @TestCaseName("{0}, {1}, {2}, {3}") -- cgit v1.2.3