Skip to content

Commit 5891571

Browse files
committed
Fix test discoverability and use different assert
1 parent 343fb68 commit 5891571

2 files changed

Lines changed: 8 additions & 9 deletions

File tree

plugin-build/build.gradle.kts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,9 @@ tasks.withType<Test>().named("test").configure {
116116
tasks.register<Test>("integrationTest").configure {
117117
group = "verification"
118118
description = "Runs the integration tests"
119+
testClassesDirs = sourceSets["test"].output.classesDirs
120+
classpath = sourceSets["test"].runtimeClasspath
121+
119122
// for some reason Gradle > 8.10 doesn't pick up the pluginUnderTestMetadata classpath, so we
120123
// need to add it manually
121124
classpath += layout.files(project.layout.buildDirectory.dir("pluginUnderTestMetadata"))

plugin-build/src/test/kotlin/io/sentry/android/gradle/tasks/SentryUploadAppArtifactTaskTest.kt

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@ import com.google.common.truth.Subject
55
import com.google.common.truth.Truth.assertAbout
66
import com.google.common.truth.Truth.assertThat
77
import kotlin.test.assertEquals
8+
import kotlin.test.assertFailsWith
89
import org.gradle.api.Project
910
import org.gradle.api.file.Directory
1011
import org.gradle.api.file.RegularFile
1112
import org.gradle.api.provider.Provider
1213
import org.gradle.api.tasks.TaskProvider
13-
import org.gradle.internal.impldep.org.junit.Assert.assertThrows
1414
import org.gradle.testfixtures.ProjectBuilder
1515
import org.junit.Rule
1616
import org.junit.Test
@@ -184,8 +184,7 @@ class SentryUploadAppArtifactTaskTest {
184184
it.bundle.set(nonExistentBundle)
185185
}
186186

187-
val exception =
188-
assertThrows(IllegalStateException::class.java) { task.get().computeCommandLineArgs() }
187+
val exception = assertFailsWith<IllegalStateException> { task.get().computeCommandLineArgs() }
189188

190189
assertThat(exception.message).startsWith("Bundle file does not exist:")
191190
}
@@ -200,8 +199,7 @@ class SentryUploadAppArtifactTaskTest {
200199
it.apk.set(nonExistentApkDir)
201200
}
202201

203-
val exception =
204-
assertThrows(IllegalStateException::class.java) { task.get().computeCommandLineArgs() }
202+
val exception = assertFailsWith<IllegalStateException> { task.get().computeCommandLineArgs() }
205203

206204
assertThat(exception.message).startsWith("APK directory does not exist:")
207205
}
@@ -218,8 +216,7 @@ class SentryUploadAppArtifactTaskTest {
218216
it.apk.set(emptyApkDir)
219217
}
220218

221-
val exception =
222-
assertThrows(IllegalStateException::class.java) { task.get().computeCommandLineArgs() }
219+
val exception = assertFailsWith<IllegalStateException> { task.get().computeCommandLineArgs() }
223220

224221
assertThat(exception.message).startsWith("No APK file exists in directory:")
225222
}
@@ -232,8 +229,7 @@ class SentryUploadAppArtifactTaskTest {
232229
it.cliExecutable.set("sentry-cli")
233230
}
234231

235-
val exception =
236-
assertThrows(IllegalStateException::class.java) { task.get().computeCommandLineArgs() }
232+
val exception = assertFailsWith<IllegalStateException> { task.get().computeCommandLineArgs() }
237233

238234
assertThat(exception.message).isEqualTo("No bundle or apk found")
239235
}

0 commit comments

Comments
 (0)