diff options
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, 27 insertions, 28 deletions
diff --git a/dexmaker-mockito-inline-extended-tests/build.gradle b/dexmaker-mockito-inline-extended-tests/build.gradle index e5dc213..b5664f2 100644 --- a/dexmaker-mockito-inline-extended-tests/build.gradle +++ b/dexmaker-mockito-inline-extended-tests/build.gradle @@ -1,7 +1,20 @@ +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 32 + compileSdkVersion 28 + buildToolsVersion '28.0.3' android { lintOptions { @@ -11,7 +24,8 @@ android { defaultConfig { minSdkVersion 28 - targetSdkVersion 32 + targetSdkVersion 28 + versionName VERSION_NAME testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner' } @@ -22,14 +36,19 @@ 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.13.2' - implementation 'androidx.test:runner:1.4.0' - implementation 'androidx.test:rules:1.4.0' + implementation 'junit:junit:4.12' + implementation 'com.android.support.test:runner:1.0.2' + implementation 'com.android.support.test:rules:1.0.2' - api 'org.mockito:mockito-core:2.28.2', { exclude group: 'net.bytebuddy' } + api 'org.mockito:mockito-core:2.25.0', { 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 eff42ab..7c7941b 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,7 +16,6 @@ package com.android.dx.mockito.inline.extended.tests; -import android.app.PendingIntent; import android.content.ContentResolver; import android.provider.Settings; @@ -34,9 +33,8 @@ import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.eq; public class StaticMockitoSession { - @Test - public void strictUnnecessaryStubbing() { + public void strictUnnecessaryStubbing() throws Exception { MockitoSession session = mockitoSession().spyStatic(Settings.Global.class).startMocking(); // Set up unnecessary stubbing @@ -53,7 +51,7 @@ public class StaticMockitoSession { } @Test - public void lenientUnnecessaryStubbing() { + public void lenientUnnecessaryStubbing() throws Exception { MockitoSession session = mockitoSession().strictness(Strictness.LENIENT) .spyStatic(Settings.Global.class).startMocking(); @@ -63,22 +61,4 @@ 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(); - } } |