aboutsummaryrefslogtreecommitdiff
path: root/plugins/kotlin-as-java
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/kotlin-as-java')
-rw-r--r--plugins/kotlin-as-java/build.gradle.kts3
-rw-r--r--plugins/kotlin-as-java/src/test/kotlin/CompanionAsJavaTest.kt8
-rw-r--r--plugins/kotlin-as-java/src/test/kotlin/DRITranslationTest.kt4
-rw-r--r--plugins/kotlin-as-java/src/test/kotlin/JvmFieldTest.kt6
-rw-r--r--plugins/kotlin-as-java/src/test/kotlin/JvmNameTest.kt4
-rw-r--r--plugins/kotlin-as-java/src/test/kotlin/JvmOverloadsTest.kt4
-rw-r--r--plugins/kotlin-as-java/src/test/kotlin/JvmSyntheticTest.kt4
-rw-r--r--plugins/kotlin-as-java/src/test/kotlin/KotlinAsJavaPluginTest.kt35
-rw-r--r--plugins/kotlin-as-java/src/test/kotlin/KotlinAsJavaSignatureTest.kt2
9 files changed, 29 insertions, 41 deletions
diff --git a/plugins/kotlin-as-java/build.gradle.kts b/plugins/kotlin-as-java/build.gradle.kts
index 2132be86..d168f298 100644
--- a/plugins/kotlin-as-java/build.gradle.kts
+++ b/plugins/kotlin-as-java/build.gradle.kts
@@ -13,13 +13,12 @@ dependencies {
implementation(kotlin("reflect"))
+ testImplementation(kotlin("test"))
testImplementation(libs.jsoup)
testImplementation(projects.plugins.base)
testImplementation(projects.plugins.base.baseTestUtils)
testImplementation(projects.core.contentMatcherTestUtils)
testImplementation(projects.core.testApi)
- testImplementation(platform(libs.junit.bom))
- testImplementation(libs.junit.jupiter)
}
registerDokkaArtifactPublication("kotlinAsJavaPlugin") {
diff --git a/plugins/kotlin-as-java/src/test/kotlin/CompanionAsJavaTest.kt b/plugins/kotlin-as-java/src/test/kotlin/CompanionAsJavaTest.kt
index 3b2a8e89..ecfb7f20 100644
--- a/plugins/kotlin-as-java/src/test/kotlin/CompanionAsJavaTest.kt
+++ b/plugins/kotlin-as-java/src/test/kotlin/CompanionAsJavaTest.kt
@@ -2,11 +2,7 @@ package kotlinAsJavaPlugin
import org.jetbrains.dokka.base.testApi.testRunner.BaseAbstractTest
import org.jetbrains.dokka.model.*
-import org.junit.jupiter.api.Test
-import kotlin.test.assertEquals
-import kotlin.test.assertNotNull
-import kotlin.test.assertNull
-import kotlin.test.assertTrue
+import kotlin.test.*
private const val COMPANION_NAME = "C"
@@ -545,4 +541,4 @@ private fun assertIsStatic(function: DFunction) {
extra.content.values.contains(setOf(ExtraModifiers.JavaOnlyModifiers.Static)),
"Function contains extra modifier static"
)
-} \ No newline at end of file
+}
diff --git a/plugins/kotlin-as-java/src/test/kotlin/DRITranslationTest.kt b/plugins/kotlin-as-java/src/test/kotlin/DRITranslationTest.kt
index 257b17ff..e3a1a724 100644
--- a/plugins/kotlin-as-java/src/test/kotlin/DRITranslationTest.kt
+++ b/plugins/kotlin-as-java/src/test/kotlin/DRITranslationTest.kt
@@ -4,8 +4,8 @@ package kotlinAsJavaPlugin
import org.jetbrains.dokka.base.testApi.testRunner.BaseAbstractTest
import org.jetbrains.dokka.model.DClass
import org.jetbrains.dokka.model.DEnum
-import org.junit.jupiter.api.Assertions.assertTrue
-import org.junit.jupiter.api.Test
+import kotlin.test.Test
+import kotlin.test.assertTrue
class DRITranslationTest : BaseAbstractTest() {
val configuration = dokkaConfiguration {
diff --git a/plugins/kotlin-as-java/src/test/kotlin/JvmFieldTest.kt b/plugins/kotlin-as-java/src/test/kotlin/JvmFieldTest.kt
index f0c44530..ccdd5008 100644
--- a/plugins/kotlin-as-java/src/test/kotlin/JvmFieldTest.kt
+++ b/plugins/kotlin-as-java/src/test/kotlin/JvmFieldTest.kt
@@ -4,11 +4,7 @@ import org.jetbrains.dokka.base.testApi.testRunner.BaseAbstractTest
import org.jetbrains.dokka.model.AdditionalModifiers
import org.jetbrains.dokka.model.ExtraModifiers
import org.jetbrains.dokka.model.JavaVisibility
-import org.junit.jupiter.api.Test
-import kotlin.test.assertEquals
-import kotlin.test.assertNotNull
-import kotlin.test.assertNull
-import kotlin.test.assertTrue
+import kotlin.test.*
class JvmFieldTest : BaseAbstractTest() {
val configuration = dokkaConfiguration {
diff --git a/plugins/kotlin-as-java/src/test/kotlin/JvmNameTest.kt b/plugins/kotlin-as-java/src/test/kotlin/JvmNameTest.kt
index 1da2316c..448ca26b 100644
--- a/plugins/kotlin-as-java/src/test/kotlin/JvmNameTest.kt
+++ b/plugins/kotlin-as-java/src/test/kotlin/JvmNameTest.kt
@@ -7,7 +7,7 @@ import org.jetbrains.dokka.links.TypeConstructor
import org.jetbrains.dokka.model.Annotations
import org.jetbrains.dokka.model.DClass
import org.jetbrains.dokka.model.isJvmName
-import org.junit.jupiter.api.Test
+import kotlin.test.Test
import kotlin.test.assertEquals
import kotlin.test.assertNull
@@ -183,4 +183,4 @@ class JvmNameTest : BaseAbstractTest() {
}
}
}
-} \ No newline at end of file
+}
diff --git a/plugins/kotlin-as-java/src/test/kotlin/JvmOverloadsTest.kt b/plugins/kotlin-as-java/src/test/kotlin/JvmOverloadsTest.kt
index 79619215..1db35b8f 100644
--- a/plugins/kotlin-as-java/src/test/kotlin/JvmOverloadsTest.kt
+++ b/plugins/kotlin-as-java/src/test/kotlin/JvmOverloadsTest.kt
@@ -1,7 +1,7 @@
package kotlinAsJavaPlugin
import org.jetbrains.dokka.base.testApi.testRunner.BaseAbstractTest
-import org.junit.jupiter.api.Test
+import kotlin.test.Test
import kotlin.test.assertEquals
class JvmOverloadsTest : BaseAbstractTest() {
@@ -53,4 +53,4 @@ class JvmOverloadsTest : BaseAbstractTest() {
}
}
}
-} \ No newline at end of file
+}
diff --git a/plugins/kotlin-as-java/src/test/kotlin/JvmSyntheticTest.kt b/plugins/kotlin-as-java/src/test/kotlin/JvmSyntheticTest.kt
index fa49c3d0..387a29bf 100644
--- a/plugins/kotlin-as-java/src/test/kotlin/JvmSyntheticTest.kt
+++ b/plugins/kotlin-as-java/src/test/kotlin/JvmSyntheticTest.kt
@@ -1,7 +1,7 @@
package kotlinAsJavaPlugin
import org.jetbrains.dokka.base.testApi.testRunner.BaseAbstractTest
-import org.junit.jupiter.api.Test
+import kotlin.test.Test
import kotlin.test.assertEquals
class JvmSyntheticTest : BaseAbstractTest() {
@@ -64,4 +64,4 @@ class JvmSyntheticTest : BaseAbstractTest() {
}
}
}
-} \ No newline at end of file
+}
diff --git a/plugins/kotlin-as-java/src/test/kotlin/KotlinAsJavaPluginTest.kt b/plugins/kotlin-as-java/src/test/kotlin/KotlinAsJavaPluginTest.kt
index ab11120a..0c44f31c 100644
--- a/plugins/kotlin-as-java/src/test/kotlin/KotlinAsJavaPluginTest.kt
+++ b/plugins/kotlin-as-java/src/test/kotlin/KotlinAsJavaPluginTest.kt
@@ -9,9 +9,6 @@ import org.jetbrains.dokka.model.Annotations
import org.jetbrains.dokka.model.GenericTypeConstructor
import org.jetbrains.dokka.model.dfs
import org.jetbrains.dokka.pages.*
-import org.junit.Assert
-import org.junit.jupiter.api.Assertions
-import org.junit.jupiter.api.Test
import signatures.Parameter
import signatures.Parameters
import signatures.firstSignature
@@ -19,8 +16,7 @@ import signatures.renderedContent
import utils.A
import utils.TestOutputWriterPlugin
import utils.match
-import kotlin.test.assertEquals
-import kotlin.test.assertNotNull
+import kotlin.test.*
class KotlinAsJavaPluginTest : BaseAbstractTest() {
@@ -141,21 +137,22 @@ class KotlinAsJavaPluginTest : BaseAbstractTest() {
classes["TestKt"].let {
it?.children.orEmpty().assertCount(1, "(Kotlin) TestKt members: ")
it!!.children.first()
- .let { assert(it.name == "testF") { "(Kotlin) Expected method name: testF, got: ${it.name}" } }
+ .let { assertEquals("testF", it.name, "(Kotlin) Expected method name: testF, got: ${it.name}") }
}
classes["TestJ"].let {
it?.children.orEmpty().assertCount(2, "(Java) TestJ members: ") // constructor + method
it!!.children.map { it.name }
.let {
- assert(
+ assertTrue(
it.containsAll(
setOf(
"testF",
"TestJ"
)
- )
- ) { "(Java) Expected method name: testF, got: $it" }
+ ),
+ "(Java) Expected method name: testF, got: $it"
+ )
}
}
}
@@ -185,8 +182,8 @@ class KotlinAsJavaPluginTest : BaseAbstractTest() {
) {
pagesTransformationStage = { rootPageNode ->
val propertyGetter = rootPageNode.dfs { it is MemberPageNode && it.name == "getPublicProperty" } as? MemberPageNode
- assert(propertyGetter != null)
- propertyGetter!!.content.assertNode {
+ assertNotNull(propertyGetter)
+ propertyGetter.content.assertNode {
group {
header(1) {
+"getPublicProperty"
@@ -238,8 +235,8 @@ class KotlinAsJavaPluginTest : BaseAbstractTest() {
) {
pagesGenerationStage = { root ->
val testClass = root.dfs { it.name == "TestJ" } as? ClasslikePageNode
- assert(testClass != null)
- (testClass!!.content as ContentGroup).children.last().children.last().assertNode {
+ assertNotNull(testClass)
+ (testClass.content as ContentGroup).children.last().children.last().assertNode {
group {
header(2){
+"Properties"
@@ -294,8 +291,8 @@ class KotlinAsJavaPluginTest : BaseAbstractTest() {
) {
pagesGenerationStage = { root ->
val testClass = root.dfs { it.name == "C" } as? ClasslikePageNode
- assert(testClass != null)
- testClass!!.content.assertNode {
+ assertNotNull(testClass)
+ testClass.content.assertNode {
group {
header(expectedLevel = 1) {
+"C"
@@ -328,7 +325,7 @@ class KotlinAsJavaPluginTest : BaseAbstractTest() {
}
private fun <T> Collection<T>.assertCount(n: Int, prefix: String = "") =
- assert(count() == n) { "${prefix}Expected $n, got ${count()}" }
+ assertEquals(n, count(), "${prefix}Expected $n, got ${count()}")
@Test
fun `typealias`() {
@@ -430,7 +427,7 @@ class KotlinAsJavaPluginTest : BaseAbstractTest() {
cleanupOutput = true
) {
renderingStage = { _, _ ->
- Assert.assertNull(writerPlugin.writer.contents["root/kotlinAsJavaPlugin/-test-kt/get-f-i-r-s-t.html"])
+ assertNull(writerPlugin.writer.contents["root/kotlinAsJavaPlugin/-test-kt/get-f-i-r-s-t.html"])
}
}
}
@@ -553,12 +550,12 @@ class KotlinAsJavaPluginTest : BaseAbstractTest() {
.classlikes.first { it.name == "TestKt" }
.functions.single()
.type as GenericTypeConstructor
- Assertions.assertEquals(
+ assertEquals(
Annotations.Annotation(DRI("kotlinAsJavaPlugin", "Hello"), emptyMap()),
type.extra[Annotations]?.directAnnotations?.values?.single()?.single()
)
// A bug; the GenericTypeConstructor cast should fail and this should be a PrimitiveJavaType
- Assertions.assertEquals("java.lang/Integer///PointingToDeclaration/", type.dri.toString())
+ assertEquals("java.lang/Integer///PointingToDeclaration/", type.dri.toString())
}
}
}
diff --git a/plugins/kotlin-as-java/src/test/kotlin/KotlinAsJavaSignatureTest.kt b/plugins/kotlin-as-java/src/test/kotlin/KotlinAsJavaSignatureTest.kt
index 46e71d87..3b778744 100644
--- a/plugins/kotlin-as-java/src/test/kotlin/KotlinAsJavaSignatureTest.kt
+++ b/plugins/kotlin-as-java/src/test/kotlin/KotlinAsJavaSignatureTest.kt
@@ -3,11 +3,11 @@ package kotlinAsJavaPlugin
import org.jetbrains.dokka.DokkaConfiguration
import org.jetbrains.dokka.base.testApi.testRunner.BaseAbstractTest
import org.jetbrains.dokka.jdk
-import org.junit.jupiter.api.Test
import signatures.firstSignature
import signatures.renderedContent
import signatures.signature
import utils.*
+import kotlin.test.Test
class KotlinAsJavaSignatureTest : BaseAbstractTest() {