Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Tests] Switch to kotest-extensions-android #2023

Merged
merged 1 commit into from
Mar 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Examples/OneSignalDemo/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ plugins {
android {
compileSdkVersion 33
defaultConfig {
minSdkVersion 19
minSdkVersion 21
targetSdkVersion 33
versionCode 1
versionName "1.0"
Expand Down Expand Up @@ -33,7 +33,7 @@ android {
}
huawei {
dimension "default"
minSdkVersion 19
minSdkVersion 21
applicationId "com.onesignal.sdktest"
}
}
Expand Down
2 changes: 1 addition & 1 deletion OneSignalSDK/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ buildscript {
buildVersions = [
compileSdkVersion: 34,
targetSdkVersion: 34,
minSdkVersion: 19
minSdkVersion: 21
]
androidGradlePluginVersion = '7.2.0'
googleServicesGradlePluginVersion = '4.3.10'
Expand Down
2 changes: 2 additions & 0 deletions OneSignalSDK/onesignal/core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@ dependencies {
testImplementation("io.kotest:kotest-assertions-core:$kotestVersion")
testImplementation("io.kotest:kotest-property:$kotestVersion")
testImplementation("org.robolectric:robolectric:4.8.1")
// kotest-extensions-android allows Robolectric to work with Kotest via @RobolectricTest
testImplementation("br.com.colman:kotest-extensions-android:0.1.1")
testImplementation("androidx.test:core-ktx:1.4.0")
testImplementation("androidx.test:core:1.4.0")
testImplementation("io.mockk:mockk:1.13.2")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ package com.onesignal.core.internal.application
import android.app.Activity
import android.content.Context
import androidx.test.core.app.ApplicationProvider
import br.com.colman.kotest.android.extensions.robolectric.RobolectricTest
import com.onesignal.common.threading.WaiterWithValue
import com.onesignal.common.threading.suspendifyOnThread
import com.onesignal.core.internal.application.impl.ApplicationService
import com.onesignal.debug.LogLevel
import com.onesignal.debug.internal.logging.Logging
import com.onesignal.testhelpers.extensions.RobolectricTest
import io.kotest.core.spec.style.FunSpec
import io.kotest.matchers.shouldBe
import io.mockk.spyk
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ package com.onesignal.core.internal.database

import android.content.ContentValues
import androidx.test.core.app.ApplicationProvider
import br.com.colman.kotest.android.extensions.robolectric.RobolectricTest
import com.onesignal.core.internal.database.impl.OSDatabase
import com.onesignal.core.internal.database.impl.OneSignalDbContract
import com.onesignal.debug.LogLevel
import com.onesignal.debug.internal.logging.Logging
import com.onesignal.session.internal.outcomes.impl.OutcomeTableProvider
import com.onesignal.testhelpers.extensions.RobolectricTest
import io.kotest.core.spec.style.FunSpec
import io.kotest.matchers.shouldBe
import io.mockk.mockk
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ package com.onesignal.core.internal.preferences

import android.content.Context
import androidx.test.core.app.ApplicationProvider
import br.com.colman.kotest.android.extensions.robolectric.RobolectricTest
import com.onesignal.core.internal.preferences.impl.PreferencesService
import com.onesignal.debug.LogLevel
import com.onesignal.debug.internal.logging.Logging
import com.onesignal.mocks.AndroidMockHelper
import com.onesignal.mocks.MockHelper
import com.onesignal.testhelpers.extensions.RobolectricTest
import io.kotest.assertions.throwables.shouldThrowUnit
import io.kotest.core.spec.style.FunSpec
import io.kotest.matchers.shouldBe
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.onesignal.selftest

import br.com.colman.kotest.android.extensions.robolectric.RobolectricTest
import com.onesignal.common.toMap
import com.onesignal.testhelpers.extensions.RobolectricTest
import io.kotest.core.spec.style.FunSpec
import io.kotest.core.spec.style.funSpec
import io.kotest.matchers.shouldBe
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.onesignal.session.internal.outcomes

import br.com.colman.kotest.android.extensions.robolectric.RobolectricTest
import com.onesignal.debug.LogLevel
import com.onesignal.debug.internal.logging.Logging
import com.onesignal.mocks.DatabaseMockHelper
Expand All @@ -12,7 +13,6 @@ import com.onesignal.session.internal.outcomes.impl.OutcomeEventsRepository
import com.onesignal.session.internal.outcomes.impl.OutcomeEventsTable
import com.onesignal.session.internal.outcomes.impl.OutcomeSource
import com.onesignal.session.internal.outcomes.impl.OutcomeSourceBody
import com.onesignal.testhelpers.extensions.RobolectricTest
import io.kotest.core.spec.style.FunSpec
import io.kotest.matchers.shouldBe
import io.kotest.matchers.shouldNotBe
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package com.onesignal.user.internal.operations

import br.com.colman.kotest.android.extensions.robolectric.RobolectricTest
import com.onesignal.common.exceptions.BackendException
import com.onesignal.core.internal.operations.ExecutionResponse
import com.onesignal.core.internal.operations.ExecutionResult
import com.onesignal.core.internal.operations.Operation
import com.onesignal.mocks.AndroidMockHelper
import com.onesignal.mocks.MockHelper
import com.onesignal.testhelpers.extensions.RobolectricTest
import com.onesignal.user.internal.backend.CreateUserResponse
import com.onesignal.user.internal.backend.IUserBackendService
import com.onesignal.user.internal.backend.IdentityConstants
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package com.onesignal.user.internal.operations

import br.com.colman.kotest.android.extensions.robolectric.RobolectricTest
import com.onesignal.common.exceptions.BackendException
import com.onesignal.core.internal.operations.ExecutionResult
import com.onesignal.core.internal.operations.Operation
import com.onesignal.mocks.AndroidMockHelper
import com.onesignal.mocks.MockHelper
import com.onesignal.testhelpers.extensions.RobolectricTest
import com.onesignal.user.internal.backend.ISubscriptionBackendService
import com.onesignal.user.internal.backend.IdentityConstants
import com.onesignal.user.internal.backend.SubscriptionObjectType
Expand Down
2 changes: 2 additions & 0 deletions OneSignalSDK/onesignal/in-app-messages/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@ dependencies {
testImplementation("io.kotest:kotest-assertions-core:$kotestVersion")
testImplementation("io.kotest:kotest-property:$kotestVersion")
testImplementation("org.robolectric:robolectric:4.8.1")
// kotest-extensions-android allows Robolectric to work with Kotest via @RobolectricTest
testImplementation("br.com.colman:kotest-extensions-android:0.1.1")
testImplementation("androidx.test:core-ktx:1.4.0")
testImplementation("androidx.test:core:1.4.0")
testImplementation("io.mockk:mockk:1.13.2")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.onesignal.inAppMessages.internal.preview

import android.app.Activity
import br.com.colman.kotest.android.extensions.robolectric.RobolectricTest
import com.onesignal.debug.LogLevel
import com.onesignal.debug.internal.logging.Logging
import com.onesignal.inAppMessages.internal.display.IInAppDisplayer
Expand All @@ -9,7 +10,6 @@ import com.onesignal.mocks.MockHelper
import com.onesignal.notifications.internal.INotificationActivityOpener
import com.onesignal.notifications.internal.display.INotificationDisplayer
import com.onesignal.notifications.internal.lifecycle.INotificationLifecycleService
import com.onesignal.testhelpers.extensions.RobolectricTest
import io.kotest.core.spec.style.FunSpec
import io.kotest.matchers.shouldBe
import io.mockk.coEvery
Expand Down
2 changes: 2 additions & 0 deletions OneSignalSDK/onesignal/location/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ dependencies {
testImplementation("io.kotest:kotest-assertions-core:$kotestVersion")
testImplementation("io.kotest:kotest-property:$kotestVersion")
testImplementation("org.robolectric:robolectric:4.8.1")
// kotest-extensions-android allows Robolectric to work with Kotest via @RobolectricTest
testImplementation("br.com.colman:kotest-extensions-android:0.1.1")
testImplementation("androidx.test:core-ktx:1.4.0")
testImplementation("androidx.test:core:1.4.0")
testImplementation("io.mockk:mockk:1.13.2")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package com.onesignal.location.internal.background
import android.Manifest
import android.app.Application
import androidx.test.core.app.ApplicationProvider
import br.com.colman.kotest.android.extensions.robolectric.RobolectricTest
import com.onesignal.debug.LogLevel
import com.onesignal.debug.internal.logging.Logging
import com.onesignal.location.ILocationManager
Expand All @@ -11,7 +12,6 @@ import com.onesignal.location.internal.common.LocationConstants
import com.onesignal.location.internal.preferences.ILocationPreferencesService
import com.onesignal.mocks.AndroidMockHelper
import com.onesignal.mocks.MockHelper
import com.onesignal.testhelpers.extensions.RobolectricTest
import io.kotest.core.spec.style.FunSpec
import io.kotest.matchers.shouldBe
import io.mockk.every
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
package com.onesignal.location.internal.controller

import android.location.Location
import br.com.colman.kotest.android.extensions.robolectric.RobolectricTest
import com.onesignal.debug.LogLevel
import com.onesignal.debug.internal.logging.Logging
import com.onesignal.location.internal.controller.impl.GmsLocationController
import com.onesignal.location.mocks.FusedLocationApiWrapperMock
import com.onesignal.location.shadows.ShadowGoogleApiClient
import com.onesignal.location.shadows.ShadowGoogleApiClientBuilder
import com.onesignal.mocks.AndroidMockHelper
import com.onesignal.testhelpers.extensions.RobolectricTest
import io.kotest.core.spec.style.FunSpec
import io.kotest.matchers.shouldBe
import io.kotest.matchers.shouldNotBe
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package com.onesignal.location.internal.permissions

import br.com.colman.kotest.android.extensions.robolectric.RobolectricTest
import com.onesignal.core.internal.permissions.IRequestPermissionService
import com.onesignal.debug.LogLevel
import com.onesignal.debug.internal.logging.Logging
import com.onesignal.mocks.AndroidMockHelper
import com.onesignal.testhelpers.extensions.RobolectricTest
import io.kotest.core.spec.style.FunSpec
import io.kotest.matchers.longs.shouldBeGreaterThan
import io.kotest.matchers.shouldBe
Expand Down
2 changes: 2 additions & 0 deletions OneSignalSDK/onesignal/notifications/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,8 @@ dependencies {
testImplementation("io.kotest:kotest-assertions-core:$kotestVersion")
testImplementation("io.kotest:kotest-property:$kotestVersion")
testImplementation("org.robolectric:robolectric:4.8.1")
// kotest-extensions-android allows Robolectric to work with Kotest via @RobolectricTest
testImplementation("br.com.colman:kotest-extensions-android:0.1.1")
testImplementation("androidx.test:core-ktx:1.4.0")
testImplementation("androidx.test:core:1.4.0")
testImplementation("io.mockk:mockk:1.13.2")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ import android.app.NotificationChannel
import android.app.NotificationManager
import android.content.Context
import androidx.test.core.app.ApplicationProvider
import br.com.colman.kotest.android.extensions.robolectric.RobolectricTest
import com.onesignal.debug.LogLevel
import com.onesignal.debug.internal.logging.Logging
import com.onesignal.mocks.AndroidMockHelper
import com.onesignal.mocks.MockHelper
import com.onesignal.notifications.internal.channels.impl.NotificationChannelManager
import com.onesignal.notifications.internal.common.NotificationGenerationJob
import com.onesignal.notifications.shadows.ShadowRoboNotificationManager
import com.onesignal.testhelpers.extensions.RobolectricTest
import io.kotest.core.spec.style.FunSpec
import io.kotest.matchers.shouldBe
import io.kotest.matchers.shouldNotBe
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package com.onesignal.notifications.internal.generation

import android.content.Context
import androidx.test.core.app.ApplicationProvider
import br.com.colman.kotest.android.extensions.robolectric.RobolectricTest
import com.onesignal.debug.LogLevel
import com.onesignal.debug.internal.logging.Logging
import com.onesignal.mocks.AndroidMockHelper
Expand All @@ -13,7 +14,6 @@ import com.onesignal.notifications.internal.display.INotificationDisplayer
import com.onesignal.notifications.internal.generation.impl.NotificationGenerationProcessor
import com.onesignal.notifications.internal.lifecycle.INotificationLifecycleService
import com.onesignal.notifications.internal.summary.INotificationSummaryManager
import com.onesignal.testhelpers.extensions.RobolectricTest
import io.kotest.core.spec.style.FunSpec
import io.kotest.matchers.shouldBe
import io.mockk.coEvery
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ import android.content.Context
import androidx.core.app.NotificationCompat
import androidx.core.app.NotificationManagerCompat
import androidx.test.core.app.ApplicationProvider
import br.com.colman.kotest.android.extensions.robolectric.RobolectricTest
import com.onesignal.debug.LogLevel
import com.onesignal.debug.internal.logging.Logging
import com.onesignal.mocks.AndroidMockHelper
import com.onesignal.notifications.internal.data.INotificationRepository
import com.onesignal.notifications.internal.limiting.impl.NotificationLimitManager
import com.onesignal.notifications.internal.summary.INotificationSummaryManager
import com.onesignal.testhelpers.extensions.RobolectricTest
import io.kotest.core.spec.style.FunSpec
import io.mockk.coEvery
import io.mockk.coVerify
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.onesignal.notifications.internal.summary

import br.com.colman.kotest.android.extensions.robolectric.RobolectricTest
import com.onesignal.debug.LogLevel
import com.onesignal.debug.internal.logging.Logging
import com.onesignal.mocks.AndroidMockHelper
Expand All @@ -9,7 +10,6 @@ import com.onesignal.notifications.internal.display.ISummaryNotificationDisplaye
import com.onesignal.notifications.internal.restoration.INotificationRestoreProcessor
import com.onesignal.notifications.internal.summary.impl.NotificationSummaryManager
import com.onesignal.notifications.shadows.ShadowRoboNotificationManager
import com.onesignal.testhelpers.extensions.RobolectricTest
import io.kotest.core.spec.style.FunSpec
import io.kotest.matchers.shouldBe
import io.mockk.coEvery
Expand Down
6 changes: 0 additions & 6 deletions OneSignalSDK/onesignal/testhelpers/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,8 @@ android {
dependencies {
implementation(project(':OneSignal:core'))

// Only use for RobolectricExtension.kt,
// to bridge Robolectric's JUnit4 usage to Kotest's Junit 5
implementation("junit:junit:4.13.2")

implementation("io.kotest:kotest-runner-junit5:$kotestVersion")
implementation("io.kotest:kotest-runner-junit5-jvm:$kotestVersion")
implementation("org.robolectric:robolectric:4.8.1")
implementation("org.jetbrains.kotlin:kotlin-reflect:$kotlinVersion")
implementation("io.mockk:mockk:1.13.2")
implementation("androidx.test:core-ktx:1.5.0")
}
Expand Down

This file was deleted.

Loading
Loading