Skip to content
This repository was archived by the owner on Aug 30, 2023. It is now read-only.
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
3 changes: 2 additions & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ buildscript {
google()
}
dependencies {
classpath("com.android.tools.build:gradle:3.1.3")
classpath("com.android.tools.build:gradle:3.4.1")
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.50")
}
}

Expand Down
9 changes: 7 additions & 2 deletions sentry-android/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,20 +1,25 @@
plugins {
id("com.android.library")
id("kotlin-android")
jacoco
}

dependencies {
api(project(":sentry-core"))
testImplementation("org.robolectric:robolectric:4.3")
testImplementation(kotlin("stdlib"))
testImplementation(kotlin("stdlib-jdk8"))
testImplementation("org.jetbrains.kotlin:kotlin-test-junit:1.3.50")
testImplementation("junit:junit:4.12")
testImplementation("androidx.test:core:1.2.0")
testImplementation("androidx.test:runner:1.2.0")
testImplementation("androidx.test.ext:junit:1.1.1")
}

android {
compileSdkVersion(29)
buildToolsVersion("29.0.2")
defaultConfig {
minSdkVersion(14)
targetSdkVersion(29)
javaCompileOptions {
annotationProcessorOptions {
includeCompileClasspath = true
Expand Down
22 changes: 0 additions & 22 deletions sentry-android/src/test/java/io/sentry/android/AndroidTest.kt

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package io.sentry.android

import android.app.Application

// so far not needed
class ApplicationStub : Application()
Original file line number Diff line number Diff line change
@@ -1,20 +1,31 @@
package io.sentry.android

import android.content.Context
import android.content.pm.ProviderInfo
import androidx.test.core.app.ApplicationProvider
import androidx.test.ext.junit.runners.AndroidJUnit4
import io.sentry.Sentry
import org.junit.runner.RunWith
import kotlin.test.BeforeTest
import kotlin.test.Test

class SentryInitProviderTest : AndroidTest() {
@RunWith(AndroidJUnit4::class)
class SentryInitProviderTest {
private var sentryInitProvider: SentryInitProvider = SentryInitProvider()

private lateinit var context: Context

@BeforeTest
fun `set up`() {
context = ApplicationProvider.getApplicationContext()
}

@Test
fun MissingApplicationIdThrows() {
// fun `missing applicationId throws`() {
fun `missing applicationId throws`() {
val providerInfo = ProviderInfo()
throw RuntimeException()

providerInfo.authority = "com.google.android.gms.tests.common.firebaseinitprovider"
sentryInitProvider.attachInfo(context(), providerInfo)
sentryInitProvider.attachInfo(context, providerInfo)

Sentry.init { o -> o.dsn = "test" }

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
sdk=21
application=io.sentry.android.ApplicationStub
5 changes: 2 additions & 3 deletions sentry-core/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
plugins {
java
kotlin("jvm") version "1.3.50"
kotlin("jvm")
jacoco
}

dependencies {
testImplementation(kotlin("stdlib"))
testImplementation("org.jetbrains.kotlin:kotlin-stdlib:1.3.50")
testImplementation(kotlin("stdlib-jdk8"))
testImplementation("org.jetbrains.kotlin:kotlin-test-junit:1.3.50")
}

Expand Down
4 changes: 3 additions & 1 deletion sentry-core/src/main/java/io/sentry/Sentry.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ public static void init(OptionsConfiguration optionsConfiguration) {
}

static synchronized void init(SentryOptions options) {
currentClient.close();
if (currentClient != null) {
currentClient.close();
}
currentClient = new SentryClient(options);
}

Expand Down