diff --git a/build.gradle b/build.gradle index 0918e16927..fc30a9ebf3 100644 --- a/build.gradle +++ b/build.gradle @@ -3,6 +3,7 @@ buildscript { google() jcenter() } + ext.kotlin_version = '1.2.30' dependencies { classpath 'com.android.tools.build:gradle:3.0.1' @@ -10,6 +11,7 @@ buildscript { classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.0' classpath 'org.kt3k.gradle.plugin:coveralls-gradle-plugin:2.8.2' classpath 'com.getkeepsafe.dexcount:dexcount-gradle-plugin:0.8.2' + classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" } } repositories { diff --git a/example/build.gradle b/example/build.gradle index fa0b827430..3cf0ec0d0f 100644 --- a/example/build.gradle +++ b/example/build.gradle @@ -6,7 +6,6 @@ buildscript { } dependencies { classpath 'com.bugsnag:bugsnag-android-gradle-plugin:3.1.0' - classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$project.KOTLIN_VERSION" } } @@ -90,7 +89,7 @@ dependencies { implementation project(":sdk") implementation "com.android.support:appcompat-v7:$supportLibVersion" implementation "com.android.support:support-v4:$supportLibVersion" - kotlinExampleImplementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:$project.KOTLIN_VERSION" + kotlinExampleImplementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version" androidTestImplementation "com.android.support.test:runner:$supportTestVersion", { exclude group: 'com.android.support', module: 'support-annotations' diff --git a/mazerunner/build.gradle b/mazerunner/build.gradle index e02c01a1f9..467ab41c20 100644 --- a/mazerunner/build.gradle +++ b/mazerunner/build.gradle @@ -3,16 +3,6 @@ repositories { jcenter() } -buildscript { - repositories { - google() - jcenter() - } - dependencies { - classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$project.KOTLIN_VERSION" - } -} - apply plugin: 'com.android.application' apply plugin: 'kotlin-android' diff --git a/sdk/build.gradle b/sdk/build.gradle index b34f01dab6..896a898ce2 100644 --- a/sdk/build.gradle +++ b/sdk/build.gradle @@ -3,6 +3,7 @@ apply plugin: 'com.getkeepsafe.dexcount' apply plugin: 'maven-publish' apply plugin: 'com.jfrog.bintray' apply plugin: 'com.github.kt3k.coveralls' +apply plugin: 'kotlin-android' repositories { google() @@ -42,6 +43,9 @@ coveralls { } dependencies { api "com.android.support:support-annotations:$supportLibVersion" + + androidTestImplementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version" + testImplementation "junit:junit:$junitVersion" testImplementation "org.mockito:mockito-core:$mockitoVersion" @@ -166,3 +170,4 @@ dexcount { orderByMethodCount = true verbose true } + diff --git a/sdk/src/androidTest/java/com/bugsnag/android/BeforeNotifyTest.java b/sdk/src/androidTest/java/com/bugsnag/android/BeforeNotifyTest.java deleted file mode 100644 index 678eeda194..0000000000 --- a/sdk/src/androidTest/java/com/bugsnag/android/BeforeNotifyTest.java +++ /dev/null @@ -1,54 +0,0 @@ -package com.bugsnag.android; - -import static org.junit.Assert.assertEquals; - -import android.support.test.filters.SmallTest; -import android.support.test.runner.AndroidJUnit4; - -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; - -@RunWith(AndroidJUnit4.class) -@SmallTest -public class BeforeNotifyTest { - - private BeforeNotify beforeNotify = new BeforeNotify() { - @Override - public boolean run(Error error) { - return true; - } - }; - - private BeforeNotify beforeNotifySkip = new BeforeNotify() { - @Override - public boolean run(Error error) { - return false; - } - }; - - private Configuration config; - - @Before - public void setUp() throws Exception { - config = new Configuration("api-key"); - } - - @Test - public void testRunModifiesError() { - final String context = "new-context"; - - BeforeNotify beforeNotify = new BeforeNotify() { - @Override - public boolean run(Error error) { - error.setContext(context); - return false; - } - }; - - Error error = new Error.Builder(config, new RuntimeException("Test"), null).build(); - beforeNotify.run(error); - - assertEquals(context, error.getContext()); - } -} diff --git a/sdk/src/androidTest/java/com/bugsnag/android/BeforeNotifyTest.kt b/sdk/src/androidTest/java/com/bugsnag/android/BeforeNotifyTest.kt new file mode 100644 index 0000000000..2a2a82c646 --- /dev/null +++ b/sdk/src/androidTest/java/com/bugsnag/android/BeforeNotifyTest.kt @@ -0,0 +1,30 @@ +package com.bugsnag.android + +import org.junit.Assert.assertEquals + +import android.support.test.filters.SmallTest +import android.support.test.runner.AndroidJUnit4 + +import org.junit.Test +import org.junit.runner.RunWith + +@RunWith(AndroidJUnit4::class) +@SmallTest +class BeforeNotifyTest { + + private val config = Configuration("api-key") + + @Test + fun testRunModifiesError() { + val context = "new-context" + + val beforeNotify = BeforeNotify { + it.context = context + false + } + + val error = Error.Builder(config, RuntimeException("Test"), null).build() + beforeNotify.run(error) + assertEquals(context, error.context) + } +}