diff options
author | Ignat Beresnev <ignat.beresnev@jetbrains.com> | 2023-08-30 15:58:46 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-08-30 15:58:46 +0200 |
commit | c63ea36637ce956029fb15b1482c0683ecb8a587 (patch) | |
tree | 2b75a8a976b43530820e73dc60cce4b10d9fc005 /plugins/base/src/test/kotlin/content/annotations | |
parent | 0e00edc6fcd406fcf38673ef6a2f8f59e8374de2 (diff) | |
download | dokka-c63ea36637ce956029fb15b1482c0683ecb8a587.tar.gz dokka-c63ea36637ce956029fb15b1482c0683ecb8a587.tar.bz2 dokka-c63ea36637ce956029fb15b1482c0683ecb8a587.zip |
Migrate to JUnit 5 and unify used test API (#3138)
Diffstat (limited to 'plugins/base/src/test/kotlin/content/annotations')
4 files changed, 23 insertions, 20 deletions
diff --git a/plugins/base/src/test/kotlin/content/annotations/ContentForAnnotationsTest.kt b/plugins/base/src/test/kotlin/content/annotations/ContentForAnnotationsTest.kt index 82159e0d..582d2e19 100644 --- a/plugins/base/src/test/kotlin/content/annotations/ContentForAnnotationsTest.kt +++ b/plugins/base/src/test/kotlin/content/annotations/ContentForAnnotationsTest.kt @@ -9,8 +9,12 @@ import org.jetbrains.dokka.pages.ContentPage import org.jetbrains.dokka.pages.ContentText import org.jetbrains.dokka.pages.MemberPageNode import org.jetbrains.dokka.pages.PackagePageNode -import org.junit.jupiter.api.Test -import utils.* +import utils.ParamAttributes +import utils.assertNotNull +import utils.bareSignature +import utils.propertySignature +import utils.JavaCode +import kotlin.test.Test import kotlin.test.assertEquals import kotlin.test.assertTrue diff --git a/plugins/base/src/test/kotlin/content/annotations/JavaDeprecatedTest.kt b/plugins/base/src/test/kotlin/content/annotations/JavaDeprecatedTest.kt index c25c1a1b..95935d0e 100644 --- a/plugins/base/src/test/kotlin/content/annotations/JavaDeprecatedTest.kt +++ b/plugins/base/src/test/kotlin/content/annotations/JavaDeprecatedTest.kt @@ -8,11 +8,12 @@ import org.jetbrains.dokka.model.Documentable import org.jetbrains.dokka.model.properties.WithExtraProperties import org.jetbrains.dokka.pages.ContentPage import org.jetbrains.dokka.pages.ContentStyle -import org.junit.jupiter.api.Test -import utils.JavaCode import utils.pWrapped +import kotlin.test.Test import kotlin.test.assertEquals +import kotlin.test.assertNotNull import kotlin.test.assertTrue +import utils.JavaCode @JavaCode class JavaDeprecatedTest : BaseAbstractTest() { @@ -48,7 +49,7 @@ class JavaDeprecatedTest : BaseAbstractTest() { assertTrue(isDeprecated) val deprecatedAnnotation = (deprecatedClass as WithExtraProperties<out Documentable>).deprecatedAnnotation - checkNotNull(deprecatedAnnotation) + assertNotNull(deprecatedAnnotation) assertTrue(deprecatedAnnotation.isDeprecated()) assertEquals("java.lang", deprecatedAnnotation.dri.packageName) diff --git a/plugins/base/src/test/kotlin/content/annotations/KotlinDeprecatedTest.kt b/plugins/base/src/test/kotlin/content/annotations/KotlinDeprecatedTest.kt index 417843e2..b1e6516c 100644 --- a/plugins/base/src/test/kotlin/content/annotations/KotlinDeprecatedTest.kt +++ b/plugins/base/src/test/kotlin/content/annotations/KotlinDeprecatedTest.kt @@ -8,11 +8,12 @@ import org.jetbrains.dokka.model.Documentable import org.jetbrains.dokka.model.properties.WithExtraProperties import org.jetbrains.dokka.pages.ContentPage import org.jetbrains.dokka.pages.ContentStyle -import org.junit.jupiter.api.Test import utils.ParamAttributes import utils.bareSignature import utils.pWrapped +import kotlin.test.Test import kotlin.test.assertEquals +import kotlin.test.assertNotNull import kotlin.test.assertTrue @@ -51,7 +52,7 @@ class KotlinDeprecatedTest : BaseAbstractTest() { assertTrue(isDeprecated) val deprecatedAnnotation = (deprecatedFunction as WithExtraProperties<out Documentable>).deprecatedAnnotation - checkNotNull(deprecatedAnnotation) + assertNotNull(deprecatedAnnotation) assertTrue(deprecatedAnnotation.isDeprecated()) assertEquals("kotlin", deprecatedAnnotation.dri.packageName) diff --git a/plugins/base/src/test/kotlin/content/annotations/SinceKotlinTest.kt b/plugins/base/src/test/kotlin/content/annotations/SinceKotlinTest.kt index 0b36031c..87b5c2fb 100644 --- a/plugins/base/src/test/kotlin/content/annotations/SinceKotlinTest.kt +++ b/plugins/base/src/test/kotlin/content/annotations/SinceKotlinTest.kt @@ -9,15 +9,12 @@ import org.jetbrains.dokka.model.dfs import org.jetbrains.dokka.model.doc.CustomTagWrapper import org.jetbrains.dokka.model.doc.Text import org.jetbrains.dokka.pages.ContentPage -import org.junit.jupiter.api.AfterEach -import org.junit.jupiter.api.BeforeEach -import org.junit.jupiter.api.Test import signatures.AbstractRenderingTest import utils.ParamAttributes import utils.TestOutputWriterPlugin import utils.assertNotNull import utils.bareSignature -import kotlin.test.assertEquals +import kotlin.test.* class SinceKotlinTest : AbstractRenderingTest() { @@ -31,23 +28,23 @@ class SinceKotlinTest : AbstractRenderingTest() { } } - @BeforeEach + @BeforeTest fun setSystemProperty() { System.setProperty(SinceKotlinTransformer.SHOULD_DISPLAY_SINCE_KOTLIN_SYS_PROP, "true") } - @AfterEach + @AfterTest fun clearSystemProperty() { System.clearProperty(SinceKotlinTransformer.SHOULD_DISPLAY_SINCE_KOTLIN_SYS_PROP) } @Test fun versionsComparing() { - assert(SinceKotlinVersion("1.0").compareTo(SinceKotlinVersion("1.0")) == 0) - assert(SinceKotlinVersion("1.0.0").compareTo(SinceKotlinVersion("1")) == 0) - assert(SinceKotlinVersion("1.0") >= SinceKotlinVersion("1.0")) - assert(SinceKotlinVersion("1.1") > SinceKotlinVersion("1")) - assert(SinceKotlinVersion("1.0") < SinceKotlinVersion("2.0")) - assert(SinceKotlinVersion("1.0") < SinceKotlinVersion("2.2")) + assertTrue(SinceKotlinVersion("1.0").compareTo(SinceKotlinVersion("1.0")) == 0) + assertTrue(SinceKotlinVersion("1.0.0").compareTo(SinceKotlinVersion("1")) == 0) + assertTrue(SinceKotlinVersion("1.0") >= SinceKotlinVersion("1.0")) + assertTrue(SinceKotlinVersion("1.1") > SinceKotlinVersion("1")) + assertTrue(SinceKotlinVersion("1.0") < SinceKotlinVersion("2.0")) + assertTrue(SinceKotlinVersion("1.0") < SinceKotlinVersion("2.2")) } @Test @@ -77,7 +74,7 @@ class SinceKotlinTest : AbstractRenderingTest() { ) { renderingStage = { _, _ -> val content = writerPlugin.renderedContent("root/test/index.html") - assert(content.getElementsContainingOwnText("Since Kotlin").count() == 4) + assertEquals(4, content.getElementsContainingOwnText("Since Kotlin").count()) } } } |