From 8e4e6345b6e3d1ff4f1f8fbb7cb48123ab3fd601 Mon Sep 17 00:00:00 2001 From: John Watson Date: Tue, 5 Oct 2021 12:53:34 -0700 Subject: [PATCH] Update to the latest sdk version (#167) And make sure version-specific tests are running on more versions --- splunk-otel-android/build.gradle | 4 ++-- .../java/com/splunk/rum/ConnectionUtilTest.java | 17 +++++++++-------- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/splunk-otel-android/build.gradle b/splunk-otel-android/build.gradle index b85d80c2..e2ef9f5e 100644 --- a/splunk-otel-android/build.gradle +++ b/splunk-otel-android/build.gradle @@ -5,12 +5,12 @@ plugins { } android { - compileSdkVersion 30 + compileSdkVersion 31 buildToolsVersion "30.0.3" defaultConfig { minSdkVersion 21 - targetSdkVersion 30 + targetSdkVersion 31 testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" consumerProguardFiles "consumer-rules.pro" diff --git a/splunk-otel-android/src/test/java/com/splunk/rum/ConnectionUtilTest.java b/splunk-otel-android/src/test/java/com/splunk/rum/ConnectionUtilTest.java index 5003c6df..35da5a52 100644 --- a/splunk-otel-android/src/test/java/com/splunk/rum/ConnectionUtilTest.java +++ b/splunk-otel-android/src/test/java/com/splunk/rum/ConnectionUtilTest.java @@ -44,10 +44,11 @@ import java.util.concurrent.atomic.AtomicInteger; @RunWith(RobolectricTestRunner.class) +@Config(maxSdk = Build.VERSION_CODES.S) public class ConnectionUtilTest { @Test - @Config(sdk = Build.VERSION_CODES.LOLLIPOP) + @Config(maxSdk = Build.VERSION_CODES.LOLLIPOP) public void lollipop() { NetworkRequest networkRequest = mock(NetworkRequest.class); NetworkDetector networkDetector = mock(NetworkDetector.class); @@ -85,8 +86,8 @@ public void lollipop() { } @Test - @Config(sdk = Build.VERSION_CODES.Q) - public void quiznos() { + @Config(maxSdk = Build.VERSION_CODES.S, minSdk = Build.VERSION_CODES.O) + public void modernSdks() { NetworkRequest networkRequest = mock(NetworkRequest.class); NetworkDetector networkDetector = mock(NetworkDetector.class); ConnectivityManager connectivityManager = mock(ConnectivityManager.class); @@ -133,7 +134,7 @@ public void networkDetectorException() { } @Test - @Config(sdk = Build.VERSION_CODES.Q) + @Config(maxSdk = Build.VERSION_CODES.S, minSdk = Build.VERSION_CODES.O) public void networkDetectorExceptionOnCallbackRegistration() { NetworkDetector networkDetector = mock(NetworkDetector.class); ConnectivityManager connectivityManager = mock(ConnectivityManager.class); @@ -148,7 +149,7 @@ public void networkDetectorExceptionOnCallbackRegistration() { } @Test - @Config(sdk = Build.VERSION_CODES.LOLLIPOP) + @Config(maxSdk = Build.VERSION_CODES.LOLLIPOP) public void networkDetectorExceptionOnCallbackRegistration_lollipop() { NetworkDetector networkDetector = mock(NetworkDetector.class); ConnectivityManager connectivityManager = mock(ConnectivityManager.class); @@ -164,7 +165,7 @@ public void networkDetectorExceptionOnCallbackRegistration_lollipop() { } @Test - @Config(sdk = Build.VERSION_CODES.LOLLIPOP) + @Config(maxSdk = Build.VERSION_CODES.LOLLIPOP) public void shouldNotFailOnImmediateConnectionManagerCall_lollipop() { NetworkRequest networkRequest = mock(NetworkRequest.class); NetworkDetector networkDetector = mock(NetworkDetector.class); @@ -182,8 +183,8 @@ public void shouldNotFailOnImmediateConnectionManagerCall_lollipop() { } @Test - @Config(sdk = Build.VERSION_CODES.Q) - public void shouldNotFailOnImmediateConnectionManagerCall_quiznos() { + @Config(maxSdk = Build.VERSION_CODES.S, minSdk = Build.VERSION_CODES.O) + public void shouldNotFailOnImmediateConnectionManagerCall() { NetworkRequest networkRequest = mock(NetworkRequest.class); NetworkDetector networkDetector = mock(NetworkDetector.class); ConnectivityManager connectivityManager = mock(ConnectivityManager.class);