Skip to content

Commit 96470e8

Browse files
author
Erik Czako
committed
upgrade dependencies and fix failing tests
1 parent f49e652 commit 96470e8

5 files changed

Lines changed: 35 additions & 16 deletions

File tree

android/build.gradle

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
ext {
22
junitVersion = project.hasProperty('junitVersion') ? rootProject.ext.junitVersion : '4.13.2'
3-
androidxAppCompatVersion = project.hasProperty('androidxAppCompatVersion') ? rootProject.ext.androidxAppCompatVersion : '1.7.0'
4-
androidxCoordinatorLayoutVersion = project.hasProperty('androidxCoordinatorLayoutVersion') ? rootProject.ext.androidxCoordinatorLayoutVersion : '1.2.0'
3+
androidxAppCompatVersion = project.hasProperty('androidxAppCompatVersion') ? rootProject.ext.androidxAppCompatVersion : '1.7.1'
4+
androidxCoordinatorLayoutVersion = project.hasProperty('androidxCoordinatorLayoutVersion') ? rootProject.ext.androidxCoordinatorLayoutVersion : '1.3.0'
55
androidxJunitVersion = project.hasProperty('androidxJunitVersion') ? rootProject.ext.androidxJunitVersion : '1.2.1'
66
androidxEspressoCoreVersion = project.hasProperty('androidxEspressoCoreVersion') ? rootProject.ext.androidxEspressoCoreVersion : '3.6.1'
77
playServicesAdsVersion = project.hasProperty('playServicesAdsVersion') ? rootProject.ext.playServicesAdsVersion : '24.4.+'
88
userMessagingPlatformVersion = project.hasProperty('userMessagingPlatformVersion') ? rootProject.ext.playServicesAdsVersion : '3.1.0'
9-
androidxCoreKTXVersion = project.hasProperty('androidxCoreKTXVersion') ? rootProject.ext.androidxCoreKTXVersion : '1.13.0'
9+
androidxCoreKTXVersion = project.hasProperty('androidxCoreKTXVersion') ? rootProject.ext.androidxCoreKTXVersion : '1.17.0'
1010
}
1111

1212
buildscript {
13-
ext.kotlin_version = project.hasProperty("kotlin_version") ? rootProject.ext.kotlin_version : '2.1.0'
13+
ext.kotlin_version = project.hasProperty("kotlin_version") ? rootProject.ext.kotlin_version : '2.1.20'
1414
repositories {
1515
google()
1616
mavenCentral()
@@ -58,7 +58,7 @@ repositories {
5858

5959
}
6060

61-
def testRunner = "1.4.0"
61+
def testRunner = "1.7.0"
6262

6363
dependencies {
6464
implementation fileTree(dir: 'libs', include: ['*.jar'])

android/src/test/java/com/getcapacitor/community/admob/banner/BannerExecutorTest.java

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,14 @@
1414
import android.content.Context;
1515
import android.content.res.Resources;
1616
import android.util.DisplayMetrics;
17+
import android.view.Display;
1718
import android.view.ViewGroup;
19+
import android.view.Window;
20+
import android.view.WindowManager;
1821
import android.widget.RelativeLayout;
1922
import androidx.coordinatorlayout.widget.CoordinatorLayout;
2023
import com.getcapacitor.JSObject;
2124
import com.getcapacitor.PluginCall;
22-
import com.getcapacitor.community.admob.banner.BannerExecutor;
2325
import com.getcapacitor.community.admob.helpers.AdViewIdHelper;
2426
import com.getcapacitor.community.admob.helpers.RequestHelper;
2527
import com.getcapacitor.community.admob.models.AdOptions;
@@ -50,9 +52,21 @@ class BannerExecutorTest {
5052
@Mock(lenient = true)
5153
Context contextMock;
5254

53-
@Mock
55+
@Mock(lenient = true)
5456
Activity activityMock;
5557

58+
@Mock(lenient = true)
59+
Window windowMock;
60+
61+
@Mock(lenient = true)
62+
WindowManager windowManagerMock;
63+
64+
@Mock(lenient = true)
65+
Display displayMock;
66+
67+
@Mock(lenient = true)
68+
WindowManager.LayoutParams attributesMock;
69+
5670
@Mock
5771
BiConsumer<String, JSObject> notifierMock;
5872

@@ -68,9 +82,17 @@ class BannerExecutorTest {
6882
@BeforeEach
6983
void beforeEach() {
7084
AdSizeStaticMock = Mockito.mockStatic(AdSize.class);
71-
reset(contextMock, activityMock, notifierMock);
85+
reset(contextMock, activityMock, notifierMock, windowMock, windowManagerMock, displayMock, attributesMock);
7286
adViewMockedConstruction = Mockito.mockConstruction(AdView.class, (mock, context) -> {});
7387

88+
when(activityMock.getWindowManager()).thenReturn(windowManagerMock);
89+
when(activityMock.getWindow()).thenReturn(windowMock);
90+
91+
when(windowMock.getDecorView()).thenReturn(viewGroupMock);
92+
93+
when(windowManagerMock.getDefaultDisplay()).thenReturn(displayMock);
94+
when(windowMock.getAttributes()).thenReturn(attributesMock);
95+
7496
when(activityMock.findViewById(anyInt())).thenReturn(viewGroupMock);
7597
when(viewGroupMock.getChildAt(anyInt())).thenReturn(viewGroupMock);
7698

android/src/test/java/com/getcapacitor/community/admob/interstitial/AdInterstitialExecutorTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,8 +182,8 @@ class ShowInterstitial {
182182
@Mock
183183
PluginCall pluginCallMock;
184184

185-
@AfterEach
186-
void afterEach() {
185+
@BeforeEach
186+
void beforeEach() {
187187
AdInterstitialExecutor.interstitialAd = null;
188188
}
189189

android/src/test/java/com/getcapacitor/community/admob/interstitial/InterstitialAdStub.kt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ import com.google.android.gms.ads.interstitial.InterstitialAd
88

99
internal class InterstitialAdStub: InterstitialAd() {
1010

11-
private var fullScreenContentCallback: FullScreenContentCallback? = null
11+
private var immersiveMode = false;
12+
private var fullScreenContentCallback: FullScreenContentCallback? = null
1213

1314
override fun getAdUnitId(): String {
1415
return "adUnit"
@@ -27,7 +28,7 @@ internal class InterstitialAdStub: InterstitialAd() {
2728
}
2829

2930
override fun setImmersiveMode(p0: Boolean) {
30-
TODO("Not yet implemented")
31+
immersiveMode = p0
3132
}
3233

3334
override fun getResponseInfo(): ResponseInfo {

android/src/test/java/com/getcapacitor/community/admob/rewarded/AdRewardExecutorTest.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,6 @@ class ShowRewardVideoAd {
6161
@BeforeEach
6262
void beforeEach() {
6363
runnableArgumentCaptor = ArgumentCaptor.forClass(Runnable.class);
64-
}
65-
66-
@AfterEach
67-
void afterEach() {
6864
AdRewardExecutor.mRewardedAd = null;
6965
}
7066

0 commit comments

Comments
 (0)