diff options
author | John Wu <topjohnwu@google.com> | 2022-09-12 23:50:34 +0000 |
---|---|---|
committer | John Wu <topjohnwu@google.com> | 2022-09-12 23:50:34 +0000 |
commit | c57c3d977b947dfafdcc8e27bf5c1cd6e3342f95 (patch) | |
tree | 172d1f762cf1c1f63882536463374e6b04ec4a35 /dexmaker-mockito-inline-extended-tests | |
parent | ecb8636406ec1c4c89e721e38d570e8c19bba866 (diff) | |
download | dexmaker-c57c3d977b947dfafdcc8e27bf5c1cd6e3342f95.tar.gz |
Update to upstream dexmaker
New changes are submitted upstream to support latest Java DCL
restrictions added to the platform.
Test: m
Bug: 218865702
Change-Id: Ie081df9004c01d9e4e1bcefba22cce3d92f49d4a
Diffstat (limited to 'dexmaker-mockito-inline-extended-tests')
-rw-r--r-- | dexmaker-mockito-inline-extended-tests/build.gradle | 31 | ||||
-rw-r--r-- | dexmaker-mockito-inline-extended-tests/src/main/java/com/android/dx/mockito/inline/extended/tests/StaticMockitoSession.java | 24 |
2 files changed, 28 insertions, 27 deletions
diff --git a/dexmaker-mockito-inline-extended-tests/build.gradle b/dexmaker-mockito-inline-extended-tests/build.gradle index b5664f2..e5dc213 100644 --- a/dexmaker-mockito-inline-extended-tests/build.gradle +++ b/dexmaker-mockito-inline-extended-tests/build.gradle @@ -1,20 +1,7 @@ -buildscript { - repositories { - maven { - url "https://plugins.gradle.org/m2/" - } - } - dependencies { - classpath "net.ltgt.gradle:gradle-errorprone-plugin:0.0.13" - } -} - -apply plugin: "net.ltgt.errorprone" apply plugin: 'com.android.library' android { - compileSdkVersion 28 - buildToolsVersion '28.0.3' + compileSdkVersion 32 android { lintOptions { @@ -24,8 +11,7 @@ android { defaultConfig { minSdkVersion 28 - targetSdkVersion 28 - versionName VERSION_NAME + targetSdkVersion 32 testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner' } @@ -36,19 +22,14 @@ android { } } -repositories { - jcenter() - google() -} - dependencies { implementation project(':dexmaker-mockito-inline-tests') compileOnly project(':dexmaker-mockito-inline-extended') androidTestImplementation project(':dexmaker-mockito-inline-extended') - implementation 'junit:junit:4.12' - implementation 'com.android.support.test:runner:1.0.2' - implementation 'com.android.support.test:rules:1.0.2' + implementation 'junit:junit:4.13.2' + implementation 'androidx.test:runner:1.4.0' + implementation 'androidx.test:rules:1.4.0' - api 'org.mockito:mockito-core:2.25.0', { exclude group: 'net.bytebuddy' } + api 'org.mockito:mockito-core:2.28.2', { exclude group: 'net.bytebuddy' } } diff --git a/dexmaker-mockito-inline-extended-tests/src/main/java/com/android/dx/mockito/inline/extended/tests/StaticMockitoSession.java b/dexmaker-mockito-inline-extended-tests/src/main/java/com/android/dx/mockito/inline/extended/tests/StaticMockitoSession.java index 7c7941b..eff42ab 100644 --- a/dexmaker-mockito-inline-extended-tests/src/main/java/com/android/dx/mockito/inline/extended/tests/StaticMockitoSession.java +++ b/dexmaker-mockito-inline-extended-tests/src/main/java/com/android/dx/mockito/inline/extended/tests/StaticMockitoSession.java @@ -16,6 +16,7 @@ package com.android.dx.mockito.inline.extended.tests; +import android.app.PendingIntent; import android.content.ContentResolver; import android.provider.Settings; @@ -33,8 +34,9 @@ import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.eq; public class StaticMockitoSession { + @Test - public void strictUnnecessaryStubbing() throws Exception { + public void strictUnnecessaryStubbing() { MockitoSession session = mockitoSession().spyStatic(Settings.Global.class).startMocking(); // Set up unnecessary stubbing @@ -51,7 +53,7 @@ public class StaticMockitoSession { } @Test - public void lenientUnnecessaryStubbing() throws Exception { + public void lenientUnnecessaryStubbing() { MockitoSession session = mockitoSession().strictness(Strictness.LENIENT) .spyStatic(Settings.Global.class).startMocking(); @@ -61,4 +63,22 @@ public class StaticMockitoSession { session.finishMocking(); } + + @Test + public void spyStatic() { + mockitoSession() + .initMocks(this) + .spyStatic(PendingIntent.class) + .startMocking() + .finishMocking(); + } + + @Test + public void mockStatic() { + mockitoSession() + .initMocks(this) + .mockStatic(PendingIntent.class) + .startMocking() + .finishMocking(); + } } |