diff options
author | Tim Peut <timpeut@google.com> | 2024-04-17 16:07:45 -0700 |
---|---|---|
committer | Copybara-Service <copybara-worker@google.com> | 2024-04-17 16:08:33 -0700 |
commit | 71dc7ee3b39a334e2b1eecdffcd24e95b99a130f (patch) | |
tree | 16b5e6f819776407caca13bef4ce9e327d6c463e | |
parent | 7c563e9b476b301af28757896040057a5256fbed (diff) | |
download | robolectric-71dc7ee3b39a334e2b1eecdffcd24e95b99a130f.tar.gz |
Remove references to KITKAT from Robolectric framework tests.
This is in preparation for Robolectric dropping support for 19.
PiperOrigin-RevId: 625836028
-rw-r--r-- | integration_tests/versioning/src/test/java/org/robolectric/versioning/AndroidVersionsTest.java | 9 | ||||
-rw-r--r-- | robolectric/src/test/java/org/robolectric/RobolectricTestRunnerMultiApiTest.java | 46 |
2 files changed, 22 insertions, 33 deletions
diff --git a/integration_tests/versioning/src/test/java/org/robolectric/versioning/AndroidVersionsTest.java b/integration_tests/versioning/src/test/java/org/robolectric/versioning/AndroidVersionsTest.java index 09b394a1a..89bdc6717 100644 --- a/integration_tests/versioning/src/test/java/org/robolectric/versioning/AndroidVersionsTest.java +++ b/integration_tests/versioning/src/test/java/org/robolectric/versioning/AndroidVersionsTest.java @@ -139,13 +139,4 @@ public final class AndroidVersionsTest { assertThat(new AndroidVersions.L().getVersion()).isEqualTo("5.0"); assertThat(AndroidVersions.CURRENT.getShortCode()).isEqualTo("L"); } - - @Test - @Config(sdk = 19) - public void testStandardInitializationK() { - assertThat(AndroidVersions.K.SDK_INT).isEqualTo(19); - assertThat(AndroidVersions.K.SHORT_CODE).isEqualTo("K"); - assertThat(new AndroidVersions.K().getVersion()).isEqualTo("4.4"); - assertThat(AndroidVersions.CURRENT.getShortCode()).isEqualTo("K"); - } } diff --git a/robolectric/src/test/java/org/robolectric/RobolectricTestRunnerMultiApiTest.java b/robolectric/src/test/java/org/robolectric/RobolectricTestRunnerMultiApiTest.java index d50ca474b..d994d8d92 100644 --- a/robolectric/src/test/java/org/robolectric/RobolectricTestRunnerMultiApiTest.java +++ b/robolectric/src/test/java/org/robolectric/RobolectricTestRunnerMultiApiTest.java @@ -1,6 +1,5 @@ package org.robolectric; -import static android.os.Build.VERSION_CODES.KITKAT; import static android.os.Build.VERSION_CODES.LOLLIPOP; import static android.os.Build.VERSION_CODES.LOLLIPOP_MR1; import static android.os.Build.VERSION_CODES.M; @@ -39,7 +38,7 @@ import org.robolectric.util.inject.Injector; @RunWith(JUnit4.class) public class RobolectricTestRunnerMultiApiTest { - private static final int[] APIS_FOR_TEST = {KITKAT, LOLLIPOP, LOLLIPOP_MR1, M, N, N_MR1, O}; + private static final int[] APIS_FOR_TEST = {LOLLIPOP, LOLLIPOP_MR1, M, N, N_MR1, O}; private static SdkPicker delegateSdkPicker; private static final Injector INJECTOR = defaultInjector() @@ -82,7 +81,7 @@ public class RobolectricTestRunnerMultiApiTest { public void createChildrenForEachSupportedApi() throws Throwable { runner = runnerOf(TestWithNoConfig.class); assertThat(apisFor(runner.getChildren())) - .containsExactly(KITKAT, LOLLIPOP, LOLLIPOP_MR1, M, N, N_MR1, O); + .containsExactly(LOLLIPOP, LOLLIPOP_MR1, M, N, N_MR1, O); } @Test @@ -101,13 +100,13 @@ public class RobolectricTestRunnerMultiApiTest { assertThat(e.getMessage()) .contains( "sdk and minSdk/maxSdk may not be specified together" - + " (sdk=[19], minSdk=23, maxSdk=24)"); + + " (sdk=[23], minSdk=23, maxSdk=24)"); } } @Test public void withEnabledSdks_createChildrenForEachSupportedSdk() throws Throwable { - delegateSdkPicker = new DefaultSdkPicker(new SdkCollection(() -> map(19, 21)), null); + delegateSdkPicker = new DefaultSdkPicker(new SdkCollection(() -> map(21, 23)), null); runner = runnerOf(TestWithNoConfig.class); assertThat(runner.getChildren()).hasSize(2); @@ -116,18 +115,17 @@ public class RobolectricTestRunnerMultiApiTest { @Test public void shouldAddApiLevelToNameOfAllButHighestNumberedMethodName() throws Throwable { runner = runnerOf(TestMethodUpToAndIncludingN.class); - assertThat(runner.getChildren().get(0).getName()).isEqualTo("testSomeApiLevel[19]"); - assertThat(runner.getChildren().get(1).getName()).isEqualTo("testSomeApiLevel[21]"); - assertThat(runner.getChildren().get(2).getName()).isEqualTo("testSomeApiLevel[22]"); - assertThat(runner.getChildren().get(3).getName()).isEqualTo("testSomeApiLevel[23]"); - assertThat(runner.getChildren().get(4).getName()).isEqualTo("testSomeApiLevel"); + assertThat(runner.getChildren().get(0).getName()).isEqualTo("testSomeApiLevel[21]"); + assertThat(runner.getChildren().get(1).getName()).isEqualTo("testSomeApiLevel[22]"); + assertThat(runner.getChildren().get(2).getName()).isEqualTo("testSomeApiLevel[23]"); + assertThat(runner.getChildren().get(3).getName()).isEqualTo("testSomeApiLevel"); } @Test public void noConfig() throws Throwable { runner = runnerOf(TestWithNoConfig.class); assertThat(apisFor(runner.getChildren())) - .containsExactly(KITKAT, LOLLIPOP, LOLLIPOP_MR1, M, N, N_MR1, O); + .containsExactly(LOLLIPOP, LOLLIPOP_MR1, M, N, N_MR1, O); runner.run(runNotifier); assertThat(runListener.ignored).isEmpty(); @@ -137,24 +135,24 @@ public class RobolectricTestRunnerMultiApiTest { @Test public void classConfigWithSdkGroup() throws Throwable { runner = runnerOf(TestClassConfigWithSdkGroup.class); - assertThat(apisFor(runner.getChildren())).containsExactly(KITKAT, N); + assertThat(apisFor(runner.getChildren())).containsExactly(M, N); runner.run(runNotifier); assertThat(runListener.ignored).isEmpty(); - // Test method should be run for KitKat and N + // Test method should be run for M and N assertThat(runListener.finished).hasSize(2); } @Test public void methodConfigWithSdkGroup() throws Throwable { runner = runnerOf(TestMethodConfigWithSdkGroup.class); - assertThat(apisFor(runner.getChildren())).containsExactly(KITKAT, N); + assertThat(apisFor(runner.getChildren())).containsExactly(M, N); runner.run(runNotifier); assertThat(runListener.ignored).isEmpty(); - // Test method should be run for KitKat and N + // Test method should be run for M, N assertThat(runListener.finished).hasSize(2); } @@ -173,12 +171,12 @@ public class RobolectricTestRunnerMultiApiTest { @Test public void classConfigMaxSdk() throws Throwable { runner = runnerOf(TestClassUpToAndIncludingN.class); - assertThat(apisFor(runner.getChildren())).containsExactly(KITKAT, LOLLIPOP, LOLLIPOP_MR1, M, N); + assertThat(apisFor(runner.getChildren())).containsExactly(LOLLIPOP, LOLLIPOP_MR1, M, N); runner.run(runNotifier); assertThat(runListener.ignored).isEmpty(); - int sdksUpToAndIncludingLollipop = 5; + int sdksUpToAndIncludingLollipop = 4; assertThat(runListener.finished).hasSize(sdksUpToAndIncludingLollipop); } @@ -210,12 +208,12 @@ public class RobolectricTestRunnerMultiApiTest { @Test public void methodConfigMaxSdk() throws Throwable { runner = runnerOf(TestMethodUpToAndIncludingN.class); - assertThat(apisFor(runner.getChildren())).containsExactly(KITKAT, LOLLIPOP, LOLLIPOP_MR1, M, N); + assertThat(apisFor(runner.getChildren())).containsExactly(LOLLIPOP, LOLLIPOP_MR1, M, N); runner.run(runNotifier); assertThat(runListener.ignored).isEmpty(); - int sdksUpToAndIncludingLollipop = 5; + int sdksUpToAndIncludingLollipop = 4; assertThat(runListener.finished).hasSize(sdksUpToAndIncludingLollipop); } @@ -243,19 +241,19 @@ public class RobolectricTestRunnerMultiApiTest { @Test public void test() {} } - @Config(sdk = {KITKAT, N}) + @Config(sdk = {M, N}) public static class TestClassConfigWithSdkGroup { @Test public void testShouldRunApi18() { - assertThat(Build.VERSION.SDK_INT).isIn(Range.closed(KITKAT, N)); + assertThat(Build.VERSION.SDK_INT).isIn(Range.closed(M, N)); } } @Config(sdk = Config.ALL_SDKS) public static class TestMethodConfigWithSdkGroup { - @Config(sdk = {KITKAT, N}) + @Config(sdk = {M, N}) @Test public void testShouldRunApi16() { - assertThat(Build.VERSION.SDK_INT).isIn(Range.closed(KITKAT, N)); + assertThat(Build.VERSION.SDK_INT).isIn(Range.closed(M, N)); } } @@ -317,7 +315,7 @@ public class RobolectricTestRunnerMultiApiTest { @Config(sdk = Config.ALL_SDKS) public static class TestMethodWithSdkAndMinMax { - @Config(sdk = KITKAT, minSdk = M, maxSdk = N) + @Config(sdk = M, minSdk = M, maxSdk = N) @Test public void testWithKitKatAndLollipop() { assertThat(Build.VERSION.SDK_INT).isIn(Range.closed(M, N)); |