aboutsummaryrefslogtreecommitdiff
path: root/runners/gradle-plugin
diff options
context:
space:
mode:
authorIgnat Beresnev <ignat.beresnev@jetbrains.com>2023-08-30 15:58:46 +0200
committerGitHub <noreply@github.com>2023-08-30 15:58:46 +0200
commitc63ea36637ce956029fb15b1482c0683ecb8a587 (patch)
tree2b75a8a976b43530820e73dc60cce4b10d9fc005 /runners/gradle-plugin
parent0e00edc6fcd406fcf38673ef6a2f8f59e8374de2 (diff)
downloaddokka-c63ea36637ce956029fb15b1482c0683ecb8a587.tar.gz
dokka-c63ea36637ce956029fb15b1482c0683ecb8a587.tar.bz2
dokka-c63ea36637ce956029fb15b1482c0683ecb8a587.zip
Migrate to JUnit 5 and unify used test API (#3138)
Diffstat (limited to 'runners/gradle-plugin')
-rw-r--r--runners/gradle-plugin/build.gradle.kts1
-rw-r--r--runners/gradle-plugin/src/test/kotlin/org/jetbrains/dokka/gradle/ConfigureWithKotlinSourceSetGistTest.kt9
-rw-r--r--runners/gradle-plugin/src/test/kotlin/org/jetbrains/dokka/gradle/DokkaConfigurationSerializableTest.kt11
-rw-r--r--runners/gradle-plugin/src/test/kotlin/org/jetbrains/dokka/gradle/KotlinSourceSetGistTest.kt8
4 files changed, 13 insertions, 16 deletions
diff --git a/runners/gradle-plugin/build.gradle.kts b/runners/gradle-plugin/build.gradle.kts
index c7f34f55..f2401e6a 100644
--- a/runners/gradle-plugin/build.gradle.kts
+++ b/runners/gradle-plugin/build.gradle.kts
@@ -10,6 +10,7 @@ dependencies {
compileOnly(libs.gradlePlugin.kotlin)
compileOnly(libs.gradlePlugin.android)
+ testImplementation(kotlin("test"))
testImplementation(libs.gradlePlugin.kotlin)
testImplementation(libs.gradlePlugin.android)
}
diff --git a/runners/gradle-plugin/src/test/kotlin/org/jetbrains/dokka/gradle/ConfigureWithKotlinSourceSetGistTest.kt b/runners/gradle-plugin/src/test/kotlin/org/jetbrains/dokka/gradle/ConfigureWithKotlinSourceSetGistTest.kt
index 9594887c..f354159a 100644
--- a/runners/gradle-plugin/src/test/kotlin/org/jetbrains/dokka/gradle/ConfigureWithKotlinSourceSetGistTest.kt
+++ b/runners/gradle-plugin/src/test/kotlin/org/jetbrains/dokka/gradle/ConfigureWithKotlinSourceSetGistTest.kt
@@ -10,6 +10,7 @@ import org.jetbrains.kotlin.gradle.plugin.KotlinPlatformType
import kotlin.test.Test
import kotlin.test.assertEquals
import org.jetbrains.dokka.gradle.utils.withDependencies_
+import kotlin.test.assertTrue
class ConfigureWithKotlinSourceSetGistTest {
@Test
@@ -18,11 +19,11 @@ class ConfigureWithKotlinSourceSetGistTest {
val f1Jar = project.file("f1.jar")
val f2Jar = project.file("f2.jar")
- check(f1Jar.createNewFile())
- check(f2Jar.createNewFile())
+ assertTrue(f1Jar.createNewFile())
+ assertTrue(f2Jar.createNewFile())
val customSourceRoot = project.file("customSourceRoot")
- check(customSourceRoot.mkdirs())
+ assertTrue(customSourceRoot.mkdirs())
val gist = KotlinSourceSetGist(
name = "customName",
@@ -112,7 +113,7 @@ class ConfigureWithKotlinSourceSetGistTest {
)
val customSourceRoot = project.file("src/main/customRoot")
- check(customSourceRoot.mkdirs())
+ assertTrue(customSourceRoot.mkdirs())
mainSourceSet.kotlin.srcDir(customSourceRoot)
assertEquals(
diff --git a/runners/gradle-plugin/src/test/kotlin/org/jetbrains/dokka/gradle/DokkaConfigurationSerializableTest.kt b/runners/gradle-plugin/src/test/kotlin/org/jetbrains/dokka/gradle/DokkaConfigurationSerializableTest.kt
index b5230114..ed00c4b2 100644
--- a/runners/gradle-plugin/src/test/kotlin/org/jetbrains/dokka/gradle/DokkaConfigurationSerializableTest.kt
+++ b/runners/gradle-plugin/src/test/kotlin/org/jetbrains/dokka/gradle/DokkaConfigurationSerializableTest.kt
@@ -7,8 +7,7 @@ import org.jetbrains.dokka.PluginConfigurationImpl
import org.jetbrains.dokka.gradle.utils.create_
import org.jetbrains.dokka.gradle.utils.externalDocumentationLink_
import org.jetbrains.dokka.gradle.utils.withDependencies_
-import org.junit.Rule
-import org.junit.rules.TemporaryFolder
+import org.junit.jupiter.api.io.TempDir
import java.io.File
import java.io.ObjectInputStream
import java.io.ObjectOutputStream
@@ -16,14 +15,10 @@ import java.net.URL
import kotlin.test.Test
import kotlin.test.assertEquals
-@Suppress("UnstableApiUsage")
class DokkaConfigurationSerializableTest {
- @get:Rule
- val temporaryFolder = TemporaryFolder()
-
@Test
- fun `DokkaTask configuration write to file then parse`() {
+ fun `DokkaTask configuration write to file then parse`(@TempDir tempDirectory: File) {
val project = ProjectBuilder.builder().build()
project.plugins.apply("org.jetbrains.dokka")
val dokkaTask = project.tasks.withType<DokkaTask>().first()
@@ -66,7 +61,7 @@ class DokkaConfigurationSerializableTest {
}
val sourceConfiguration = dokkaTask.buildDokkaConfiguration()
- val configurationFile = temporaryFolder.root.resolve("config.bin")
+ val configurationFile = tempDirectory.resolve("config.bin")
ObjectOutputStream(configurationFile.outputStream()).use { stream ->
stream.writeObject(sourceConfiguration)
}
diff --git a/runners/gradle-plugin/src/test/kotlin/org/jetbrains/dokka/gradle/KotlinSourceSetGistTest.kt b/runners/gradle-plugin/src/test/kotlin/org/jetbrains/dokka/gradle/KotlinSourceSetGistTest.kt
index 88bef2b2..976bff77 100644
--- a/runners/gradle-plugin/src/test/kotlin/org/jetbrains/dokka/gradle/KotlinSourceSetGistTest.kt
+++ b/runners/gradle-plugin/src/test/kotlin/org/jetbrains/dokka/gradle/KotlinSourceSetGistTest.kt
@@ -145,10 +145,10 @@ class KotlinSourceSetGistTest {
)
/* Creating dependency files */
- check(implementationJar.createNewFile())
- check(compileOnlyJar.createNewFile())
- check(apiJar.createNewFile())
- check(runtimeOnlyJar.createNewFile())
+ assertTrue(implementationJar.createNewFile())
+ assertTrue(compileOnlyJar.createNewFile())
+ assertTrue(apiJar.createNewFile())
+ assertTrue(runtimeOnlyJar.createNewFile())
assertEquals(
setOf(implementationJar, compileOnlyJar, apiJar), mainSourceSetGist.classpath.get().files,