Skip to content

Commit

Permalink
test(geofence): use real context
Browse files Browse the repository at this point in the history
SUITEDEV-35237

Co-authored-by: davidSchuppa <[email protected]>
  • Loading branch information
megamegax and davidSchuppa committed Feb 27, 2024
1 parent 3e4087f commit acc36b9
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import android.content.pm.PackageManager
import android.location.Location
import android.location.LocationManager
import android.os.Build
import androidx.test.platform.app.InstrumentationRegistry.getInstrumentation
import com.emarsys.core.api.MissingPermissionException
import com.emarsys.core.concurrency.ConcurrentHandlerHolderFactory
import com.emarsys.core.handler.ConcurrentHandlerHolder
Expand Down Expand Up @@ -120,17 +121,17 @@ class DefaultGeofenceInternalTest : AnnotationSpec() {
)

mockContext = mock()
val context: Context = getInstrumentation().targetContext
whenever(mockContext.packageName).thenReturn(
"com.emarsys.mobileengage.test"
)
if (!AndroidVersionUtils.isBelow30) {
whenever(mockContext.attributionTag).thenReturn("tag")
}


val intent = Intent("com.emarsys.sdk.GEOFENCE_ACTION")
pendingIntent =
PendingIntent.getBroadcast(mockContext, 0, intent, PendingIntent.FLAG_IMMUTABLE)
PendingIntent.getBroadcast(context, 0, intent, PendingIntent.FLAG_IMMUTABLE)

mockPendingIntentProvider = mock()
whenever(mockPendingIntentProvider.providePendingIntent()).thenReturn(pendingIntent)
Expand Down

0 comments on commit acc36b9

Please sign in to comment.