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 | |
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')
161 files changed, 722 insertions, 734 deletions
diff --git a/plugins/all-modules-page/build.gradle.kts b/plugins/all-modules-page/build.gradle.kts index 191f2433..c546f73c 100644 --- a/plugins/all-modules-page/build.gradle.kts +++ b/plugins/all-modules-page/build.gradle.kts @@ -20,12 +20,11 @@ dependencies { implementation(libs.kotlinx.html) + testImplementation(kotlin("test")) testImplementation(projects.plugins.base) testImplementation(projects.plugins.base.baseTestUtils) testImplementation(projects.plugins.gfm) testImplementation(projects.plugins.gfm.gfmTemplateProcessing) testImplementation(projects.core.contentMatcherTestUtils) testImplementation(projects.core.testApi) - testImplementation(platform(libs.junit.bom)) - testImplementation(libs.junit.jupiter) } diff --git a/plugins/all-modules-page/src/test/kotlin/templates/MultiModuleDocumentationTest.kt b/plugins/all-modules-page/src/test/kotlin/templates/MultiModuleDocumentationTest.kt index 525331fc..a92fa115 100644 --- a/plugins/all-modules-page/src/test/kotlin/templates/MultiModuleDocumentationTest.kt +++ b/plugins/all-modules-page/src/test/kotlin/templates/MultiModuleDocumentationTest.kt @@ -6,37 +6,37 @@ import org.jetbrains.dokka.model.dfs import org.jetbrains.dokka.pages.ContentKind import org.jetbrains.dokka.pages.ContentResolvedLink import org.jetbrains.dokka.pages.MultimoduleRootPageNode -import org.junit.Rule -import org.junit.jupiter.api.AfterEach -import org.junit.jupiter.api.BeforeEach -import org.junit.jupiter.api.Test -import org.junit.rules.TemporaryFolder +import org.junit.jupiter.api.io.TempDir +import java.io.File +import kotlin.test.AfterTest +import kotlin.test.BeforeTest +import kotlin.test.Test import kotlin.test.assertEquals class MultiModuleDocumentationTest : MultiModuleAbstractTest() { - @get:Rule - val folder: TemporaryFolder = TemporaryFolder() + + @field:TempDir + lateinit var tempDir: File val documentationContent = """ # Sample project Sample documentation with [external link](https://www.google.pl) """.trimIndent() - @BeforeEach + @BeforeTest fun setup() { - folder.create() - folder.root.resolve("README.md").writeText(documentationContent) + tempDir.resolve("README.md").writeText(documentationContent) } - @AfterEach + @AfterTest fun teardown(){ - folder.root.resolve("README.md").delete() + tempDir.resolve("README.md").delete() } @Test fun `documentation should be included in all modules page`() { val configuration = dokkaConfiguration { - includes = listOf(folder.root.resolve("README.md")) + includes = listOf(tempDir.resolve("README.md")) } testFromData(configuration) { diff --git a/plugins/all-modules-page/src/test/kotlin/templates/ResolveLinkCommandResolutionTest.kt b/plugins/all-modules-page/src/test/kotlin/templates/ResolveLinkCommandResolutionTest.kt index 7ef8c3ea..5e785e03 100644 --- a/plugins/all-modules-page/src/test/kotlin/templates/ResolveLinkCommandResolutionTest.kt +++ b/plugins/all-modules-page/src/test/kotlin/templates/ResolveLinkCommandResolutionTest.kt @@ -9,36 +9,16 @@ import org.jetbrains.dokka.base.renderers.html.templateCommand import org.jetbrains.dokka.base.resolvers.shared.RecognizedLinkFormat import org.jetbrains.dokka.base.templating.ResolveLinkCommand import org.jetbrains.dokka.links.DRI -import org.junit.Rule -import org.junit.jupiter.api.Test -import org.junit.rules.TemporaryFolder +import org.junit.jupiter.api.io.TempDir import utils.assertHtmlEqualsIgnoringWhitespace import java.io.File +import kotlin.test.Test +import kotlin.test.assertTrue class ResolveLinkCommandResolutionTest : MultiModuleAbstractTest() { - @get:Rule - val folder: TemporaryFolder = TemporaryFolder() - - private fun configuration() = dokkaConfiguration { - modules = listOf( - DokkaModuleDescriptionImpl( - name = "module1", - relativePathToOutputDirectory = folder.root.resolve("module1"), - includes = emptySet(), - sourceOutputDirectory = folder.root.resolve("module1"), - ), - DokkaModuleDescriptionImpl( - name = "module2", - relativePathToOutputDirectory = folder.root.resolve("module2"), - includes = emptySet(), - sourceOutputDirectory = folder.root.resolve("module2"), - ) - ) - this.outputDir = folder.root - } @Test - fun `should resolve link to another module`() { + fun `should resolve link to another module`(@TempDir outputDirectory: File) { val testedDri = DRI( packageName = "package2", classNames = "Sample", @@ -56,8 +36,8 @@ class ResolveLinkCommandResolutionTest : MultiModuleAbstractTest() { } } - val contentFile = setup(link) - val configuration = configuration() + val contentFile = setup(outputDirectory, link) + val configuration = createConfiguration(outputDirectory) testFromData(configuration, useOutputLocationFromConfig = true) { finishProcessingSubmodules = { @@ -67,7 +47,7 @@ class ResolveLinkCommandResolutionTest : MultiModuleAbstractTest() { } @Test - fun `should produce content when link is not resolvable`() { + fun `should produce content when link is not resolvable`(@TempDir outputDirectory: File) { val testedDri = DRI( packageName = "not-resolvable-package", classNames = "Sample", @@ -85,8 +65,8 @@ class ResolveLinkCommandResolutionTest : MultiModuleAbstractTest() { } } - val contentFile = setup(link) - val configuration = configuration() + val contentFile = setup(outputDirectory, link) + val configuration = createConfiguration(outputDirectory) testFromData(configuration, useOutputLocationFromConfig = true) { finishProcessingSubmodules = { @@ -95,14 +75,31 @@ class ResolveLinkCommandResolutionTest : MultiModuleAbstractTest() { } } - fun setup(content: String): File { - folder.create() - val innerModule1 = folder.newFolder("module1") - val innerModule2 = folder.newFolder("module2") + private fun setup(outputDirectory: File, content: String): File { + val innerModule1 = outputDirectory.resolve("module1").also { assertTrue(it.mkdirs()) } + val innerModule2 = outputDirectory.resolve("module2").also { assertTrue(it.mkdirs()) } val packageList = innerModule2.resolve("package-list") packageList.writeText(mockedPackageListForPackages(RecognizedLinkFormat.DokkaHtml, "package2")) val contentFile = innerModule1.resolve("index.html") contentFile.writeText(content) return contentFile } + + private fun createConfiguration(outputDirectory: File) = dokkaConfiguration { + modules = listOf( + DokkaModuleDescriptionImpl( + name = "module1", + relativePathToOutputDirectory = outputDirectory.resolve("module1"), + includes = emptySet(), + sourceOutputDirectory = outputDirectory.resolve("module1"), + ), + DokkaModuleDescriptionImpl( + name = "module2", + relativePathToOutputDirectory = outputDirectory.resolve("module2"), + includes = emptySet(), + sourceOutputDirectory = outputDirectory.resolve("module2"), + ) + ) + this.outputDir = outputDirectory + } } diff --git a/plugins/all-modules-page/src/test/kotlin/templates/ResolveLinkGfmCommandResolutionTest.kt b/plugins/all-modules-page/src/test/kotlin/templates/ResolveLinkGfmCommandResolutionTest.kt index b38fb03f..9bb6ee89 100644 --- a/plugins/all-modules-page/src/test/kotlin/templates/ResolveLinkGfmCommandResolutionTest.kt +++ b/plugins/all-modules-page/src/test/kotlin/templates/ResolveLinkGfmCommandResolutionTest.kt @@ -8,67 +8,65 @@ import org.jetbrains.dokka.gfm.GfmPlugin import org.jetbrains.dokka.gfm.ResolveLinkGfmCommand import org.jetbrains.dokka.gfm.templateProcessing.GfmTemplateProcessingPlugin import org.jetbrains.dokka.links.DRI -import org.junit.Rule -import org.junit.jupiter.api.Test -import org.junit.rules.TemporaryFolder +import org.junit.jupiter.api.io.TempDir import java.io.File +import kotlin.test.Test import kotlin.test.assertEquals +import kotlin.test.assertTrue class ResolveLinkGfmCommandResolutionTest : MultiModuleAbstractTest() { - @get:Rule - val folder: TemporaryFolder = TemporaryFolder() - private fun configuration() = dokkaConfiguration { - modules = listOf( - DokkaModuleDescriptionImpl( - name = "module1", - relativePathToOutputDirectory = folder.root.resolve("module1"), - includes = emptySet(), - sourceOutputDirectory = folder.root.resolve("module1"), - ), - DokkaModuleDescriptionImpl( - name = "module2", - relativePathToOutputDirectory = folder.root.resolve("module2"), - includes = emptySet(), - sourceOutputDirectory = folder.root.resolve("module2"), + @Test + fun `should resolve link to another module`(@TempDir outputDirectory: File) { + val configuration = dokkaConfiguration { + modules = listOf( + DokkaModuleDescriptionImpl( + name = "module1", + relativePathToOutputDirectory = outputDirectory.resolve("module1"), + includes = emptySet(), + sourceOutputDirectory = outputDirectory.resolve("module1"), + ), + DokkaModuleDescriptionImpl( + name = "module2", + relativePathToOutputDirectory = outputDirectory.resolve("module2"), + includes = emptySet(), + sourceOutputDirectory = outputDirectory.resolve("module2"), + ) ) - ) - outputDir = folder.root - } + outputDir = outputDirectory + } - @Test - fun `should resolve link to another module`(){ - val testedDri = DRI( - packageName = "package2", - classNames = "Sample", - ) + val innerModule1 = outputDirectory.resolve("module1").also { assertTrue(it.mkdirs()) } + val innerModule2 = outputDirectory.resolve("module2").also { assertTrue(it.mkdirs()) } + + val indexMd = innerModule1.resolve("index.md") + val packageList = innerModule2.resolve("package-list") - val link = StringBuilder().apply { - templateCommand(ResolveLinkGfmCommand(testedDri)){ + val indexMdContent = StringBuilder().apply { + templateCommand( + ResolveLinkGfmCommand( + dri = DRI( + packageName = "package2", + classNames = "Sample", + ) + ) + ) { append("Sample text inside") } }.toString() - val expected = "[Sample text inside](../module2/package2/-sample/index.md)" - - val content = setup(link) - val configuration = configuration() + indexMd.writeText(indexMdContent) + packageList.writeText(mockedPackageListForPackages(RecognizedLinkFormat.DokkaGFM, "package2")) - testFromData(configuration, pluginOverrides = listOf(GfmTemplateProcessingPlugin(), GfmPlugin()), useOutputLocationFromConfig = true) { + testFromData( + configuration, + pluginOverrides = listOf(GfmTemplateProcessingPlugin(), GfmPlugin()), + useOutputLocationFromConfig = true + ) { finishProcessingSubmodules = { - assertEquals(expected, content.readText().trim()) + val expectedIndexMd = "[Sample text inside](../module2/package2/-sample/index.md)" + assertEquals(expectedIndexMd, indexMd.readText().trim()) } } } - - private fun setup(content: String): File { - folder.create() - val innerModule1 = folder.newFolder( "module1") - val innerModule2 = folder.newFolder( "module2") - val packageList = innerModule2.resolve("package-list") - packageList.writeText(mockedPackageListForPackages(RecognizedLinkFormat.DokkaGFM, "package2")) - val contentFile = innerModule1.resolve("index.md") - contentFile.writeText(content) - return contentFile - } } diff --git a/plugins/android-documentation/build.gradle.kts b/plugins/android-documentation/build.gradle.kts index 545f8435..582127f6 100644 --- a/plugins/android-documentation/build.gradle.kts +++ b/plugins/android-documentation/build.gradle.kts @@ -13,10 +13,9 @@ dependencies { implementation(kotlin("reflect")) + testImplementation(kotlin("test")) testImplementation(projects.plugins.base) testImplementation(projects.core.testApi) - testImplementation(platform(libs.junit.bom)) - testImplementation(libs.junit.jupiter) symbolsTestConfiguration(project(path = ":subprojects:analysis-kotlin-symbols", configuration = "shadow")) descriptorsTestConfiguration(project(path = ":subprojects:analysis-kotlin-descriptors", configuration = "shadow")) diff --git a/plugins/android-documentation/src/test/kotlin/transformers/HideTagDocumentableFilterTest.kt b/plugins/android-documentation/src/test/kotlin/transformers/HideTagDocumentableFilterTest.kt index 180268e4..e4af1ffb 100644 --- a/plugins/android-documentation/src/test/kotlin/transformers/HideTagDocumentableFilterTest.kt +++ b/plugins/android-documentation/src/test/kotlin/transformers/HideTagDocumentableFilterTest.kt @@ -2,7 +2,7 @@ package transformers import org.jetbrains.dokka.base.testApi.testRunner.BaseAbstractTest import org.jetbrains.dokka.model.DClass -import org.junit.jupiter.api.Test +import kotlin.test.Test import kotlin.test.assertEquals class HideTagDocumentableFilterTest : BaseAbstractTest() { diff --git a/plugins/base/base-test-utils/build.gradle.kts b/plugins/base/base-test-utils/build.gradle.kts index 20c3b727..a53e7b67 100644 --- a/plugins/base/base-test-utils/build.gradle.kts +++ b/plugins/base/base-test-utils/build.gradle.kts @@ -16,15 +16,13 @@ dependencies { runtimeOnly(project(path = ":subprojects:analysis-kotlin-descriptors", configuration = "shadow")) implementation(kotlin("reflect")) + implementation(libs.jsoup) + implementation(kotlin("test")) implementation(projects.core.testApi) - implementation(libs.jsoup) - implementation(kotlin("test-junit")) - + testImplementation(kotlin("test")) testImplementation(projects.core.testApi) - testImplementation(platform(libs.junit.bom)) - testImplementation(libs.junit.jupiter) } registerDokkaArtifactPublication("dokkaBaseTestUtils") { diff --git a/plugins/base/build.gradle.kts b/plugins/base/build.gradle.kts index 2f9f5863..b6374d75 100644 --- a/plugins/base/build.gradle.kts +++ b/plugins/base/build.gradle.kts @@ -27,6 +27,9 @@ dependencies { } // Test only + testImplementation(kotlin("test")) + testImplementation(libs.junit.jupiterParams) + symbolsTestConfiguration(project(path = ":subprojects:analysis-kotlin-symbols", configuration = "shadow")) descriptorsTestConfiguration(project(path = ":subprojects:analysis-kotlin-descriptors", configuration = "shadow")) testImplementation(projects.plugins.base.baseTestUtils) { @@ -34,20 +37,12 @@ dependencies { } testImplementation(projects.core.contentMatcherTestUtils) testImplementation(projects.core.testApi) - testImplementation(platform(libs.junit.bom)) - testImplementation(libs.junit.jupiter) dokkaHtmlFrontendFiles(projects.plugins.base.frontend) { because("fetch frontend files from subproject :plugins:base:frontend") } } - - - - - - // access the frontend files via the dependency on :plugins:base:frontend val dokkaHtmlFrontendFiles: Provider<FileCollection> = configurations.dokkaHtmlFrontendFiles.map { frontendFiles -> diff --git a/plugins/base/src/test/kotlin/basic/AbortGracefullyOnMissingDocumentablesTest.kt b/plugins/base/src/test/kotlin/basic/AbortGracefullyOnMissingDocumentablesTest.kt index 70d26e3c..81139300 100644 --- a/plugins/base/src/test/kotlin/basic/AbortGracefullyOnMissingDocumentablesTest.kt +++ b/plugins/base/src/test/kotlin/basic/AbortGracefullyOnMissingDocumentablesTest.kt @@ -2,7 +2,7 @@ package basic import org.jetbrains.dokka.DokkaGenerator import org.jetbrains.dokka.base.testApi.testRunner.BaseAbstractTest -import org.junit.jupiter.api.Test +import kotlin.test.Test import kotlin.test.assertTrue class AbortGracefullyOnMissingDocumentablesTest: BaseAbstractTest() { diff --git a/plugins/base/src/test/kotlin/basic/DRITest.kt b/plugins/base/src/test/kotlin/basic/DRITest.kt index c70c1b0b..794adc9f 100644 --- a/plugins/base/src/test/kotlin/basic/DRITest.kt +++ b/plugins/base/src/test/kotlin/basic/DRITest.kt @@ -9,9 +9,8 @@ import org.jetbrains.dokka.model.* import org.jetbrains.dokka.pages.ClasslikePageNode import org.jetbrains.dokka.pages.ContentPage import org.jetbrains.dokka.pages.MemberPageNode -import org.junit.jupiter.api.Assertions.assertEquals -import org.junit.jupiter.api.Tag -import org.junit.jupiter.api.Test +import kotlin.test.Test +import kotlin.test.assertEquals class DRITest : BaseAbstractTest() { @Test diff --git a/plugins/base/src/test/kotlin/basic/DokkaBasicTests.kt b/plugins/base/src/test/kotlin/basic/DokkaBasicTests.kt index d4e307be..dca0ffd5 100644 --- a/plugins/base/src/test/kotlin/basic/DokkaBasicTests.kt +++ b/plugins/base/src/test/kotlin/basic/DokkaBasicTests.kt @@ -3,7 +3,7 @@ package basic import org.jetbrains.dokka.base.testApi.testRunner.BaseAbstractTest import org.jetbrains.dokka.pages.ClasslikePageNode import org.jetbrains.dokka.pages.ModulePageNode -import org.junit.jupiter.api.Test +import kotlin.test.Test import kotlin.test.assertEquals class DokkaBasicTests : BaseAbstractTest() { diff --git a/plugins/base/src/test/kotlin/basic/FailOnWarningTest.kt b/plugins/base/src/test/kotlin/basic/FailOnWarningTest.kt index bd8a79ef..1ea2adfd 100644 --- a/plugins/base/src/test/kotlin/basic/FailOnWarningTest.kt +++ b/plugins/base/src/test/kotlin/basic/FailOnWarningTest.kt @@ -6,8 +6,8 @@ import org.jetbrains.dokka.testApi.logger.TestLogger import org.jetbrains.dokka.utilities.DokkaConsoleLogger import org.jetbrains.dokka.utilities.DokkaLogger import org.jetbrains.dokka.utilities.LoggingLevel -import org.junit.jupiter.api.Test -import org.junit.jupiter.api.assertThrows +import kotlin.test.Test +import kotlin.test.assertFailsWith class FailOnWarningTest : BaseAbstractTest() { @@ -22,7 +22,7 @@ class FailOnWarningTest : BaseAbstractTest() { } } - assertThrows<DokkaException> { + assertFailsWith<DokkaException> { testInline( """ |/src/main/kotlin/Bar.kt @@ -48,7 +48,7 @@ class FailOnWarningTest : BaseAbstractTest() { } } - assertThrows<DokkaException> { + assertFailsWith<DokkaException> { testInline( """ |/src/main/kotlin/Bar.kt diff --git a/plugins/base/src/test/kotlin/basic/LoggerTest.kt b/plugins/base/src/test/kotlin/basic/LoggerTest.kt index 92ffb539..904645ad 100644 --- a/plugins/base/src/test/kotlin/basic/LoggerTest.kt +++ b/plugins/base/src/test/kotlin/basic/LoggerTest.kt @@ -3,7 +3,7 @@ package basic import org.jetbrains.dokka.utilities.DokkaConsoleLogger import org.jetbrains.dokka.utilities.LoggingLevel import org.jetbrains.dokka.utilities.MessageEmitter -import org.junit.jupiter.api.Test +import kotlin.test.Test import kotlin.test.assertFalse import kotlin.test.assertTrue @@ -41,4 +41,4 @@ class LoggerTest { assertFalse(emitter.messages.any { it.contains("Info!") }) assertTrue(emitter.messages.any { it.contains("Warning!") }) } -}
\ No newline at end of file +} diff --git a/plugins/base/src/test/kotlin/content/ContentInDescriptionTest.kt b/plugins/base/src/test/kotlin/content/ContentInDescriptionTest.kt index e5533a7e..eb04a258 100644 --- a/plugins/base/src/test/kotlin/content/ContentInDescriptionTest.kt +++ b/plugins/base/src/test/kotlin/content/ContentInDescriptionTest.kt @@ -2,7 +2,7 @@ package content import org.jetbrains.dokka.base.testApi.testRunner.BaseAbstractTest import org.jetbrains.dokka.model.doc.* -import org.junit.jupiter.api.Test +import kotlin.test.Test import kotlin.test.assertEquals import kotlin.test.assertTrue @@ -135,4 +135,4 @@ class ContentInDescriptionTest : BaseAbstractTest() { } } } -}
\ No newline at end of file +} diff --git a/plugins/base/src/test/kotlin/content/HighlightingTest.kt b/plugins/base/src/test/kotlin/content/HighlightingTest.kt index 0896e7b7..4de680db 100644 --- a/plugins/base/src/test/kotlin/content/HighlightingTest.kt +++ b/plugins/base/src/test/kotlin/content/HighlightingTest.kt @@ -3,7 +3,7 @@ package content import org.jetbrains.dokka.base.testApi.testRunner.BaseAbstractTest import org.jetbrains.dokka.model.dfs import org.jetbrains.dokka.pages.* -import org.junit.jupiter.api.Test +import kotlin.test.Test import kotlin.test.assertTrue class HighlightingTest : BaseAbstractTest() { 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()) } } } diff --git a/plugins/base/src/test/kotlin/content/exceptions/ContentForExceptions.kt b/plugins/base/src/test/kotlin/content/exceptions/ContentForExceptions.kt index 17bd209e..227c4e9e 100644 --- a/plugins/base/src/test/kotlin/content/exceptions/ContentForExceptions.kt +++ b/plugins/base/src/test/kotlin/content/exceptions/ContentForExceptions.kt @@ -6,8 +6,11 @@ import org.jetbrains.dokka.PluginConfigurationImpl import org.jetbrains.dokka.base.DokkaBase import org.jetbrains.dokka.base.testApi.testRunner.BaseAbstractTest import org.jetbrains.dokka.model.DisplaySourceSet -import org.junit.jupiter.api.Test -import utils.* +import utils.ParamAttributes +import utils.bareSignature +import utils.findTestType +import utils.OnlyDescriptors +import kotlin.test.Test import kotlin.test.assertEquals class ContentForExceptions : BaseAbstractTest() { diff --git a/plugins/base/src/test/kotlin/content/functions/ContentForBriefTest.kt b/plugins/base/src/test/kotlin/content/functions/ContentForBriefTest.kt index c09a0e4d..d1bfa767 100644 --- a/plugins/base/src/test/kotlin/content/functions/ContentForBriefTest.kt +++ b/plugins/base/src/test/kotlin/content/functions/ContentForBriefTest.kt @@ -7,8 +7,8 @@ import org.jetbrains.dokka.model.DClass import org.jetbrains.dokka.model.DPackage import org.jetbrains.dokka.model.dfs import org.jetbrains.dokka.pages.* -import org.junit.jupiter.api.Assertions.assertEquals -import org.junit.jupiter.api.Test +import kotlin.test.Test +import kotlin.test.assertEquals import kotlin.test.assertNotNull import kotlin.test.assertNull @@ -381,4 +381,4 @@ class ContentForBriefTest : BaseAbstractTest() { val row = contentTable.children.first() return row.dfs { it is ContentGroup && it.dci.kind == ContentKind.Comment && it.children.all { it is ContentText } } as ContentGroup } -}
\ No newline at end of file +} diff --git a/plugins/base/src/test/kotlin/content/functions/ContentForConstructors.kt b/plugins/base/src/test/kotlin/content/functions/ContentForConstructors.kt index 8da3be54..47b000ac 100644 --- a/plugins/base/src/test/kotlin/content/functions/ContentForConstructors.kt +++ b/plugins/base/src/test/kotlin/content/functions/ContentForConstructors.kt @@ -4,8 +4,9 @@ import org.jetbrains.dokka.base.testApi.testRunner.BaseAbstractTest import org.jetbrains.dokka.model.DClass import org.jetbrains.dokka.model.dfs import org.jetbrains.dokka.pages.* -import org.junit.jupiter.api.Test +import utils.assertContains import utils.assertNotNull +import kotlin.test.Test import kotlin.test.assertEquals class ContentForConstructors : BaseAbstractTest() { @@ -41,8 +42,8 @@ class ContentForConstructors : BaseAbstractTest() { val constructorName = primary.dfs { (it as? ContentText)?.text == "Example" }.assertNotNull("constructorName") - assert(ContentStyle.RowTitle in constructorName.style) + assertContains(constructorName.style, ContentStyle.RowTitle) } } } -}
\ No newline at end of file +} diff --git a/plugins/base/src/test/kotlin/content/inheritors/ContentForInheritorsTest.kt b/plugins/base/src/test/kotlin/content/inheritors/ContentForInheritorsTest.kt index 2994fb42..5ec1ca74 100644 --- a/plugins/base/src/test/kotlin/content/inheritors/ContentForInheritorsTest.kt +++ b/plugins/base/src/test/kotlin/content/inheritors/ContentForInheritorsTest.kt @@ -5,10 +5,10 @@ import org.jetbrains.dokka.DokkaConfiguration import org.jetbrains.dokka.PluginConfigurationImpl import org.jetbrains.dokka.base.DokkaBase import org.jetbrains.dokka.base.testApi.testRunner.BaseAbstractTest -import org.junit.jupiter.api.Test import utils.OnlyDescriptors import utils.classSignature import utils.findTestType +import kotlin.test.Test import kotlin.test.assertEquals class ContentForInheritorsTest : BaseAbstractTest() { diff --git a/plugins/base/src/test/kotlin/content/params/ContentForParamsTest.kt b/plugins/base/src/test/kotlin/content/params/ContentForParamsTest.kt index df5efd03..97114dbc 100644 --- a/plugins/base/src/test/kotlin/content/params/ContentForParamsTest.kt +++ b/plugins/base/src/test/kotlin/content/params/ContentForParamsTest.kt @@ -10,8 +10,8 @@ import org.jetbrains.dokka.model.doc.Param import org.jetbrains.dokka.model.doc.Text import org.jetbrains.dokka.pages.* import org.jetbrains.dokka.utilities.firstIsInstanceOrNull -import org.junit.jupiter.api.Test import utils.* +import kotlin.test.Test import kotlin.test.assertEquals class ContentForParamsTest : BaseAbstractTest() { @@ -1515,10 +1515,10 @@ class ContentForParamsTest : BaseAbstractTest() { it.documentation[jvm] } - assert(forJvm.size == 2) + assertEquals(2, forJvm.size) val (first, second) = forJvm.map { it.paramsDescription() } - assert(first == "comment to first param") - assert(second == "comment to second param") + assertEquals("comment to first param", first) + assertEquals("comment to second param", second) } } } diff --git a/plugins/base/src/test/kotlin/content/properties/ContentForClassWithParamsAndPropertiesTest.kt b/plugins/base/src/test/kotlin/content/properties/ContentForClassWithParamsAndPropertiesTest.kt index 164fa62d..e4abb9af 100644 --- a/plugins/base/src/test/kotlin/content/properties/ContentForClassWithParamsAndPropertiesTest.kt +++ b/plugins/base/src/test/kotlin/content/properties/ContentForClassWithParamsAndPropertiesTest.kt @@ -6,7 +6,7 @@ import org.jetbrains.dokka.model.dfs import org.jetbrains.dokka.model.doc.* import org.jetbrains.dokka.pages.ClasslikePageNode import org.jetbrains.dokka.pages.RootPageNode -import org.junit.jupiter.api.Test +import kotlin.test.Test import kotlin.test.assertEquals class ContentForClassWithParamsAndPropertiesTest : BaseAbstractTest() { diff --git a/plugins/base/src/test/kotlin/content/receiver/ContentForReceiverTest.kt b/plugins/base/src/test/kotlin/content/receiver/ContentForReceiverTest.kt index d7399914..0187b9a7 100644 --- a/plugins/base/src/test/kotlin/content/receiver/ContentForReceiverTest.kt +++ b/plugins/base/src/test/kotlin/content/receiver/ContentForReceiverTest.kt @@ -7,8 +7,8 @@ import org.jetbrains.dokka.model.doc.Text import org.jetbrains.dokka.pages.ContentHeader import org.jetbrains.dokka.pages.ContentText import org.jetbrains.dokka.pages.MemberPageNode -import org.junit.jupiter.api.Test import utils.docs +import kotlin.test.Test import kotlin.test.assertEquals import kotlin.test.assertNotNull @@ -54,4 +54,4 @@ class ContentForReceiverTest: BaseAbstractTest() { } } } -}
\ No newline at end of file +} diff --git a/plugins/base/src/test/kotlin/content/samples/ContentForSamplesTest.kt b/plugins/base/src/test/kotlin/content/samples/ContentForSamplesTest.kt index 9b5ab7ad..08a9a098 100644 --- a/plugins/base/src/test/kotlin/content/samples/ContentForSamplesTest.kt +++ b/plugins/base/src/test/kotlin/content/samples/ContentForSamplesTest.kt @@ -4,11 +4,12 @@ import matchers.content.* import org.jetbrains.dokka.base.testApi.testRunner.BaseAbstractTest import org.jetbrains.dokka.base.transformers.pages.KOTLIN_PLAYGROUND_SCRIPT import org.jetbrains.dokka.model.DisplaySourceSet -import org.junit.jupiter.api.Test import utils.TestOutputWriterPlugin +import utils.assertContains import utils.classSignature import utils.findTestType import java.nio.file.Paths +import kotlin.test.Test import kotlin.test.assertEquals import kotlin.test.assertNotEquals @@ -79,7 +80,7 @@ class ContentForSamplesTest : BaseAbstractTest() { ) { pagesTransformationStage = { module -> val page = module.findTestType("test", "Foo") - assert(KOTLIN_PLAYGROUND_SCRIPT in page.embeddedResources) + assertContains(page.embeddedResources, KOTLIN_PLAYGROUND_SCRIPT) page.content.assertNode { group { header(1) { +"Foo" } @@ -143,7 +144,7 @@ class ContentForSamplesTest : BaseAbstractTest() { ) { pagesTransformationStage = { module -> val page = module.findTestType("pageMerger", "Parent") - assert(KOTLIN_PLAYGROUND_SCRIPT in page.embeddedResources) + assertContains(page.embeddedResources, KOTLIN_PLAYGROUND_SCRIPT) page.content.assertNode { group { header(1) { +"Parent" } @@ -199,4 +200,4 @@ class ContentForSamplesTest : BaseAbstractTest() { private fun Set<DisplaySourceSet>.assertSourceSet(expectedName: String) { assertEquals(1, this.size) assertEquals(expectedName, this.first().name) -}
\ No newline at end of file +} diff --git a/plugins/base/src/test/kotlin/content/seealso/ContentForSeeAlsoTest.kt b/plugins/base/src/test/kotlin/content/seealso/ContentForSeeAlsoTest.kt index 82a04b89..7e4ed0cf 100644 --- a/plugins/base/src/test/kotlin/content/seealso/ContentForSeeAlsoTest.kt +++ b/plugins/base/src/test/kotlin/content/seealso/ContentForSeeAlsoTest.kt @@ -4,8 +4,8 @@ import matchers.content.* import org.jetbrains.dokka.base.testApi.testRunner.BaseAbstractTest import org.jetbrains.dokka.model.DisplaySourceSet import org.jetbrains.dokka.pages.ContentDRILink -import org.junit.jupiter.api.Test import utils.* +import kotlin.test.Test import kotlin.test.assertEquals class ContentForSeeAlsoTest : BaseAbstractTest() { @@ -857,4 +857,4 @@ class ContentForSeeAlsoTest : BaseAbstractTest() { private fun Set<DisplaySourceSet>.assertSourceSet(expectedName: String) { assertEquals(1, this.size) assertEquals(expectedName, this.first().name) -}
\ No newline at end of file +} diff --git a/plugins/base/src/test/kotlin/content/signatures/ConstructorsSignaturesTest.kt b/plugins/base/src/test/kotlin/content/signatures/ConstructorsSignaturesTest.kt index e57e6a8c..a1d8e260 100644 --- a/plugins/base/src/test/kotlin/content/signatures/ConstructorsSignaturesTest.kt +++ b/plugins/base/src/test/kotlin/content/signatures/ConstructorsSignaturesTest.kt @@ -4,7 +4,7 @@ import matchers.content.* import org.jetbrains.dokka.base.testApi.testRunner.BaseAbstractTest import org.jetbrains.dokka.pages.BasicTabbedContentType import org.jetbrains.dokka.pages.ContentPage -import org.junit.jupiter.api.Test +import kotlin.test.Test import utils.OnlyDescriptors class ConstructorsSignaturesTest : BaseAbstractTest() { diff --git a/plugins/base/src/test/kotlin/content/signatures/ContentForSignaturesTest.kt b/plugins/base/src/test/kotlin/content/signatures/ContentForSignaturesTest.kt index a39ade25..3c81d69b 100644 --- a/plugins/base/src/test/kotlin/content/signatures/ContentForSignaturesTest.kt +++ b/plugins/base/src/test/kotlin/content/signatures/ContentForSignaturesTest.kt @@ -5,11 +5,11 @@ import org.jetbrains.dokka.DokkaConfiguration import org.jetbrains.dokka.base.testApi.testRunner.BaseAbstractTest import org.jetbrains.dokka.pages.ContentPage import org.jetbrains.dokka.pages.PackagePageNode -import org.junit.jupiter.api.Test import utils.ParamAttributes import utils.bareSignature import utils.propertySignature import utils.typealiasSignature +import kotlin.test.Test class ContentForSignaturesTest : BaseAbstractTest() { diff --git a/plugins/base/src/test/kotlin/content/typealiases/TypealiasTest.kt b/plugins/base/src/test/kotlin/content/typealiases/TypealiasTest.kt index c2f58cb9..4b2b003a 100644 --- a/plugins/base/src/test/kotlin/content/typealiases/TypealiasTest.kt +++ b/plugins/base/src/test/kotlin/content/typealiases/TypealiasTest.kt @@ -3,9 +3,10 @@ package content.typealiases import matchers.content.* import org.jetbrains.dokka.base.testApi.testRunner.BaseAbstractTest import org.jetbrains.dokka.model.dfs -import org.jetbrains.dokka.pages.* -import org.junit.jupiter.api.Test +import org.jetbrains.dokka.pages.ClasslikePageNode +import org.jetbrains.dokka.pages.PlatformHintedContent import utils.assertNotNull +import kotlin.test.Test class TypealiasTest : BaseAbstractTest() { @@ -75,4 +76,4 @@ class TypealiasTest : BaseAbstractTest() { } } } -}
\ No newline at end of file +} diff --git a/plugins/base/src/test/kotlin/enums/JavaEnumsTest.kt b/plugins/base/src/test/kotlin/enums/JavaEnumsTest.kt index 1602a7cf..f00591a2 100644 --- a/plugins/base/src/test/kotlin/enums/JavaEnumsTest.kt +++ b/plugins/base/src/test/kotlin/enums/JavaEnumsTest.kt @@ -2,10 +2,10 @@ package enums import org.jetbrains.dokka.SourceLinkDefinitionImpl import org.jetbrains.dokka.base.testApi.testRunner.BaseAbstractTest -import org.junit.jupiter.api.Test import signatures.renderedContent import utils.TestOutputWriterPlugin import java.net.URL +import kotlin.test.Test import kotlin.test.assertEquals class JavaEnumsTest : BaseAbstractTest() { diff --git a/plugins/base/src/test/kotlin/enums/KotlinEnumsTest.kt b/plugins/base/src/test/kotlin/enums/KotlinEnumsTest.kt index a49a29de..3bf1b3f1 100644 --- a/plugins/base/src/test/kotlin/enums/KotlinEnumsTest.kt +++ b/plugins/base/src/test/kotlin/enums/KotlinEnumsTest.kt @@ -10,12 +10,14 @@ import org.jetbrains.dokka.pages.ClasslikePageNode import org.jetbrains.dokka.pages.ContentGroup import org.jsoup.Jsoup import org.jsoup.nodes.Element -import org.junit.jupiter.api.Assertions.* -import org.junit.jupiter.api.Test import signatures.renderedContent import utils.TestOutputWriter import utils.TestOutputWriterPlugin import java.net.URL +import kotlin.test.Test +import kotlin.test.assertEquals +import kotlin.test.assertNotNull +import kotlin.test.assertTrue class KotlinEnumsTest : BaseAbstractTest() { diff --git a/plugins/base/src/test/kotlin/expect/AbstractExpectTest.kt b/plugins/base/src/test/kotlin/expect/AbstractExpectTest.kt index 1d86f219..29905035 100644 --- a/plugins/base/src/test/kotlin/expect/AbstractExpectTest.kt +++ b/plugins/base/src/test/kotlin/expect/AbstractExpectTest.kt @@ -1,11 +1,12 @@ package expect import org.jetbrains.dokka.base.testApi.testRunner.BaseAbstractTest -import org.junit.jupiter.api.Assertions.assertTrue import java.nio.file.Files import java.nio.file.Path import java.nio.file.Paths import java.util.concurrent.TimeUnit +import kotlin.test.assertEquals +import kotlin.test.assertTrue abstract class AbstractExpectTest( val testDir: Path? = Paths.get("src/test", "resources", "expect"), @@ -40,9 +41,9 @@ abstract class AbstractExpectTest( ).also { logger.info("git diff command: ${it.command().joinToString(" ")}") } .also { it.redirectErrorStream() }.start() - assertTrue(gitCompare.waitFor(gitTimeout, TimeUnit.MILLISECONDS)) { "Git timed out after $gitTimeout" } + assertTrue(gitCompare.waitFor(gitTimeout, TimeUnit.MILLISECONDS), "Git timed out after $gitTimeout") gitCompare.inputStream.bufferedReader().lines().forEach { logger.info(it) } - assertTrue(gitCompare.exitValue() == 0) { "${path.fileName}: outputs don't match" } + assertEquals(0, gitCompare.exitValue(), "${path.fileName}: outputs don't match") } ?: throw AssertionError("obtained path is null") } @@ -54,7 +55,7 @@ abstract class AbstractExpectTest( ) { obtained?.let { _ -> val (res, out, err) = runDiff(expected, obtained, excludes, timeout) - assertTrue(res == 0, "Outputs differ:\nstdout - $out\n\nstderr - ${err ?: ""}") + assertEquals(0, res, "Outputs differ:\nstdout - $out\n\nstderr - ${err ?: ""}") } ?: throw AssertionError("obtained path is null") } diff --git a/plugins/base/src/test/kotlin/expect/ExpectGenerator.kt b/plugins/base/src/test/kotlin/expect/ExpectGenerator.kt index cb3313f9..4112cd28 100644 --- a/plugins/base/src/test/kotlin/expect/ExpectGenerator.kt +++ b/plugins/base/src/test/kotlin/expect/ExpectGenerator.kt @@ -1,13 +1,13 @@ package expect -import org.junit.jupiter.api.Disabled -import org.junit.jupiter.api.Test +import kotlin.test.Ignore +import kotlin.test.Test class ExpectGenerator : AbstractExpectTest() { - @Disabled + @Ignore @Test fun generateAll() = testDir?.dirsWithFormats(formats).orEmpty().forEach { (p, f) -> generateExpect(p, f) } -}
\ No newline at end of file +} diff --git a/plugins/base/src/test/kotlin/expect/ExpectTest.kt b/plugins/base/src/test/kotlin/expect/ExpectTest.kt index bed841a6..ec9c8c6d 100644 --- a/plugins/base/src/test/kotlin/expect/ExpectTest.kt +++ b/plugins/base/src/test/kotlin/expect/ExpectTest.kt @@ -1,8 +1,8 @@ package expect -import org.junit.jupiter.api.Disabled import org.junit.jupiter.api.DynamicTest.dynamicTest import org.junit.jupiter.api.TestFactory +import kotlin.test.Ignore class ExpectTest : AbstractExpectTest() { private val ignores: List<String> = listOf( @@ -16,9 +16,9 @@ class ExpectTest : AbstractExpectTest() { "*.map" ) - @Disabled + @Ignore @TestFactory fun expectTest() = testDir?.dirsWithFormats(formats).orEmpty().map { (p, f) -> dynamicTest("${p.fileName}-$f") { testOutputWithExcludes(p, f, ignores) } } -}
\ No newline at end of file +} diff --git a/plugins/base/src/test/kotlin/expectActuals/ExpectActualsTest.kt b/plugins/base/src/test/kotlin/expectActuals/ExpectActualsTest.kt index ff1b7989..6344aa5a 100644 --- a/plugins/base/src/test/kotlin/expectActuals/ExpectActualsTest.kt +++ b/plugins/base/src/test/kotlin/expectActuals/ExpectActualsTest.kt @@ -3,8 +3,9 @@ package expectActuals import org.jetbrains.dokka.base.testApi.testRunner.BaseAbstractTest import org.jetbrains.dokka.model.withDescendants import org.jetbrains.dokka.pages.ClasslikePageNode -import org.junit.jupiter.api.Assertions.assertTrue -import org.junit.jupiter.api.Test +import kotlin.test.Test +import kotlin.test.assertEquals +import kotlin.test.assertTrue class ExpectActualsTest : BaseAbstractTest() { @@ -146,25 +147,28 @@ class ExpectActualsTest : BaseAbstractTest() { val commonN1 = allChildren.filter { it.name == "[mingwX64, linuxX64]A" } val commonN2 = allChildren.filter { it.name == "[iosX64, iosArm64]A" } val noClass = allChildren.filter { it.name == "A" } - assertTrue(commonJ.size == 1) { "There can be only one [jvm, js]A page" } + assertEquals(1, commonJ.size, "There can be only one [jvm, js]A page") assertTrue( commonJ.first().documentables.firstOrNull()?.sourceSets?.map { it.displayName } - ?.containsAll(listOf("commonJ", "js", "jvm")) ?: false - ) { "A(jvm, js)should have commonJ, js, jvm sources" } + ?.containsAll(listOf("commonJ", "js", "jvm")) ?: false, + "A(jvm, js)should have commonJ, js, jvm sources" + ) - assertTrue(commonN1.size == 1) { "There can be only one [mingwX64, linuxX64]A page" } + assertEquals(1, commonN1.size, "There can be only one [mingwX64, linuxX64]A page") assertTrue( commonN1.first().documentables.firstOrNull()?.sourceSets?.map { it.displayName } - ?.containsAll(listOf("commonN1", "linuxX64", "mingwX64")) ?: false - ) { "[mingwX64, linuxX64]A should have commonN1, linuxX64, mingwX64 sources" } + ?.containsAll(listOf("commonN1", "linuxX64", "mingwX64")) ?: false, + "[mingwX64, linuxX64]A should have commonN1, linuxX64, mingwX64 sources" + ) - assertTrue(commonN2.size == 1) { "There can be only one [iosX64, iosArm64]A page" } + assertEquals(1, commonN2.size, "There can be only one [iosX64, iosArm64]A page") assertTrue( commonN2.first().documentables.firstOrNull()?.sourceSets?.map { it.displayName } - ?.containsAll(listOf("commonN2", "iosArm64", "iosX64")) ?: false - ) { "[iosX64, iosArm64]A should have commonN2, iosArm64, iosX64 sources" } + ?.containsAll(listOf("commonN2", "iosArm64", "iosX64")) ?: false, + "[iosX64, iosArm64]A should have commonN2, iosArm64, iosX64 sources" + ) - assertTrue(noClass.isEmpty()) { "There can't be any A page" } + assertTrue(noClass.isEmpty(), "There can't be any A page") } } } diff --git a/plugins/base/src/test/kotlin/filter/DeprecationFilterTest.kt b/plugins/base/src/test/kotlin/filter/DeprecationFilterTest.kt index 44caecaa..c28f3fd0 100644 --- a/plugins/base/src/test/kotlin/filter/DeprecationFilterTest.kt +++ b/plugins/base/src/test/kotlin/filter/DeprecationFilterTest.kt @@ -3,8 +3,8 @@ package filter import org.jetbrains.dokka.DokkaDefaults import org.jetbrains.dokka.PackageOptionsImpl import org.jetbrains.dokka.base.testApi.testRunner.BaseAbstractTest -import org.junit.jupiter.api.Assertions -import org.junit.jupiter.api.Test +import kotlin.test.Test +import kotlin.test.assertTrue class DeprecationFilterTest : BaseAbstractTest() { @@ -41,7 +41,7 @@ class DeprecationFilterTest : BaseAbstractTest() { configuration ) { preMergeDocumentablesTransformationStage = { - Assertions.assertTrue( + assertTrue( it.first().packages.first().functions.isEmpty() ) } @@ -72,7 +72,7 @@ class DeprecationFilterTest : BaseAbstractTest() { configuration ) { preMergeDocumentablesTransformationStage = { - Assertions.assertTrue( + assertTrue( it.first().packages.first().functions.size == 1 ) } @@ -103,7 +103,7 @@ class DeprecationFilterTest : BaseAbstractTest() { configuration ) { preMergeDocumentablesTransformationStage = { - Assertions.assertTrue( + assertTrue( it.first().packages.first().functions.size == 1 ) } @@ -134,7 +134,7 @@ class DeprecationFilterTest : BaseAbstractTest() { configuration ) { preMergeDocumentablesTransformationStage = { - Assertions.assertTrue( + assertTrue( it.first().packages.first().functions.isEmpty() ) } @@ -169,7 +169,7 @@ class DeprecationFilterTest : BaseAbstractTest() { configuration ) { preMergeDocumentablesTransformationStage = { - Assertions.assertTrue( + assertTrue( it.first().packages.first().classlikes.first().classlikes.isEmpty() ) } @@ -210,7 +210,7 @@ class DeprecationFilterTest : BaseAbstractTest() { configuration ) { preMergeDocumentablesTransformationStage = { - Assertions.assertTrue( + assertTrue( it.first().packages.first().functions.isEmpty() ) } @@ -250,7 +250,7 @@ class DeprecationFilterTest : BaseAbstractTest() { configuration ) { preMergeDocumentablesTransformationStage = { - Assertions.assertTrue( + assertTrue( it.first().packages.first().functions.size == 1 ) } diff --git a/plugins/base/src/test/kotlin/filter/EmptyPackagesFilterTest.kt b/plugins/base/src/test/kotlin/filter/EmptyPackagesFilterTest.kt index 58a8e5f1..b4ee6c00 100644 --- a/plugins/base/src/test/kotlin/filter/EmptyPackagesFilterTest.kt +++ b/plugins/base/src/test/kotlin/filter/EmptyPackagesFilterTest.kt @@ -1,9 +1,9 @@ package filter import org.jetbrains.dokka.base.testApi.testRunner.BaseAbstractTest -import org.junit.jupiter.api.Assertions -import org.junit.jupiter.api.Test +import kotlin.test.Test import kotlin.test.assertEquals +import kotlin.test.assertTrue class EmptyPackagesFilterTest : BaseAbstractTest() { @Test @@ -28,7 +28,7 @@ class EmptyPackagesFilterTest : BaseAbstractTest() { configuration ) { preMergeDocumentablesTransformationStage = { - Assertions.assertTrue( + assertTrue( it.first().packages.isNotEmpty() ) } diff --git a/plugins/base/src/test/kotlin/filter/JavaFileFilterTest.kt b/plugins/base/src/test/kotlin/filter/JavaFileFilterTest.kt index a1a242c5..5d507669 100644 --- a/plugins/base/src/test/kotlin/filter/JavaFileFilterTest.kt +++ b/plugins/base/src/test/kotlin/filter/JavaFileFilterTest.kt @@ -1,8 +1,8 @@ package filter import org.jetbrains.dokka.base.testApi.testRunner.BaseAbstractTest -import org.junit.jupiter.api.Assertions -import org.junit.jupiter.api.Test +import kotlin.test.Test +import kotlin.test.assertTrue class JavaFileFilterTest : BaseAbstractTest() { @Test @@ -27,7 +27,7 @@ class JavaFileFilterTest : BaseAbstractTest() { configuration ) { preMergeDocumentablesTransformationStage = { - Assertions.assertTrue( + assertTrue( it.first().packages.isNotEmpty() ) } diff --git a/plugins/base/src/test/kotlin/filter/JavaVisibilityFilterTest.kt b/plugins/base/src/test/kotlin/filter/JavaVisibilityFilterTest.kt index 6423655a..8130766d 100644 --- a/plugins/base/src/test/kotlin/filter/JavaVisibilityFilterTest.kt +++ b/plugins/base/src/test/kotlin/filter/JavaVisibilityFilterTest.kt @@ -7,10 +7,10 @@ import org.jetbrains.dokka.PackageOptionsImpl import org.jetbrains.dokka.base.testApi.testRunner.BaseAbstractTest import org.jetbrains.dokka.model.DClass import org.jetbrains.dokka.model.DModule -import org.junit.jupiter.api.Test import org.junit.jupiter.params.ParameterizedTest import org.junit.jupiter.params.provider.MethodSource import testApi.testRunner.dokkaConfiguration +import kotlin.test.Test import utils.JavaCode import kotlin.test.assertEquals @@ -302,4 +302,5 @@ class JavaVisibilityFilterTest : BaseAbstractTest() { ConfigurationWithVisibility("public", configuration, expectedClasslikes = 1) } } -}
\ No newline at end of file +} + diff --git a/plugins/base/src/test/kotlin/filter/KotlinArrayDocumentableReplacerTest.kt b/plugins/base/src/test/kotlin/filter/KotlinArrayDocumentableReplacerTest.kt index af77d61c..19dd6204 100644 --- a/plugins/base/src/test/kotlin/filter/KotlinArrayDocumentableReplacerTest.kt +++ b/plugins/base/src/test/kotlin/filter/KotlinArrayDocumentableReplacerTest.kt @@ -6,8 +6,9 @@ import org.jetbrains.dokka.model.DClass import org.jetbrains.dokka.model.FunctionalTypeConstructor import org.jetbrains.dokka.model.GenericTypeConstructor import org.jetbrains.dokka.model.Invariance -import org.junit.jupiter.api.Assertions -import org.junit.jupiter.api.Test +import kotlin.test.Test +import kotlin.test.assertEquals +import kotlin.test.assertNotEquals import utils.OnlyDescriptors class KotlinArrayDocumentableReplacerTest : BaseAbstractTest() { @@ -42,9 +43,9 @@ class KotlinArrayDocumentableReplacerTest : BaseAbstractTest() { val typeArrayNames = listOf("IntArray", "BooleanArray", "FloatArray", "DoubleArray", "LongArray", "ShortArray", "CharArray", "ByteArray") - Assertions.assertEquals(typeArrayNames.size, params?.size) + assertEquals(typeArrayNames.size, params?.size) params?.forEachIndexed{ i, param -> - Assertions.assertEquals(GenericTypeConstructor(DRI("kotlin", typeArrayNames[i]), emptyList()), + assertEquals(GenericTypeConstructor(DRI("kotlin", typeArrayNames[i]), emptyList()), param.type) } } @@ -66,13 +67,13 @@ class KotlinArrayDocumentableReplacerTest : BaseAbstractTest() { ) { preMergeDocumentablesTransformationStage = { val params = it.firstOrNull()?.packages?.firstOrNull()?.functions?.firstOrNull()?.parameters - Assertions.assertEquals( + assertEquals( Invariance(GenericTypeConstructor(DRI("kotlin", "IntArray"), emptyList())), (params?.firstOrNull()?.type as? GenericTypeConstructor)?.projections?.firstOrNull()) - Assertions.assertEquals( + assertEquals( Invariance(GenericTypeConstructor(DRI("kotlin", "IntArray"), emptyList())), (params?.get(1)?.type as? FunctionalTypeConstructor)?.projections?.get(0)) - Assertions.assertEquals( + assertEquals( Invariance(GenericTypeConstructor(DRI("kotlin", "IntArray"), emptyList())), (params?.get(1)?.type as? FunctionalTypeConstructor)?.projections?.get(1)) } @@ -101,11 +102,11 @@ class KotlinArrayDocumentableReplacerTest : BaseAbstractTest() { val myTestClass = it.firstOrNull()?.packages?.firstOrNull()?.classlikes?.firstOrNull() val property = myTestClass?.properties?.firstOrNull() - Assertions.assertEquals(GenericTypeConstructor(DRI("kotlin", "BooleanArray"), emptyList()), + assertEquals(GenericTypeConstructor(DRI("kotlin", "BooleanArray"), emptyList()), property?.type) - Assertions.assertEquals(GenericTypeConstructor(DRI("kotlin", "BooleanArray"), emptyList()), + assertEquals(GenericTypeConstructor(DRI("kotlin", "BooleanArray"), emptyList()), property?.getter?.type) - Assertions.assertEquals(GenericTypeConstructor(DRI("kotlin", "BooleanArray"), emptyList()), + assertEquals(GenericTypeConstructor(DRI("kotlin", "BooleanArray"), emptyList()), property?.setter?.parameters?.firstOrNull()?.type) } } @@ -126,7 +127,7 @@ class KotlinArrayDocumentableReplacerTest : BaseAbstractTest() { preMergeDocumentablesTransformationStage = { val arrTypealias = it.firstOrNull()?.packages?.firstOrNull()?.typealiases?.firstOrNull() - Assertions.assertEquals(GenericTypeConstructor(DRI("kotlin", "IntArray"), emptyList()), + assertEquals(GenericTypeConstructor(DRI("kotlin", "IntArray"), emptyList()), arrTypealias?.underlyingType?.values?.firstOrNull()) } } @@ -151,9 +152,9 @@ class KotlinArrayDocumentableReplacerTest : BaseAbstractTest() { val testFun = it.firstOrNull()?.packages?.firstOrNull()?.functions?.firstOrNull() val myTestClass = it.firstOrNull()?.packages?.firstOrNull()?.classlikes?.firstOrNull() as? DClass - Assertions.assertEquals(GenericTypeConstructor(DRI("kotlin","IntArray"), emptyList()), + assertEquals(GenericTypeConstructor(DRI("kotlin","IntArray"), emptyList()), testFun?.generics?.firstOrNull()?.bounds?.firstOrNull()) - Assertions.assertEquals(GenericTypeConstructor(DRI("kotlin","IntArray"), emptyList()), + assertEquals(GenericTypeConstructor(DRI("kotlin","IntArray"), emptyList()), myTestClass?.generics?.firstOrNull()?.bounds?.firstOrNull()) } } @@ -192,12 +193,12 @@ class KotlinArrayDocumentableReplacerTest : BaseAbstractTest() { ) { preMergeDocumentablesTransformationStage = { val paramsJS = it[1].packages.firstOrNull()?.functions?.firstOrNull()?.parameters - Assertions.assertNotEquals( + assertNotEquals( GenericTypeConstructor(DRI("kotlin", "IntArray"), emptyList()), paramsJS?.firstOrNull()?.type) val paramsJVM = it.firstOrNull()?.packages?.firstOrNull()?.functions?.firstOrNull()?.parameters - Assertions.assertEquals( + assertEquals( GenericTypeConstructor(DRI("kotlin", "IntArray"), emptyList()), paramsJVM?.firstOrNull()?.type) } diff --git a/plugins/base/src/test/kotlin/filter/VisibilityFilterTest.kt b/plugins/base/src/test/kotlin/filter/VisibilityFilterTest.kt index e1bd94ba..93a05bfd 100644 --- a/plugins/base/src/test/kotlin/filter/VisibilityFilterTest.kt +++ b/plugins/base/src/test/kotlin/filter/VisibilityFilterTest.kt @@ -7,11 +7,7 @@ import org.jetbrains.dokka.base.testApi.testRunner.BaseAbstractTest import org.jetbrains.dokka.model.DClass import org.jetbrains.dokka.model.DEnum import org.jetbrains.dokka.model.DModule -import org.junit.jupiter.api.Assertions -import org.junit.jupiter.api.Test -import kotlin.test.assertEquals -import kotlin.test.assertFalse -import kotlin.test.assertTrue +import kotlin.test.* class VisibilityFilterTest : BaseAbstractTest() { @@ -364,7 +360,7 @@ class VisibilityFilterTest : BaseAbstractTest() { configuration ) { preMergeDocumentablesTransformationStage = { - Assertions.assertNull( + assertNull( it.first().packages.first().properties.first().setter ) } @@ -429,7 +425,7 @@ class VisibilityFilterTest : BaseAbstractTest() { configuration ) { preMergeDocumentablesTransformationStage = { - Assertions.assertTrue( + assertTrue( it.first().packages.first().functions.size == 1 ) } @@ -461,7 +457,7 @@ class VisibilityFilterTest : BaseAbstractTest() { configuration ) { preMergeDocumentablesTransformationStage = { - Assertions.assertTrue( + assertTrue( it.first().packages.first().functions.isEmpty() ) } @@ -493,7 +489,7 @@ class VisibilityFilterTest : BaseAbstractTest() { configuration ) { preMergeDocumentablesTransformationStage = { - Assertions.assertTrue( + assertTrue( it.first().packages.first().functions.size == 1 ) } @@ -525,7 +521,7 @@ class VisibilityFilterTest : BaseAbstractTest() { configuration ) { preMergeDocumentablesTransformationStage = { - Assertions.assertNull( + assertNull( it.first().packages.first().properties.first().setter ) } @@ -567,7 +563,7 @@ class VisibilityFilterTest : BaseAbstractTest() { configuration ) { preMergeDocumentablesTransformationStage = { - Assertions.assertTrue( + assertTrue( it.first().packages.first().functions.size == 1 ) } @@ -609,7 +605,7 @@ class VisibilityFilterTest : BaseAbstractTest() { configuration ) { preMergeDocumentablesTransformationStage = { - Assertions.assertTrue( + assertTrue( it.first().packages.first().functions.isEmpty() ) } diff --git a/plugins/base/src/test/kotlin/issues/IssuesTest.kt b/plugins/base/src/test/kotlin/issues/IssuesTest.kt index 67aa3a1e..b57ab7ba 100644 --- a/plugins/base/src/test/kotlin/issues/IssuesTest.kt +++ b/plugins/base/src/test/kotlin/issues/IssuesTest.kt @@ -2,9 +2,9 @@ package issues import org.jetbrains.dokka.model.DClass import org.jetbrains.dokka.model.DFunction -import org.junit.jupiter.api.Test import utils.AbstractModelTest import utils.name +import kotlin.test.Test class IssuesTest : AbstractModelTest("/src/main/kotlin/issues/Test.kt", "issues") { diff --git a/plugins/base/src/test/kotlin/linkableContent/LinkableContentTest.kt b/plugins/base/src/test/kotlin/linkableContent/LinkableContentTest.kt index ccf62641..6e11929d 100644 --- a/plugins/base/src/test/kotlin/linkableContent/LinkableContentTest.kt +++ b/plugins/base/src/test/kotlin/linkableContent/LinkableContentTest.kt @@ -8,15 +8,16 @@ import org.jetbrains.dokka.model.dfs import org.jetbrains.dokka.model.doc.Text import org.jetbrains.dokka.pages.* import org.jsoup.Jsoup -import org.junit.jupiter.api.Assertions -import org.junit.jupiter.api.Test -import utils.OnlyDescriptors -import utils.OnlyDescriptorsMPP import utils.TestOutputWriterPlugin import utils.assertNotNull import java.net.URL import java.nio.file.Paths +import kotlin.test.Test import kotlin.test.assertEquals +import kotlin.test.assertNotEquals +import kotlin.test.assertNotNull +import utils.OnlyDescriptors +import utils.OnlyDescriptorsMPP class LinkableContentTest : BaseAbstractTest() { @@ -64,10 +65,10 @@ class LinkableContentTest : BaseAbstractTest() { testFromData(configuration) { documentablesMergingStage = { - Assertions.assertEquals(2, it.documentation.size) - Assertions.assertEquals(2, it.packages.size) - Assertions.assertEquals(1, it.packages.first().documentation.size) - Assertions.assertEquals(1, it.packages.last().documentation.size) + assertEquals(2, it.documentation.size) + assertEquals(2, it.packages.size) + assertEquals(1, it.packages.first().documentation.size) + assertEquals(1, it.packages.last().documentation.size) } } @@ -130,14 +131,14 @@ class LinkableContentTest : BaseAbstractTest() { renderingStage = { rootPageNode, dokkaContext -> val newRoot = SourceLinksTransformer(dokkaContext).invoke(rootPageNode) val moduleChildren = newRoot.children - Assertions.assertEquals(1, moduleChildren.size) + assertEquals(1, moduleChildren.size) val packageChildren = moduleChildren.first().children - Assertions.assertEquals(2, packageChildren.size) + assertEquals(2, packageChildren.size) packageChildren.forEach { val name = it.name.substringBefore("Class") val signature = (it as? ClasslikePageNode)?.content?.dfs { it is ContentGroup && it.dci.kind == ContentKind.Symbol }.assertNotNull("signature") val crl = signature.children.last().children[1] as? ContentResolvedLink - Assertions.assertEquals( + assertEquals( "https://github.com/user/repo/tree/master/src/${name.toLowerCase()}Main/kotlin/${name}Class.kt#L3", crl?.address ) @@ -193,13 +194,13 @@ class LinkableContentTest : BaseAbstractTest() { // val newRoot = DefaultSamplesTransformer(dokkaContext).invoke(rootPageNode) val newRoot = rootPageNode val moduleChildren = newRoot.children - Assertions.assertEquals(1, moduleChildren.size) + assertEquals(1, moduleChildren.size) val packageChildren = moduleChildren.first().children - Assertions.assertEquals(2, packageChildren.size) + assertEquals(2, packageChildren.size) packageChildren.forEach { pageNode -> val name = pageNode.name.substringBefore("Class") val classChildren = pageNode.children - Assertions.assertEquals(2, classChildren.size) + assertEquals(2, classChildren.size) val function = classChildren.find { it.name == "printWithExclamation" } val text = (function as MemberPageNode).content.let { it as ContentGroup }.children.last() .let { it as ContentDivergentGroup }.children.single().after @@ -207,7 +208,7 @@ class LinkableContentTest : BaseAbstractTest() { .let { it as ContentGroup }.children.single() .let { it as ContentCodeBlock }.children.single() .let { it as ContentText }.text - Assertions.assertEquals( + assertEquals( """|import p2.${name}Class |fun main() { | //sampleStart @@ -262,7 +263,7 @@ class LinkableContentTest : BaseAbstractTest() { child?.text == "S" } as? ContentDRILink - Assertions.assertEquals( + assertEquals( (sample.documentables.firstOrNull() as WithGenerics).generics.first().dri, returnTypeNode?.address ) @@ -300,7 +301,7 @@ class LinkableContentTest : BaseAbstractTest() { testFromData(configuration) { documentablesMergingStage = { - Assertions.assertNotEquals(null, it.packages.first().documentation.values.single().dfs { + assertNotEquals(null, it.packages.first().documentation.values.single().dfs { (it as? Text)?.body?.contains("@SqlTable") ?: false }) } @@ -354,20 +355,18 @@ class LinkableContentTest : BaseAbstractTest() { testFromData(configuration) { documentablesMergingStage = { module -> - module.documentation.entries.single { + val value = module.documentation.entries.single { it.key.displayName == "jvm" - }.value.run { - Assertions.assertNotNull(dfs { - (it as? Text)?.body == "This is second JVM documentation for module example" - }) + }.value + assertNotNull(value.dfs { + (it as? Text)?.body == "This is second JVM documentation for module example" + }) - Assertions.assertNotNull(dfs { - (it as? Text)?.body == "This is JVM documentation for module example" - }) - } + assertNotNull(value.dfs { + (it as? Text)?.body == "This is JVM documentation for module example" + }) } } - } @Test diff --git a/plugins/base/src/test/kotlin/linking/EnumValuesLinkingTest.kt b/plugins/base/src/test/kotlin/linking/EnumValuesLinkingTest.kt index 9ba428d6..a8604e2c 100644 --- a/plugins/base/src/test/kotlin/linking/EnumValuesLinkingTest.kt +++ b/plugins/base/src/test/kotlin/linking/EnumValuesLinkingTest.kt @@ -8,12 +8,12 @@ import org.jetbrains.dokka.model.doc.DocumentationLink import org.jetbrains.dokka.pages.ContentDRILink import org.jetbrains.dokka.pages.ContentPage import org.jsoup.Jsoup -import org.junit.jupiter.api.Assertions.assertEquals -import org.junit.jupiter.api.Assertions.assertNotNull -import org.junit.jupiter.api.Test -import utils.OnlyDescriptors import utils.TestOutputWriterPlugin import java.nio.file.Paths +import kotlin.test.Test +import kotlin.test.assertEquals +import kotlin.test.assertNotNull +import utils.OnlyDescriptors class EnumValuesLinkingTest : BaseAbstractTest() { diff --git a/plugins/base/src/test/kotlin/locationProvider/AndroidExternalLocationProviderTest.kt b/plugins/base/src/test/kotlin/locationProvider/AndroidExternalLocationProviderTest.kt index e9e0871a..a550f852 100644 --- a/plugins/base/src/test/kotlin/locationProvider/AndroidExternalLocationProviderTest.kt +++ b/plugins/base/src/test/kotlin/locationProvider/AndroidExternalLocationProviderTest.kt @@ -10,9 +10,9 @@ import org.jetbrains.dokka.links.Callable import org.jetbrains.dokka.links.DRI import org.jetbrains.dokka.links.TypeConstructor import org.jetbrains.dokka.plugability.DokkaContext -import org.junit.jupiter.api.Assertions.assertEquals -import org.junit.jupiter.api.Test import java.net.URL +import kotlin.test.Test +import kotlin.test.assertEquals class AndroidExternalLocationProviderTest : BaseAbstractTest() { private val android = ExternalDocumentation( diff --git a/plugins/base/src/test/kotlin/locationProvider/DefaultExternalLocationProviderTest.kt b/plugins/base/src/test/kotlin/locationProvider/DefaultExternalLocationProviderTest.kt index 870d8cf3..c4c5ff64 100644 --- a/plugins/base/src/test/kotlin/locationProvider/DefaultExternalLocationProviderTest.kt +++ b/plugins/base/src/test/kotlin/locationProvider/DefaultExternalLocationProviderTest.kt @@ -8,9 +8,9 @@ import org.jetbrains.dokka.links.Callable import org.jetbrains.dokka.links.DRI import org.jetbrains.dokka.links.TypeConstructor import org.jetbrains.dokka.plugability.DokkaContext -import org.junit.jupiter.api.Assertions.assertEquals -import org.junit.jupiter.api.Test import java.net.URL +import kotlin.test.Test +import kotlin.test.assertEquals class DefaultExternalLocationProviderTest : BaseAbstractTest() { private val testDataDir = diff --git a/plugins/base/src/test/kotlin/locationProvider/Dokka010ExternalLocationProviderTest.kt b/plugins/base/src/test/kotlin/locationProvider/Dokka010ExternalLocationProviderTest.kt index 241e0919..557cf66e 100644 --- a/plugins/base/src/test/kotlin/locationProvider/Dokka010ExternalLocationProviderTest.kt +++ b/plugins/base/src/test/kotlin/locationProvider/Dokka010ExternalLocationProviderTest.kt @@ -8,9 +8,9 @@ import org.jetbrains.dokka.links.Callable import org.jetbrains.dokka.links.DRI import org.jetbrains.dokka.links.TypeConstructor import org.jetbrains.dokka.plugability.DokkaContext -import org.junit.jupiter.api.Assertions.assertEquals -import org.junit.jupiter.api.Test import java.net.URL +import kotlin.test.Test +import kotlin.test.assertEquals class Dokka010ExternalLocationProviderTest : BaseAbstractTest() { private val testDataDir = diff --git a/plugins/base/src/test/kotlin/locationProvider/DokkaLocationProviderTest.kt b/plugins/base/src/test/kotlin/locationProvider/DokkaLocationProviderTest.kt index f43a4cd7..180c5238 100644 --- a/plugins/base/src/test/kotlin/locationProvider/DokkaLocationProviderTest.kt +++ b/plugins/base/src/test/kotlin/locationProvider/DokkaLocationProviderTest.kt @@ -5,8 +5,8 @@ import org.jetbrains.dokka.base.testApi.testRunner.BaseAbstractTest import org.jetbrains.dokka.links.DRI import org.jetbrains.dokka.pages.* import org.jetbrains.dokka.plugability.DokkaContext -import org.junit.jupiter.api.Assertions.assertEquals -import org.junit.jupiter.api.Test +import kotlin.test.Test +import kotlin.test.assertEquals class DokkaLocationProviderTest : BaseAbstractTest() { diff --git a/plugins/base/src/test/kotlin/locationProvider/JavadocExternalLocationProviderTest.kt b/plugins/base/src/test/kotlin/locationProvider/JavadocExternalLocationProviderTest.kt index 27e51caf..b0b466c5 100644 --- a/plugins/base/src/test/kotlin/locationProvider/JavadocExternalLocationProviderTest.kt +++ b/plugins/base/src/test/kotlin/locationProvider/JavadocExternalLocationProviderTest.kt @@ -10,9 +10,9 @@ import org.jetbrains.dokka.links.DRIExtraContainer import org.jetbrains.dokka.links.EnumEntryDRIExtra import org.jetbrains.dokka.links.PointingToDeclaration import org.jetbrains.dokka.plugability.DokkaContext -import org.junit.jupiter.api.Assertions.assertEquals -import org.junit.jupiter.api.Test import java.net.URL +import kotlin.test.Test +import kotlin.test.assertEquals class JavadocExternalLocationProviderTest : BaseAbstractTest() { private val testDataDir = diff --git a/plugins/base/src/test/kotlin/locationProvider/MultiModuleLinkingTest.kt b/plugins/base/src/test/kotlin/locationProvider/MultiModuleLinkingTest.kt index 031dd101..a4b2487a 100644 --- a/plugins/base/src/test/kotlin/locationProvider/MultiModuleLinkingTest.kt +++ b/plugins/base/src/test/kotlin/locationProvider/MultiModuleLinkingTest.kt @@ -6,9 +6,9 @@ import org.jetbrains.dokka.base.resolvers.shared.PackageList import org.jetbrains.dokka.base.testApi.testRunner.BaseAbstractTest import org.jetbrains.dokka.links.DRI import org.jetbrains.dokka.plugability.DokkaContext -import org.junit.jupiter.api.Assertions.assertEquals -import org.junit.jupiter.api.Test import java.net.URL +import kotlin.test.Test +import kotlin.test.assertEquals class MultiModuleLinkingTest : BaseAbstractTest() { private val testDataDir = diff --git a/plugins/base/src/test/kotlin/markdown/KDocTest.kt b/plugins/base/src/test/kotlin/markdown/KDocTest.kt index 69885931..774f07a6 100644 --- a/plugins/base/src/test/kotlin/markdown/KDocTest.kt +++ b/plugins/base/src/test/kotlin/markdown/KDocTest.kt @@ -4,7 +4,7 @@ import org.jetbrains.dokka.base.testApi.testRunner.BaseAbstractTest import org.jetbrains.dokka.model.DPackage import org.jetbrains.dokka.model.doc.DocumentationNode import org.jetbrains.dokka.pages.ModulePageNode -import org.junit.jupiter.api.Assertions.assertEquals +import kotlin.test.assertEquals abstract class KDocTest : BaseAbstractTest() { diff --git a/plugins/base/src/test/kotlin/markdown/LinkTest.kt b/plugins/base/src/test/kotlin/markdown/LinkTest.kt index 8ee5a20d..5cae4c42 100644 --- a/plugins/base/src/test/kotlin/markdown/LinkTest.kt +++ b/plugins/base/src/test/kotlin/markdown/LinkTest.kt @@ -8,9 +8,9 @@ import org.jetbrains.dokka.model.doc.* import org.jetbrains.dokka.pages.ClasslikePageNode import org.jetbrains.dokka.pages.ContentDRILink import org.jetbrains.dokka.pages.MemberPageNode -import org.junit.jupiter.api.Assertions.assertEquals -import org.junit.jupiter.api.Assertions.assertNotNull -import org.junit.jupiter.api.Test +import kotlin.test.Test +import kotlin.test.assertEquals +import kotlin.test.assertNotNull import utils.UsingJDK class LinkTest : BaseAbstractTest() { diff --git a/plugins/base/src/test/kotlin/markdown/ParserTest.kt b/plugins/base/src/test/kotlin/markdown/ParserTest.kt index e10a2260..49cbffd7 100644 --- a/plugins/base/src/test/kotlin/markdown/ParserTest.kt +++ b/plugins/base/src/test/kotlin/markdown/ParserTest.kt @@ -5,9 +5,10 @@ import markdown.KDocTest import org.jetbrains.dokka.analysis.markdown.jb.MARKDOWN_ELEMENT_FILE_NAME import org.jetbrains.dokka.analysis.markdown.jb.MarkdownParser import org.jetbrains.dokka.model.doc.* -import org.junit.jupiter.api.Disabled -import org.junit.jupiter.api.Test +import kotlin.test.Ignore +import kotlin.test.Test import kotlin.test.assertEquals +import kotlin.test.assertTrue class ParserTest : KDocTest() { @@ -677,7 +678,7 @@ class ParserTest : KDocTest() { executeTest(kdoc, expectedDocumentationNode) } - @Disabled //TODO: ATX_2 to ATX_6 and sometimes ATX_1 from jetbrains parser consumes white space. Need to handle it in their library + @Ignore //TODO: ATX_2 to ATX_6 and sometimes ATX_1 from jetbrains parser consumes white space. Need to handle it in their library @Test fun `All headers`() { val kdoc = """ @@ -863,7 +864,7 @@ class ParserTest : KDocTest() { executeTest(kdoc, expectedDocumentationNode) } - @Disabled //TODO: Again ATX_1 consumes white space + @Ignore //TODO: Again ATX_1 consumes white space @Test fun `Blockquote nested with fancy text enhancement`() { val kdoc = """ @@ -1483,7 +1484,7 @@ class ParserTest : KDocTest() { val exception = runCatching { executeTest(kdoc, expectedDocumentationNode) }.exceptionOrNull() val expectedMessage = "Wrong AST Tree. Header does not contain expected content in Test.kt/example.Test, element starts from offset 0 and ends 3: ###" - assert( + assertTrue( exception?.message == expectedMessage || /* for K2 */ exception?.cause?.cause?.message == expectedMessage ) diff --git a/plugins/base/src/test/kotlin/model/ClassesTest.kt b/plugins/base/src/test/kotlin/model/ClassesTest.kt index e358945e..cf11c62f 100644 --- a/plugins/base/src/test/kotlin/model/ClassesTest.kt +++ b/plugins/base/src/test/kotlin/model/ClassesTest.kt @@ -5,8 +5,8 @@ import org.jetbrains.dokka.links.TypeConstructor import org.jetbrains.dokka.links.sureClassNames import org.jetbrains.dokka.model.* import org.jetbrains.dokka.model.KotlinModifier.* -import org.junit.jupiter.api.Assertions.assertNull -import org.junit.jupiter.api.Test +import kotlin.test.assertNull +import kotlin.test.Test import utils.* diff --git a/plugins/base/src/test/kotlin/model/CommentTest.kt b/plugins/base/src/test/kotlin/model/CommentTest.kt index cd149209..1131e8dd 100644 --- a/plugins/base/src/test/kotlin/model/CommentTest.kt +++ b/plugins/base/src/test/kotlin/model/CommentTest.kt @@ -3,11 +3,11 @@ package model import org.jetbrains.dokka.model.DClass import org.jetbrains.dokka.model.DProperty import org.jetbrains.dokka.model.doc.* -import org.junit.jupiter.api.Test import utils.AbstractModelTest import utils.assertNotNull import utils.comments import utils.docs +import kotlin.test.Test class CommentTest : AbstractModelTest("/src/main/kotlin/comment/Test.kt", "comment") { diff --git a/plugins/base/src/test/kotlin/model/ExtensionsTest.kt b/plugins/base/src/test/kotlin/model/ExtensionsTest.kt index b54f8deb..f0f86d7f 100644 --- a/plugins/base/src/test/kotlin/model/ExtensionsTest.kt +++ b/plugins/base/src/test/kotlin/model/ExtensionsTest.kt @@ -6,8 +6,8 @@ import org.jetbrains.dokka.model.DFunction import org.jetbrains.dokka.model.DInterface import org.jetbrains.dokka.model.Documentable import org.jetbrains.dokka.model.properties.WithExtraProperties -import org.junit.jupiter.api.Test import utils.AbstractModelTest +import kotlin.test.Test import utils.UsingJDK class ExtensionsTest : AbstractModelTest("/src/main/kotlin/classes/Test.kt", "classes") { @@ -87,7 +87,7 @@ class ExtensionsTest : AbstractModelTest("/src/main/kotlin/classes/Test.kt", "cl } } } - + @Test fun `should be extension for typealias`() { inlineModelTest( diff --git a/plugins/base/src/test/kotlin/model/FunctionsTest.kt b/plugins/base/src/test/kotlin/model/FunctionsTest.kt index 3410f9ef..d1c34c29 100644 --- a/plugins/base/src/test/kotlin/model/FunctionsTest.kt +++ b/plugins/base/src/test/kotlin/model/FunctionsTest.kt @@ -2,8 +2,12 @@ package model import org.jetbrains.dokka.links.DRI import org.jetbrains.dokka.model.* -import org.junit.jupiter.api.Test -import utils.* +import utils.AbstractModelTest +import utils.assertNotNull +import utils.comments +import utils.OnlyDescriptors +import utils.name +import kotlin.test.Test class FunctionTest : AbstractModelTest("/src/main/kotlin/function/Test.kt", "function") { diff --git a/plugins/base/src/test/kotlin/model/InheritorsTest.kt b/plugins/base/src/test/kotlin/model/InheritorsTest.kt index 641f6ef5..8ebb65c2 100644 --- a/plugins/base/src/test/kotlin/model/InheritorsTest.kt +++ b/plugins/base/src/test/kotlin/model/InheritorsTest.kt @@ -7,10 +7,10 @@ import org.jetbrains.dokka.model.DFunction import org.jetbrains.dokka.model.DInterface import org.jetbrains.dokka.model.doc.P import org.jetbrains.dokka.model.doc.Text -import org.junit.jupiter.api.Assertions.assertTrue -import org.junit.jupiter.api.Test import utils.AbstractModelTest import utils.assertNotNull +import kotlin.test.Test +import kotlin.test.assertTrue class InheritorsTest : AbstractModelTest("/src/main/kotlin/inheritors/Test.kt", "inheritors") { diff --git a/plugins/base/src/test/kotlin/model/JavaTest.kt b/plugins/base/src/test/kotlin/model/JavaTest.kt index a0605a5e..f8e45ca2 100644 --- a/plugins/base/src/test/kotlin/model/JavaTest.kt +++ b/plugins/base/src/test/kotlin/model/JavaTest.kt @@ -7,11 +7,14 @@ import org.jetbrains.dokka.links.* import org.jetbrains.dokka.model.* import org.jetbrains.dokka.model.doc.Param import org.jetbrains.dokka.model.doc.Text -import org.junit.jupiter.api.Assertions.assertTrue -import org.junit.jupiter.api.Test -import utils.* +import utils.AbstractModelTest import utils.assertContains +import utils.assertNotNull +import utils.name +import utils.JavaCode +import kotlin.test.Test import kotlin.test.assertEquals +import kotlin.test.assertTrue @JavaCode class JavaTest : AbstractModelTest("/src/main/kotlin/java/Test.java", "java") { @@ -464,17 +467,17 @@ class JavaTest : AbstractModelTest("/src/main/kotlin/java/Test.java", "java") { when (function.name) { "superBound" -> { assertTrue(variance is Contravariance<*>) - val bound = (variance as Contravariance<*>).inner + val bound = variance.inner assertEquals((bound as GenericTypeConstructor).dri.classNames, "String") } "extendsBound" -> { assertTrue(variance is Covariance<*>) - val bound = (variance as Covariance<*>).inner + val bound = variance.inner assertEquals((bound as GenericTypeConstructor).dri.classNames, "String") } "unbounded" -> { assertTrue(variance is Covariance<*>) - val bound = (variance as Covariance<*>).inner + val bound = variance.inner assertTrue(bound is JavaObject) } } diff --git a/plugins/base/src/test/kotlin/model/MultiLanguageInheritanceTest.kt b/plugins/base/src/test/kotlin/model/MultiLanguageInheritanceTest.kt index 6f08c89d..7b807b3a 100644 --- a/plugins/base/src/test/kotlin/model/MultiLanguageInheritanceTest.kt +++ b/plugins/base/src/test/kotlin/model/MultiLanguageInheritanceTest.kt @@ -7,10 +7,10 @@ import org.jetbrains.dokka.model.dfs import org.jetbrains.dokka.model.doc.* import org.jetbrains.dokka.model.withDescendants import org.jetbrains.dokka.utilities.firstIsInstanceOrNull -import org.junit.jupiter.api.Test import translators.documentationOf import utils.JavaCode import utils.docs +import kotlin.test.Test import kotlin.test.assertEquals @JavaCode diff --git a/plugins/base/src/test/kotlin/model/ObjectTest.kt b/plugins/base/src/test/kotlin/model/ObjectTest.kt index 86045110..2f307adb 100644 --- a/plugins/base/src/test/kotlin/model/ObjectTest.kt +++ b/plugins/base/src/test/kotlin/model/ObjectTest.kt @@ -3,8 +3,8 @@ package model import org.jetbrains.dokka.model.AdditionalModifiers import org.jetbrains.dokka.model.DObject import org.jetbrains.dokka.model.ExtraModifiers -import org.junit.jupiter.api.Test import utils.AbstractModelTest +import kotlin.test.Test class ObjectTest : AbstractModelTest("/src/main/kotlin/objects/Test.kt", "objects") { diff --git a/plugins/base/src/test/kotlin/model/PackagesTest.kt b/plugins/base/src/test/kotlin/model/PackagesTest.kt index b9e7051d..33675356 100644 --- a/plugins/base/src/test/kotlin/model/PackagesTest.kt +++ b/plugins/base/src/test/kotlin/model/PackagesTest.kt @@ -1,8 +1,8 @@ package model import org.jetbrains.dokka.model.DPackage -import org.junit.jupiter.api.Test import utils.AbstractModelTest +import kotlin.test.Test class PackagesTest : AbstractModelTest("/src/main/kotlin/packages/Test.kt", "packages") { diff --git a/plugins/base/src/test/kotlin/model/PropertyTest.kt b/plugins/base/src/test/kotlin/model/PropertyTest.kt index d38667bf..8b15bc68 100644 --- a/plugins/base/src/test/kotlin/model/PropertyTest.kt +++ b/plugins/base/src/test/kotlin/model/PropertyTest.kt @@ -1,10 +1,10 @@ package model import org.jetbrains.dokka.model.* -import org.junit.jupiter.api.Test import utils.AbstractModelTest import utils.assertNotNull import utils.name +import kotlin.test.Test class PropertyTest : AbstractModelTest("/src/main/kotlin/property/Test.kt", "property") { diff --git a/plugins/base/src/test/kotlin/model/annotations/JavaAnnotationsForParametersTest.kt b/plugins/base/src/test/kotlin/model/annotations/JavaAnnotationsForParametersTest.kt index 35997681..aa375423 100644 --- a/plugins/base/src/test/kotlin/model/annotations/JavaAnnotationsForParametersTest.kt +++ b/plugins/base/src/test/kotlin/model/annotations/JavaAnnotationsForParametersTest.kt @@ -4,8 +4,8 @@ import org.jetbrains.dokka.base.signatures.KotlinSignatureUtils.annotations import org.jetbrains.dokka.links.DRI import org.jetbrains.dokka.model.* import org.jetbrains.dokka.utilities.cast -import org.junit.jupiter.api.Test import utils.AbstractModelTest +import kotlin.test.Test import utils.JavaCode import kotlin.test.assertEquals import kotlin.test.assertTrue @@ -175,4 +175,5 @@ class JavaAnnotationsForParametersTest : AbstractModelTest("/src/main/kotlin/jav } } } -}
\ No newline at end of file +} + diff --git a/plugins/base/src/test/kotlin/model/annotations/JavaAnnotationsTest.kt b/plugins/base/src/test/kotlin/model/annotations/JavaAnnotationsTest.kt index 0abf504e..ad5241ae 100644 --- a/plugins/base/src/test/kotlin/model/annotations/JavaAnnotationsTest.kt +++ b/plugins/base/src/test/kotlin/model/annotations/JavaAnnotationsTest.kt @@ -2,13 +2,9 @@ package model.annotations import org.jetbrains.dokka.base.testApi.testRunner.BaseAbstractTest import org.jetbrains.dokka.model.* -import org.junit.jupiter.api.Test import translators.findClasslike +import kotlin.test.* import utils.JavaCode -import kotlin.test.assertEquals -import kotlin.test.assertFalse -import kotlin.test.assertNotNull -import kotlin.test.assertTrue @JavaCode class JavaAnnotationsTest : BaseAbstractTest() { diff --git a/plugins/base/src/test/kotlin/model/annotations/KotlinAnnotationsForParametersTest.kt b/plugins/base/src/test/kotlin/model/annotations/KotlinAnnotationsForParametersTest.kt index c459cc34..7a7591fb 100644 --- a/plugins/base/src/test/kotlin/model/annotations/KotlinAnnotationsForParametersTest.kt +++ b/plugins/base/src/test/kotlin/model/annotations/KotlinAnnotationsForParametersTest.kt @@ -4,8 +4,8 @@ import org.jetbrains.dokka.base.signatures.KotlinSignatureUtils.annotations import org.jetbrains.dokka.links.DRI import org.jetbrains.dokka.model.* import org.jetbrains.dokka.utilities.cast -import org.junit.jupiter.api.Test import utils.AbstractModelTest +import kotlin.test.Test import kotlin.test.assertEquals import kotlin.test.assertTrue @@ -98,4 +98,4 @@ class KotlinAnnotationsForParametersTest : AbstractModelTest("/src/main/kotlin/a } } } -}
\ No newline at end of file +} diff --git a/plugins/base/src/test/kotlin/multiplatform/BasicMultiplatformTest.kt b/plugins/base/src/test/kotlin/multiplatform/BasicMultiplatformTest.kt index 1e4869f8..b7a00dcd 100644 --- a/plugins/base/src/test/kotlin/multiplatform/BasicMultiplatformTest.kt +++ b/plugins/base/src/test/kotlin/multiplatform/BasicMultiplatformTest.kt @@ -1,8 +1,8 @@ package multiplatform import org.jetbrains.dokka.base.testApi.testRunner.BaseAbstractTest -import org.junit.jupiter.api.Assertions.assertEquals -import org.junit.jupiter.api.Test +import kotlin.test.Test +import kotlin.test.assertEquals class BasicMultiplatformTest : BaseAbstractTest() { diff --git a/plugins/base/src/test/kotlin/packageList/PackageListTest.kt b/plugins/base/src/test/kotlin/packageList/PackageListTest.kt index 310a23c6..48d360d5 100644 --- a/plugins/base/src/test/kotlin/packageList/PackageListTest.kt +++ b/plugins/base/src/test/kotlin/packageList/PackageListTest.kt @@ -2,8 +2,8 @@ package packageList import org.jetbrains.dokka.base.renderers.PackageListService import org.jetbrains.dokka.base.resolvers.shared.RecognizedLinkFormat -import org.junit.jupiter.api.Assertions.assertEquals -import org.junit.jupiter.api.Test +import kotlin.test.Test +import kotlin.test.assertEquals class PackageListTest { @Test diff --git a/plugins/base/src/test/kotlin/pageMerger/PageNodeMergerTest.kt b/plugins/base/src/test/kotlin/pageMerger/PageNodeMergerTest.kt index 13431bd2..e386f95c 100644 --- a/plugins/base/src/test/kotlin/pageMerger/PageNodeMergerTest.kt +++ b/plugins/base/src/test/kotlin/pageMerger/PageNodeMergerTest.kt @@ -4,11 +4,11 @@ import org.jetbrains.dokka.base.testApi.testRunner.BaseAbstractTest import org.jetbrains.dokka.model.dfs import org.jetbrains.dokka.model.withDescendants import org.jetbrains.dokka.pages.* -import org.junit.jupiter.api.Assertions.assertTrue -import org.junit.jupiter.api.Disabled import org.junit.jupiter.api.RepeatedTest -import org.junit.jupiter.api.Test +import kotlin.test.Ignore +import kotlin.test.Test import kotlin.test.assertEquals +import kotlin.test.assertTrue class PageNodeMergerTest : BaseAbstractTest() { @@ -42,16 +42,16 @@ class PageNodeMergerTest : BaseAbstractTest() { val testT = allChildren.filter { it.name == "testT" } val test = allChildren.filter { it.name == "test" } - assertTrue(testT.size == 1) { "There can be only one testT page" } - assertTrue(testT.first().dri.size == 2) { "testT page should have 2 DRI, but has ${testT.first().dri.size}" } + assertTrue(testT.size == 1, "There can be only one testT page") + assertTrue(testT.first().dri.size == 2, "testT page should have 2 DRI, but has ${testT.first().dri.size}") - assertTrue(test.size == 1) { "There can be only one test page" } - assertTrue(test.first().dri.size == 2) { "test page should have 2 DRI, but has ${test.first().dri.size}" } + assertTrue(test.size == 1, "There can be only one test page") + assertTrue(test.first().dri.size == 2, "test page should have 2 DRI, but has ${test.first().dri.size}") } } } - @Disabled("TODO: reenable when we have infrastructure for turning off extensions") + @Ignore("TODO: reenable when we have infrastructure for turning off extensions") @Test fun defaultStrategyTest() { val strList: MutableList<String> = mutableListOf() @@ -76,13 +76,13 @@ class PageNodeMergerTest : BaseAbstractTest() { val testT = allChildren.filter { it.name == "testT" } val test = allChildren.filter { it.name == "test" } - assertTrue(testT.size == 1) { "There can be only one testT page" } - assertTrue(testT.first().dri.size == 1) { "testT page should have single DRI, but has ${testT.first().dri.size}" } + assertTrue(testT.size == 1, "There can be only one testT page") + assertTrue(testT.first().dri.size == 1, "testT page should have single DRI, but has ${testT.first().dri.size}") - assertTrue(test.size == 1) { "There can be only one test page" } - assertTrue(test.first().dri.size == 1) { "test page should have single DRI, but has ${test.first().dri.size}" } + assertTrue(test.size == 1, "There can be only one test page") + assertTrue(test.first().dri.size == 1, "test page should have single DRI, but has ${test.first().dri.size}") - assertTrue(strList.count() == 2) { "Expected 2 warnings, got ${strList.count()}" } + assertTrue(strList.count() == 2, "Expected 2 warnings, got ${strList.count()}") } } } @@ -142,13 +142,19 @@ class PageNodeMergerTest : BaseAbstractTest() { val jvmClass = allChildren.filter { it.name == "[jvm]DoNotMerge" } val jsClass = allChildren.filter { it.name == "[js]DoNotMerge" } val noClass = allChildren.filter { it.name == "DoNotMerge" } - assertTrue(jvmClass.size == 1) { "There can be only one DoNotMerge(jvm) page" } - assertTrue(jvmClass.first().documentables.firstOrNull()?.sourceSets?.single()?.analysisPlatform?.key == "jvm") { "[jvm]DoNotMerge should have only jvm sources" } + assertTrue(jvmClass.size == 1, "There can be only one DoNotMerge(jvm) page") + assertTrue( + jvmClass.first().documentables.firstOrNull()?.sourceSets?.single()?.analysisPlatform?.key == "jvm", + "[jvm]DoNotMerge should have only jvm sources" + ) - assertTrue(jsClass.size == 1) { "There can be only one DoNotMerge(js) page" } - assertTrue(jsClass.first().documentables.firstOrNull()?.sourceSets?.single()?.analysisPlatform?.key == "js") { "[js]DoNotMerge should have only js sources" } + assertTrue(jsClass.size == 1, "There can be only one DoNotMerge(js) page") + assertTrue( + jsClass.first().documentables.firstOrNull()?.sourceSets?.single()?.analysisPlatform?.key == "js", + "[js]DoNotMerge should have only js sources" + ) - assertTrue(noClass.isEmpty()) { "There can't be any DoNotMerge page" } + assertTrue(noClass.isEmpty(), "There can't be any DoNotMerge page") } } } diff --git a/plugins/base/src/test/kotlin/parsers/JavadocParserTest.kt b/plugins/base/src/test/kotlin/parsers/JavadocParserTest.kt index 4b376c73..a3f1710c 100644 --- a/plugins/base/src/test/kotlin/parsers/JavadocParserTest.kt +++ b/plugins/base/src/test/kotlin/parsers/JavadocParserTest.kt @@ -8,12 +8,12 @@ import org.jetbrains.dokka.model.DEnum import org.jetbrains.dokka.model.DModule import org.jetbrains.dokka.model.doc.* import org.jetbrains.dokka.utilities.firstIsInstanceOrNull -import org.junit.jupiter.api.Assertions.assertEquals -import org.junit.jupiter.api.Test -import utils.JavaCode import utils.docs import utils.text +import kotlin.test.Test +import kotlin.test.assertEquals import kotlin.test.assertNotNull +import utils.JavaCode @JavaCode class JavadocParserTest : BaseAbstractTest() { diff --git a/plugins/base/src/test/kotlin/renderers/html/BasicTest.kt b/plugins/base/src/test/kotlin/renderers/html/BasicTest.kt index fbcdf70e..8817ea27 100644 --- a/plugins/base/src/test/kotlin/renderers/html/BasicTest.kt +++ b/plugins/base/src/test/kotlin/renderers/html/BasicTest.kt @@ -2,10 +2,10 @@ package renderers.html import org.jetbrains.dokka.base.renderers.html.HtmlRenderer import org.jetbrains.dokka.links.DRI -import org.junit.jupiter.api.Test import renderers.testPage import utils.Span import utils.match +import kotlin.test.Test class BasicTest : HtmlRenderingOnlyTestBase() { @Test diff --git a/plugins/base/src/test/kotlin/renderers/html/BreadcrumbsTest.kt b/plugins/base/src/test/kotlin/renderers/html/BreadcrumbsTest.kt index bebc41dc..1acafacc 100644 --- a/plugins/base/src/test/kotlin/renderers/html/BreadcrumbsTest.kt +++ b/plugins/base/src/test/kotlin/renderers/html/BreadcrumbsTest.kt @@ -2,9 +2,9 @@ package renderers.html import org.jetbrains.dokka.base.testApi.testRunner.BaseAbstractTest import org.jsoup.nodes.Element -import org.junit.jupiter.api.Test import signatures.renderedContent import utils.* +import kotlin.test.Test class BreadcrumbsTest : BaseAbstractTest() { diff --git a/plugins/base/src/test/kotlin/renderers/html/CoverPageTest.kt b/plugins/base/src/test/kotlin/renderers/html/CoverPageTest.kt index 522f9037..ef41a00a 100644 --- a/plugins/base/src/test/kotlin/renderers/html/CoverPageTest.kt +++ b/plugins/base/src/test/kotlin/renderers/html/CoverPageTest.kt @@ -1,9 +1,9 @@ package renderers.html import org.jetbrains.dokka.base.testApi.testRunner.BaseAbstractTest -import org.junit.jupiter.api.Test import signatures.renderedContent import utils.TestOutputWriterPlugin +import kotlin.test.Test import kotlin.test.assertEquals class CoverPageTest : BaseAbstractTest() { @@ -44,4 +44,4 @@ class CoverPageTest : BaseAbstractTest() { } } } -}
\ No newline at end of file +} diff --git a/plugins/base/src/test/kotlin/renderers/html/CustomFooterTest.kt b/plugins/base/src/test/kotlin/renderers/html/CustomFooterTest.kt index c1ef6121..0b53d1c2 100644 --- a/plugins/base/src/test/kotlin/renderers/html/CustomFooterTest.kt +++ b/plugins/base/src/test/kotlin/renderers/html/CustomFooterTest.kt @@ -9,12 +9,12 @@ import org.jetbrains.dokka.base.renderers.html.HtmlRenderer import org.jetbrains.dokka.base.templating.toJsonString import org.jsoup.Jsoup import org.jsoup.nodes.Element -import org.junit.jupiter.api.Test import renderers.testPage import utils.A import utils.Div import utils.Span import utils.match +import kotlin.test.Test class CustomFooterTest : HtmlRenderingOnlyTestBase() { @Test @@ -41,4 +41,4 @@ class CustomFooterTest : HtmlRenderingOnlyTestBase() { override val renderedContent: Element get() = files.contents.getValue("test-page.html").let { Jsoup.parse(it) }.select(".footer").single() -}
\ No newline at end of file +} diff --git a/plugins/base/src/test/kotlin/renderers/html/DivergentTest.kt b/plugins/base/src/test/kotlin/renderers/html/DivergentTest.kt index f9dd92da..1542c6c2 100644 --- a/plugins/base/src/test/kotlin/renderers/html/DivergentTest.kt +++ b/plugins/base/src/test/kotlin/renderers/html/DivergentTest.kt @@ -3,10 +3,10 @@ package renderers.html import org.jetbrains.dokka.base.renderers.html.HtmlRenderer import org.jetbrains.dokka.links.DRI import org.jetbrains.dokka.pages.ContentDivergentGroup -import org.junit.jupiter.api.Test import renderers.testPage import utils.Br import utils.match +import kotlin.test.Test import kotlin.test.assertEquals class DivergentTest : HtmlRenderingOnlyTestBase() { diff --git a/plugins/base/src/test/kotlin/renderers/html/FooterMessageTest.kt b/plugins/base/src/test/kotlin/renderers/html/FooterMessageTest.kt index d91c402e..82584121 100644 --- a/plugins/base/src/test/kotlin/renderers/html/FooterMessageTest.kt +++ b/plugins/base/src/test/kotlin/renderers/html/FooterMessageTest.kt @@ -4,11 +4,11 @@ import org.jetbrains.dokka.base.DokkaBaseConfiguration.Companion.defaultFooterMe import org.jetbrains.dokka.base.renderers.html.HtmlRenderer import org.jsoup.Jsoup import org.jsoup.nodes.Element -import org.junit.jupiter.api.Test import renderers.testPage import utils.A import utils.Span import utils.match +import kotlin.test.Test class FooterMessageTest : HtmlRenderingOnlyTestBase() { @Test @@ -24,4 +24,4 @@ class FooterMessageTest : HtmlRenderingOnlyTestBase() { override val renderedContent: Element get() = files.contents.getValue("test-page.html").let { Jsoup.parse(it) }.select(".footer").single() -}
\ No newline at end of file +} diff --git a/plugins/base/src/test/kotlin/renderers/html/FormattingUtilsTest.kt b/plugins/base/src/test/kotlin/renderers/html/FormattingUtilsTest.kt index 3e5ceb75..9957d3f2 100644 --- a/plugins/base/src/test/kotlin/renderers/html/FormattingUtilsTest.kt +++ b/plugins/base/src/test/kotlin/renderers/html/FormattingUtilsTest.kt @@ -4,7 +4,7 @@ import kotlinx.html.body import kotlinx.html.html import kotlinx.html.stream.createHTML import org.jetbrains.dokka.base.renderers.html.buildBreakableText -import org.junit.jupiter.api.Test +import kotlin.test.Test import kotlin.test.assertEquals class FormattingUtilsTest { @@ -79,4 +79,4 @@ class FormattingUtilsTest { assertEquals(expectedHtml.trim(), html.trim()) } -}
\ No newline at end of file +} diff --git a/plugins/base/src/test/kotlin/renderers/html/GroupWrappingTest.kt b/plugins/base/src/test/kotlin/renderers/html/GroupWrappingTest.kt index f69cf80f..e1faa460 100644 --- a/plugins/base/src/test/kotlin/renderers/html/GroupWrappingTest.kt +++ b/plugins/base/src/test/kotlin/renderers/html/GroupWrappingTest.kt @@ -2,11 +2,11 @@ package renderers.html import org.jetbrains.dokka.base.renderers.html.HtmlRenderer import org.jetbrains.dokka.pages.TextStyle -import org.junit.jupiter.api.Test import renderers.testPage import utils.Div import utils.P import utils.match +import kotlin.test.Test class GroupWrappingTest : HtmlRenderingOnlyTestBase() { diff --git a/plugins/base/src/test/kotlin/renderers/html/ListStylesTest.kt b/plugins/base/src/test/kotlin/renderers/html/ListStylesTest.kt index 8b11dad1..ba063844 100644 --- a/plugins/base/src/test/kotlin/renderers/html/ListStylesTest.kt +++ b/plugins/base/src/test/kotlin/renderers/html/ListStylesTest.kt @@ -2,12 +2,12 @@ package renderers.html import org.jetbrains.dokka.base.renderers.html.HtmlRenderer import org.jetbrains.dokka.pages.ListStyle -import org.junit.jupiter.api.Test import renderers.testPage import utils.Dd import utils.Dl import utils.Dt import utils.match +import kotlin.test.Test class ListStylesTest : HtmlRenderingOnlyTestBase() { diff --git a/plugins/base/src/test/kotlin/renderers/html/NavigationIconTest.kt b/plugins/base/src/test/kotlin/renderers/html/NavigationIconTest.kt index fb2c53cd..cbdc28d8 100644 --- a/plugins/base/src/test/kotlin/renderers/html/NavigationIconTest.kt +++ b/plugins/base/src/test/kotlin/renderers/html/NavigationIconTest.kt @@ -1,11 +1,11 @@ package renderers.html import org.jetbrains.dokka.base.testApi.testRunner.BaseAbstractTest -import org.junit.jupiter.api.Test import utils.TestOutputWriterPlugin import utils.UsingJDK import utils.navigationHtml import utils.selectNavigationGrid +import kotlin.test.Test import kotlin.test.assertEquals class NavigationIconTest : BaseAbstractTest() { diff --git a/plugins/base/src/test/kotlin/renderers/html/NavigationTest.kt b/plugins/base/src/test/kotlin/renderers/html/NavigationTest.kt index 75993e49..7f199ddd 100644 --- a/plugins/base/src/test/kotlin/renderers/html/NavigationTest.kt +++ b/plugins/base/src/test/kotlin/renderers/html/NavigationTest.kt @@ -3,10 +3,11 @@ package renderers.html import org.jetbrains.dokka.base.renderers.html.NavigationNodeIcon import org.jetbrains.dokka.base.testApi.testRunner.BaseAbstractTest import org.jsoup.nodes.Element -import org.junit.jupiter.api.Test import utils.TestOutputWriterPlugin import utils.navigationHtml +import kotlin.test.Test import kotlin.test.assertEquals +import kotlin.test.assertNotNull import kotlin.test.assertNull class NavigationTest : BaseAbstractTest() { @@ -389,7 +390,7 @@ class NavigationTest : BaseAbstractTest() { assertEquals(id, this.id()) val link = this.selectFirst("a") - checkNotNull(link) + assertNotNull(link) assertEquals(text, link.text()) assertEquals(address, link.attr("href")) if (icon != null) { diff --git a/plugins/base/src/test/kotlin/renderers/html/SearchbarDataInstallerTest.kt b/plugins/base/src/test/kotlin/renderers/html/SearchbarDataInstallerTest.kt index 33f86e9f..c19ad55b 100644 --- a/plugins/base/src/test/kotlin/renderers/html/SearchbarDataInstallerTest.kt +++ b/plugins/base/src/test/kotlin/renderers/html/SearchbarDataInstallerTest.kt @@ -1,10 +1,10 @@ package renderers.html import org.jetbrains.dokka.base.testApi.testRunner.BaseAbstractTest -import org.junit.Test -import org.junit.jupiter.api.Assertions import utils.TestOutputWriterPlugin import utils.pagesJson +import kotlin.test.Test +import kotlin.test.assertEquals class SearchbarDataInstallerTest: BaseAbstractTest() { @@ -36,11 +36,11 @@ class SearchbarDataInstallerTest: BaseAbstractTest() { renderingStage = { _, _ -> val searchRecords = writerPlugin.writer.pagesJson() - Assertions.assertEquals( + assertEquals( "Test", searchRecords.find { record -> record.name == "class Test" }?.description ?: "" ) } } } -}
\ No newline at end of file +} diff --git a/plugins/base/src/test/kotlin/renderers/html/SourceSetDependentHintTest.kt b/plugins/base/src/test/kotlin/renderers/html/SourceSetDependentHintTest.kt index 633a59a7..47874a4c 100644 --- a/plugins/base/src/test/kotlin/renderers/html/SourceSetDependentHintTest.kt +++ b/plugins/base/src/test/kotlin/renderers/html/SourceSetDependentHintTest.kt @@ -3,12 +3,12 @@ package renderers.html import org.jetbrains.dokka.Platform import org.jetbrains.dokka.base.renderers.html.HtmlRenderer import org.jetbrains.dokka.pages.TextStyle -import org.junit.jupiter.api.Test import renderers.testPage import testApi.testRunner.defaultSourceSet import utils.Div import utils.match import java.io.File +import kotlin.test.Test class SourceSetDependentHintTest : HtmlRenderingOnlyTestBase() { diff --git a/plugins/base/src/test/kotlin/renderers/html/SourceSetFilterTest.kt b/plugins/base/src/test/kotlin/renderers/html/SourceSetFilterTest.kt index e6155535..75ee7f4b 100644 --- a/plugins/base/src/test/kotlin/renderers/html/SourceSetFilterTest.kt +++ b/plugins/base/src/test/kotlin/renderers/html/SourceSetFilterTest.kt @@ -1,10 +1,10 @@ package renderers.html import org.jetbrains.dokka.base.testApi.testRunner.BaseAbstractTest -import org.junit.jupiter.api.Assertions.assertEquals -import org.junit.jupiter.api.Test import signatures.renderedContent import utils.TestOutputWriterPlugin +import kotlin.test.Test +import kotlin.test.assertEquals class SourceSetFilterTest : BaseAbstractTest() { diff --git a/plugins/base/src/test/kotlin/renderers/html/TabbedContentTest.kt b/plugins/base/src/test/kotlin/renderers/html/TabbedContentTest.kt index 7c42c22b..a2e2617a 100644 --- a/plugins/base/src/test/kotlin/renderers/html/TabbedContentTest.kt +++ b/plugins/base/src/test/kotlin/renderers/html/TabbedContentTest.kt @@ -2,9 +2,9 @@ package renderers.html import org.jetbrains.dokka.base.testApi.testRunner.BaseAbstractTest import org.jsoup.nodes.Element -import org.junit.jupiter.api.Test import signatures.renderedContent import utils.TestOutputWriterPlugin +import kotlin.test.Test import kotlin.test.assertEquals class TabbedContentTest : BaseAbstractTest() { @@ -178,4 +178,4 @@ class TabbedContentTest : BaseAbstractTest() { } } } -}
\ No newline at end of file +} diff --git a/plugins/base/src/test/kotlin/renderers/html/TextStylesTest.kt b/plugins/base/src/test/kotlin/renderers/html/TextStylesTest.kt index 507f1779..07415efe 100644 --- a/plugins/base/src/test/kotlin/renderers/html/TextStylesTest.kt +++ b/plugins/base/src/test/kotlin/renderers/html/TextStylesTest.kt @@ -5,9 +5,9 @@ import org.jetbrains.dokka.pages.TextStyle import org.jetbrains.dokka.pages.TokenStyle import org.jsoup.Jsoup import org.jsoup.nodes.Element -import org.junit.jupiter.api.Test import renderers.testPage import utils.* +import kotlin.test.Test import kotlin.test.assertEquals class TextStylesTest : HtmlRenderingOnlyTestBase() { diff --git a/plugins/base/src/test/kotlin/resourceLinks/ResourceLinksTest.kt b/plugins/base/src/test/kotlin/resourceLinks/ResourceLinksTest.kt index 0bbd35d1..bbaad338 100644 --- a/plugins/base/src/test/kotlin/resourceLinks/ResourceLinksTest.kt +++ b/plugins/base/src/test/kotlin/resourceLinks/ResourceLinksTest.kt @@ -14,12 +14,12 @@ import org.jetbrains.dokka.plugability.PluginApiPreviewAcknowledgement import org.jetbrains.dokka.transformers.pages.PageTransformer import org.jsoup.Jsoup import org.jsoup.nodes.TextNode -import org.junit.jupiter.api.Test import org.junit.jupiter.params.ParameterizedTest import org.junit.jupiter.params.provider.ValueSource import utils.TestOutputWriterPlugin import utils.assertContains import java.io.File +import kotlin.test.Test import kotlin.test.assertNotNull import kotlin.test.assertNull import kotlin.test.assertTrue @@ -79,10 +79,10 @@ class ResourceLinksTest : BaseAbstractTest() { .select("link, script") .let { absoluteResources.forEach { r -> - assert(it.`is`("[href=$r], [src=$r]")) + assertTrue(it.`is`("[href=$r], [src=$r]")) } relativeResources.forEach { r -> - assert(it.`is`("[href=../$r] , [src=../$r]")) + assertTrue(it.`is`("[href=../$r] , [src=../$r]")) } } } @@ -139,7 +139,7 @@ class ResourceLinksTest : BaseAbstractTest() { .select("link, script") .let { listOf("styles/customStyle.css").forEach { r -> - assert(it.`is`("[href=$TEMPLATE_REPLACEMENT$r]")) + assertTrue(it.`is`("[href=$TEMPLATE_REPLACEMENT$r]")) } } } else { @@ -149,7 +149,7 @@ class ResourceLinksTest : BaseAbstractTest() { .select("link, script") .let { listOf("styles/customStyle.css").forEach { r -> - assert(it.`is`("[href=../$r], [src=../$r]")) + assertTrue(it.`is`("[href=../$r], [src=../$r]")) } } } @@ -198,10 +198,10 @@ class ResourceLinksTest : BaseAbstractTest() { .select("link, script") .let { absoluteResources.forEach { r -> - assert(it.`is`("[href=$r], [src=$r]")) + assertTrue(it.`is`("[href=$r], [src=$r]")) } relativeResources.forEach { r -> - assert(it.`is`("[href=../$r] , [src=../$r]")) + assertTrue(it.`is`("[href=../$r] , [src=../$r]")) } } } diff --git a/plugins/base/src/test/kotlin/signatures/DivergentSignatureTest.kt b/plugins/base/src/test/kotlin/signatures/DivergentSignatureTest.kt index af10cbee..e276ee5c 100644 --- a/plugins/base/src/test/kotlin/signatures/DivergentSignatureTest.kt +++ b/plugins/base/src/test/kotlin/signatures/DivergentSignatureTest.kt @@ -1,9 +1,10 @@ package signatures -import org.junit.jupiter.api.Test +import utils.TestOutputWriterPlugin +import kotlin.test.Test +import kotlin.test.assertEquals import utils.OnlyDescriptors import utils.OnlyDescriptorsMPP -import utils.TestOutputWriterPlugin @OnlyDescriptorsMPP class DivergentSignatureTest : AbstractRenderingTest() { @@ -20,10 +21,10 @@ class DivergentSignatureTest : AbstractRenderingTest() { renderingStage = { _, _ -> val content = writerPlugin.renderedSourceDependentContent("example/example/-clock/get-time.html") - assert(content.count() == 3) + assertEquals(3, content.count()) val sourceSets = listOf("example/common", "example/js", "example/jvm") sourceSets.forEach { - assert(content.select("[data-togglable=$it]").single().brief == "") + assertEquals("", content.select("[data-togglable=$it]").single().brief) } } } @@ -41,10 +42,10 @@ class DivergentSignatureTest : AbstractRenderingTest() { renderingStage = { _, _ -> val content = writerPlugin.renderedSourceDependentContent("example/example/-clock/get-times-in-millis.html") - assert(content.count() == 3) - assert(content.select("[data-togglable=example/common]").single().brief == "Time in minis") - assert(content.select("[data-togglable=example/jvm]").single().brief == "Time in minis") - assert(content.select("[data-togglable=example/js]").single().brief == "JS implementation of getTimeInMillis" ) + assertEquals(3, content.count()) + assertEquals("Time in minis", content.select("[data-togglable=example/common]").single().brief) + assertEquals("Time in minis", content.select("[data-togglable=example/jvm]").single().brief) + assertEquals("JS implementation of getTimeInMillis", content.select("[data-togglable=example/js]").single().brief) } } } @@ -60,10 +61,10 @@ class DivergentSignatureTest : AbstractRenderingTest() { ) { renderingStage = { _, _ -> val content = writerPlugin.renderedSourceDependentContent("example/example/-clock/get-year.html") - assert(content.count() == 3) - assert(content.select("[data-togglable=example/jvm]").single().brief == "JVM custom kdoc") - assert(content.select("[data-togglable=example/js]").single().brief == "JS custom kdoc") - assert(content.select("[data-togglable=example/common]").single().brief == "") + assertEquals(3, content.count()) + assertEquals("JVM custom kdoc", content.select("[data-togglable=example/jvm]").single().brief) + assertEquals("JS custom kdoc", content.select("[data-togglable=example/js]").single().brief) + assertEquals("", content.select("[data-togglable=example/common]").single().brief) } } } diff --git a/plugins/base/src/test/kotlin/signatures/FunctionalTypeConstructorsSignatureTest.kt b/plugins/base/src/test/kotlin/signatures/FunctionalTypeConstructorsSignatureTest.kt index 588b3d50..8a4a8fd5 100644 --- a/plugins/base/src/test/kotlin/signatures/FunctionalTypeConstructorsSignatureTest.kt +++ b/plugins/base/src/test/kotlin/signatures/FunctionalTypeConstructorsSignatureTest.kt @@ -3,9 +3,13 @@ package signatures import org.jetbrains.dokka.DokkaConfiguration import org.jetbrains.dokka.base.testApi.testRunner.BaseAbstractTest import org.jetbrains.dokka.jdk -import org.junit.jupiter.api.Disabled -import org.junit.jupiter.api.Test -import utils.* +import utils.A +import utils.Span +import utils.TestOutputWriterPlugin +import utils.match +import utils.JavaCode +import kotlin.test.Ignore +import kotlin.test.Test class FunctionalTypeConstructorsSignatureTest : BaseAbstractTest() { private val configuration = dokkaConfiguration { @@ -143,7 +147,7 @@ class FunctionalTypeConstructorsSignatureTest : BaseAbstractTest() { } } } - @Disabled // Add coroutines on classpath and get proper import + @Ignore // Add coroutines on classpath and get proper import @Test fun `kotlin normal suspendable function`() { val source = source("val nF: SuspendFunction1<Int, String> = { _ -> \"\" }") diff --git a/plugins/base/src/test/kotlin/signatures/InheritedAccessorsSignatureTest.kt b/plugins/base/src/test/kotlin/signatures/InheritedAccessorsSignatureTest.kt index 4cd9a94d..d4600012 100644 --- a/plugins/base/src/test/kotlin/signatures/InheritedAccessorsSignatureTest.kt +++ b/plugins/base/src/test/kotlin/signatures/InheritedAccessorsSignatureTest.kt @@ -2,8 +2,13 @@ package signatures import org.jetbrains.dokka.DokkaConfiguration import org.jetbrains.dokka.base.testApi.testRunner.BaseAbstractTest -import org.junit.jupiter.api.Test -import utils.* +import utils.A +import utils.Span +import utils.TestOutputWriterPlugin +import utils.match +import utils.JavaCode +import utils.OnlyDescriptors +import kotlin.test.Test import kotlin.test.assertEquals @JavaCode diff --git a/plugins/base/src/test/kotlin/signatures/RawHtmlRenderingTest.kt b/plugins/base/src/test/kotlin/signatures/RawHtmlRenderingTest.kt index 38c70cd4..87763e48 100644 --- a/plugins/base/src/test/kotlin/signatures/RawHtmlRenderingTest.kt +++ b/plugins/base/src/test/kotlin/signatures/RawHtmlRenderingTest.kt @@ -1,8 +1,8 @@ package signatures import org.jsoup.Jsoup -import org.junit.jupiter.api.Test import utils.TestOutputWriterPlugin +import kotlin.test.Test import kotlin.test.assertEquals import kotlin.test.assertTrue @@ -17,7 +17,7 @@ class RawHtmlRenderingTest: AbstractRenderingTest() { ) { renderingStage = { _, _ -> val content = writerPlugin.renderedSourceDependentContent("example/example/-html-test/test.html") - assert(content.count() == 1) + assertEquals(1, content.count()) assertEquals(content.select("[data-togglable=example/jvm]").single().rawBrief,"This is an example <!-- not visible --> of html") val indexContent = writerPlugin.writer.contents.getValue("example/example/-html-test/index.html") @@ -54,7 +54,7 @@ class RawHtmlRenderingTest: AbstractRenderingTest() { ) { renderingStage = { _, _ -> val content = writerPlugin.renderedSourceDependentContent("example/example/-html-test/test-p.html") - assert(content.count() == 1) + assertEquals(1, content.count()) assertEquals(content.select("[data-togglable=example/jvm]").single().rawBrief, "This is an <b> documentation </b>") val indexContent = writerPlugin.writer.contents.getValue("example/example/-html-test/index.html") @@ -63,4 +63,4 @@ class RawHtmlRenderingTest: AbstractRenderingTest() { } } } -}
\ No newline at end of file +} diff --git a/plugins/base/src/test/kotlin/signatures/SignatureTest.kt b/plugins/base/src/test/kotlin/signatures/SignatureTest.kt index 00d98102..3a73153a 100644 --- a/plugins/base/src/test/kotlin/signatures/SignatureTest.kt +++ b/plugins/base/src/test/kotlin/signatures/SignatureTest.kt @@ -5,9 +5,11 @@ import org.jetbrains.dokka.base.testApi.testRunner.BaseAbstractTest import org.jetbrains.dokka.model.DFunction import org.jetbrains.dokka.model.DefinitelyNonNullable import org.jetbrains.dokka.model.dfs -import org.junit.jupiter.api.Test import utils.* +import kotlin.test.Test import kotlin.test.assertEquals +import kotlin.test.assertTrue + class SignatureTest : BaseAbstractTest() { private val configuration = dokkaConfiguration { sourceSets { @@ -204,8 +206,8 @@ class SignatureTest : BaseAbstractTest() { documentablesTransformationStage = { val fn = (it.dfs { it.name == "elvisLike" } as? DFunction).assertNotNull("Function elvisLike") - assert(fn.type is DefinitelyNonNullable) - assert(fn.parameters[1].type is DefinitelyNonNullable) + assertTrue(fn.type is DefinitelyNonNullable) + assertTrue(fn.parameters[1].type is DefinitelyNonNullable) } renderingStage = { _, _ -> val signature = writerPlugin.writer.renderedContent("root/example/elvis-like.html") diff --git a/plugins/base/src/test/kotlin/signatures/VarianceSignatureTest.kt b/plugins/base/src/test/kotlin/signatures/VarianceSignatureTest.kt index 06a3daae..f8ad218c 100644 --- a/plugins/base/src/test/kotlin/signatures/VarianceSignatureTest.kt +++ b/plugins/base/src/test/kotlin/signatures/VarianceSignatureTest.kt @@ -1,10 +1,10 @@ package signatures import org.jetbrains.dokka.base.testApi.testRunner.BaseAbstractTest -import org.junit.jupiter.api.Test import utils.A import utils.TestOutputWriterPlugin import utils.match +import kotlin.test.Test class VarianceSignatureTest : BaseAbstractTest() { private val configuration = dokkaConfiguration { diff --git a/plugins/base/src/test/kotlin/superFields/DescriptorSuperPropertiesTest.kt b/plugins/base/src/test/kotlin/superFields/DescriptorSuperPropertiesTest.kt index 14c2752a..e2dc20a2 100644 --- a/plugins/base/src/test/kotlin/superFields/DescriptorSuperPropertiesTest.kt +++ b/plugins/base/src/test/kotlin/superFields/DescriptorSuperPropertiesTest.kt @@ -6,11 +6,11 @@ import org.jetbrains.dokka.links.DRI import org.jetbrains.dokka.model.InheritedMember import org.jetbrains.dokka.model.IsVar import org.jetbrains.dokka.model.KotlinVisibility -import org.junit.jupiter.api.Test -import utils.JavaCode +import kotlin.test.Test import kotlin.test.assertEquals import kotlin.test.assertNotNull import kotlin.test.assertNull +import utils.JavaCode @JavaCode class DescriptorSuperPropertiesTest : BaseAbstractTest() { diff --git a/plugins/base/src/test/kotlin/superFields/PsiSuperFieldsTest.kt b/plugins/base/src/test/kotlin/superFields/PsiSuperFieldsTest.kt index 5c7124cd..ddcfdd75 100644 --- a/plugins/base/src/test/kotlin/superFields/PsiSuperFieldsTest.kt +++ b/plugins/base/src/test/kotlin/superFields/PsiSuperFieldsTest.kt @@ -6,12 +6,11 @@ import org.jetbrains.dokka.model.Annotations import org.jetbrains.dokka.model.InheritedMember import org.jetbrains.dokka.model.IsVar import org.jetbrains.dokka.model.isJvmField -import org.junit.jupiter.api.Assertions.assertNotNull -import org.junit.jupiter.api.Assertions.assertNull -import org.junit.jupiter.api.Test -import utils.JavaCode +import kotlin.test.Test import kotlin.test.assertEquals - +import kotlin.test.assertNotNull +import kotlin.test.assertNull +import utils.JavaCode @JavaCode class PsiSuperFieldsTest : BaseAbstractTest() { diff --git a/plugins/base/src/test/kotlin/transformerBuilders/PageTransformerBuilderTest.kt b/plugins/base/src/test/kotlin/transformerBuilders/PageTransformerBuilderTest.kt index b2b590d3..62741945 100644 --- a/plugins/base/src/test/kotlin/transformerBuilders/PageTransformerBuilderTest.kt +++ b/plugins/base/src/test/kotlin/transformerBuilders/PageTransformerBuilderTest.kt @@ -11,11 +11,9 @@ import org.jetbrains.dokka.transformers.pages.PageTransformer import org.jetbrains.dokka.transformers.pages.pageMapper import org.jetbrains.dokka.transformers.pages.pageScanner import org.jetbrains.dokka.transformers.pages.pageStructureTransformer -import org.jsoup.Jsoup -import org.junit.jupiter.api.Test -import utils.TestOutputWriterPlugin -import utils.assertContains import utils.assertNotNull +import kotlin.test.Test +import kotlin.test.assertEquals class PageTransformerBuilderTest : BaseAbstractTest() { @@ -178,11 +176,10 @@ class PageTransformerBuilderTest : 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()}") - private fun <T> T.assertEqual(expected: T, prefix: String = "") = assert(this == expected) { - "${prefix}Expected $expected, got $this" - } + private fun <T> T.assertEqual(expected: T, prefix: String = "") = + assertEquals(expected, this, "${prefix}Expected $expected, got $this") private fun PageNode.assertTransform(expected: PageNode, block: (PageNode) -> PageNode = { it }): Unit = this.let { it.name.assertEqual(block(expected).name) diff --git a/plugins/base/src/test/kotlin/transformers/CommentsToContentConverterTest.kt b/plugins/base/src/test/kotlin/transformers/CommentsToContentConverterTest.kt index e1029856..a88503b0 100644 --- a/plugins/base/src/test/kotlin/transformers/CommentsToContentConverterTest.kt +++ b/plugins/base/src/test/kotlin/transformers/CommentsToContentConverterTest.kt @@ -5,9 +5,9 @@ import org.jetbrains.dokka.base.transformers.pages.comments.DocTagToContentConve import org.jetbrains.dokka.links.DRI import org.jetbrains.dokka.model.doc.* import org.jetbrains.dokka.pages.* -import org.junit.jupiter.api.Assertions.assertEquals -import org.junit.jupiter.api.Assertions.assertTrue -import org.junit.jupiter.api.Test +import kotlin.test.Test +import kotlin.test.assertEquals +import kotlin.test.assertTrue class CommentsToContentConverterTest { private val converter = DocTagToContentConverter() @@ -454,23 +454,23 @@ class CommentsToContentConverterTest { executeTest(docTag) { composite<ContentList> { check { - assertTrue(style.contains(ListStyle.DescriptionList)) { "Expected DL style" } + assertTrue(style.contains(ListStyle.DescriptionList), "Expected DL style") } group { check { - assertTrue(style.contains(ListStyle.DescriptionTerm)) { "Expected DT style" } + assertTrue(style.contains(ListStyle.DescriptionTerm), "Expected DT style") } +"description list can have..." } group { check { - assertTrue(style.contains(ListStyle.DescriptionTerm)) { "Expected DT style" } + assertTrue(style.contains(ListStyle.DescriptionTerm), "Expected DT style") } +"... two consecutive description terms" } group { check { - assertTrue(style.contains(ListStyle.DescriptionDetails)) { "Expected DD style" } + assertTrue(style.contains(ListStyle.DescriptionDetails), "Expected DD style") } +"and usually has some sort of a description, like this one" } diff --git a/plugins/base/src/test/kotlin/transformers/ContextModuleAndPackageDocumentationReaderTest1.kt b/plugins/base/src/test/kotlin/transformers/ContextModuleAndPackageDocumentationReaderTest1.kt index 8d2833e4..34c218aa 100644 --- a/plugins/base/src/test/kotlin/transformers/ContextModuleAndPackageDocumentationReaderTest1.kt +++ b/plugins/base/src/test/kotlin/transformers/ContextModuleAndPackageDocumentationReaderTest1.kt @@ -1,6 +1,7 @@ package transformers import org.jetbrains.dokka.DokkaConfiguration.DokkaSourceSet +import org.jetbrains.dokka.analysis.kotlin.internal.InternalKotlinAnalysisPlugin import org.jetbrains.dokka.links.DRI import org.jetbrains.dokka.model.doc.DocumentationNode import org.jetbrains.dokka.plugability.DokkaContext @@ -9,14 +10,13 @@ import org.jetbrains.dokka.plugability.querySingle import org.jetbrains.dokka.testApi.logger.TestLogger import org.jetbrains.dokka.utilities.DokkaConsoleLogger import org.jetbrains.dokka.utilities.LoggingLevel -import org.jetbrains.dokka.analysis.kotlin.internal.InternalKotlinAnalysisPlugin -import org.junit.jupiter.api.Assertions.assertEquals -import org.junit.jupiter.api.BeforeEach -import org.junit.jupiter.api.Test -import org.junit.jupiter.api.assertThrows import testApi.testRunner.TestDokkaConfigurationBuilder import testApi.testRunner.dModule import testApi.testRunner.dPackage +import kotlin.test.BeforeTest +import kotlin.test.Test +import kotlin.test.assertEquals +import kotlin.test.assertFailsWith class ContextModuleAndPackageDocumentationReaderTest1 : AbstractContextModuleAndPackageDocumentationReaderTest() { @@ -24,7 +24,7 @@ class ContextModuleAndPackageDocumentationReaderTest1 : AbstractContextModuleAnd private val includeSourceSetA by lazy { temporaryDirectory.resolve("includeA.md").toFile() } private val includeSourceSetB by lazy { temporaryDirectory.resolve("includeB.md").toFile() } - @BeforeEach + @BeforeTest fun materializeIncludes() { includeSourceSetA.writeText( """ @@ -107,14 +107,14 @@ class ContextModuleAndPackageDocumentationReaderTest1 : AbstractContextModuleAnd fun `assert moduleA with no source sets`() { val documentation = reader.read(dModule("moduleA")) assertEquals( - emptyMap<DokkaSourceSet, DocumentationNode>(), documentation, + emptyMap(), documentation, "Expected no documentation received for module not declaring a matching sourceSet" ) } @Test fun `assert moduleA with unknown source set`() { - assertThrows<IllegalStateException>( + assertFailsWith<IllegalStateException>( "Expected no documentation received for module with unknown sourceSet" ) { reader.read( diff --git a/plugins/base/src/test/kotlin/transformers/ContextModuleAndPackageDocumentationReaderTest3.kt b/plugins/base/src/test/kotlin/transformers/ContextModuleAndPackageDocumentationReaderTest3.kt index 7195eccd..597c58c2 100644 --- a/plugins/base/src/test/kotlin/transformers/ContextModuleAndPackageDocumentationReaderTest3.kt +++ b/plugins/base/src/test/kotlin/transformers/ContextModuleAndPackageDocumentationReaderTest3.kt @@ -1,23 +1,23 @@ package transformers +import org.jetbrains.dokka.analysis.kotlin.internal.InternalKotlinAnalysisPlugin import org.jetbrains.dokka.links.DRI import org.jetbrains.dokka.plugability.DokkaContext import org.jetbrains.dokka.plugability.plugin import org.jetbrains.dokka.plugability.querySingle import org.jetbrains.dokka.utilities.DokkaConsoleLogger import org.jetbrains.dokka.utilities.LoggingLevel -import org.jetbrains.dokka.analysis.kotlin.internal.InternalKotlinAnalysisPlugin -import org.junit.jupiter.api.BeforeEach -import org.junit.jupiter.api.Test import testApi.testRunner.TestDokkaConfigurationBuilder import testApi.testRunner.dPackage +import kotlin.test.BeforeTest +import kotlin.test.Test import kotlin.test.assertEquals class ContextModuleAndPackageDocumentationReaderTest3 : AbstractContextModuleAndPackageDocumentationReaderTest() { private val include by lazy { temporaryDirectory.resolve("include.md").toFile() } - @BeforeEach + @BeforeTest fun materializeInclude() { include.writeText( """ diff --git a/plugins/base/src/test/kotlin/transformers/DivisionSwitchTest.kt b/plugins/base/src/test/kotlin/transformers/DivisionSwitchTest.kt index 16798508..2e9fbaa1 100644 --- a/plugins/base/src/test/kotlin/transformers/DivisionSwitchTest.kt +++ b/plugins/base/src/test/kotlin/transformers/DivisionSwitchTest.kt @@ -9,7 +9,7 @@ import org.jetbrains.dokka.pages.ClasslikePageNode import org.jetbrains.dokka.pages.ContentHeader import org.jetbrains.dokka.pages.ContentNode import org.jetbrains.dokka.pages.ContentText -import org.junit.jupiter.api.Test +import kotlin.test.Test import kotlin.test.assertEquals import kotlin.test.assertNotNull diff --git a/plugins/base/src/test/kotlin/transformers/InheritedEntriesDocumentableFilterTransfromerTest.kt b/plugins/base/src/test/kotlin/transformers/InheritedEntriesDocumentableFilterTransfromerTest.kt index 826df64e..d8811bcd 100644 --- a/plugins/base/src/test/kotlin/transformers/InheritedEntriesDocumentableFilterTransfromerTest.kt +++ b/plugins/base/src/test/kotlin/transformers/InheritedEntriesDocumentableFilterTransfromerTest.kt @@ -2,10 +2,10 @@ package transformers import org.jetbrains.dokka.base.testApi.testRunner.BaseAbstractTest import org.jetbrains.dokka.model.DEnum -import org.junit.jupiter.api.Test -import utils.OnlyDescriptors +import kotlin.test.Test import kotlin.test.assertEquals import kotlin.test.assertTrue +import utils.OnlyDescriptors class InheritedEntriesDocumentableFilterTransformerTest : BaseAbstractTest() { val suppressingInheritedConfiguration = dokkaConfiguration { @@ -155,4 +155,5 @@ class InheritedEntriesDocumentableFilterTransformerTest : BaseAbstractTest() { } } } -}
\ No newline at end of file +} + diff --git a/plugins/base/src/test/kotlin/transformers/InvalidContentModuleAndPackageDocumentationReaderTest.kt b/plugins/base/src/test/kotlin/transformers/InvalidContentModuleAndPackageDocumentationReaderTest.kt index 3ec1d273..e3b396a1 100644 --- a/plugins/base/src/test/kotlin/transformers/InvalidContentModuleAndPackageDocumentationReaderTest.kt +++ b/plugins/base/src/test/kotlin/transformers/InvalidContentModuleAndPackageDocumentationReaderTest.kt @@ -1,15 +1,15 @@ package transformers +import org.jetbrains.dokka.analysis.kotlin.internal.InternalKotlinAnalysisPlugin import org.jetbrains.dokka.plugability.DokkaContext import org.jetbrains.dokka.plugability.plugin import org.jetbrains.dokka.plugability.querySingle import org.jetbrains.dokka.utilities.DokkaConsoleLogger import org.jetbrains.dokka.utilities.LoggingLevel -import org.jetbrains.dokka.analysis.kotlin.internal.InternalKotlinAnalysisPlugin -import org.junit.jupiter.api.BeforeEach -import org.junit.jupiter.api.Test import testApi.testRunner.TestDokkaConfigurationBuilder import testApi.testRunner.dModule +import kotlin.test.BeforeTest +import kotlin.test.Test import kotlin.test.assertEquals import kotlin.test.assertTrue @@ -19,7 +19,7 @@ class InvalidContentModuleAndPackageDocumentationReaderTest : AbstractContextMod private val includeA by lazy { temporaryDirectory.resolve("includeA.md").toFile() } private val includeB by lazy { temporaryDirectory.resolve("includeB.md").toFile() } - @BeforeEach + @BeforeTest fun materializeInclude() { includeA.writeText( """ diff --git a/plugins/base/src/test/kotlin/transformers/MergeImplicitExpectActualDeclarationsTest.kt b/plugins/base/src/test/kotlin/transformers/MergeImplicitExpectActualDeclarationsTest.kt index e6cc393d..cdb19299 100644 --- a/plugins/base/src/test/kotlin/transformers/MergeImplicitExpectActualDeclarationsTest.kt +++ b/plugins/base/src/test/kotlin/transformers/MergeImplicitExpectActualDeclarationsTest.kt @@ -8,11 +8,11 @@ import org.jetbrains.dokka.model.childrenOfType import org.jetbrains.dokka.model.dfs import org.jetbrains.dokka.model.firstChildOfType import org.jetbrains.dokka.pages.* -import org.junit.jupiter.api.Test -import utils.OnlyDescriptors import utils.assertNotNull +import kotlin.test.Test import kotlin.test.assertEquals import kotlin.test.assertNotNull +import utils.OnlyDescriptors class MergeImplicitExpectActualDeclarationsTest : BaseAbstractTest() { diff --git a/plugins/base/src/test/kotlin/transformers/ModuleAndPackageDocumentationTransformerFunctionalTest.kt b/plugins/base/src/test/kotlin/transformers/ModuleAndPackageDocumentationTransformerFunctionalTest.kt index 134e7f59..7bf3c9c1 100644 --- a/plugins/base/src/test/kotlin/transformers/ModuleAndPackageDocumentationTransformerFunctionalTest.kt +++ b/plugins/base/src/test/kotlin/transformers/ModuleAndPackageDocumentationTransformerFunctionalTest.kt @@ -2,11 +2,11 @@ package transformers import org.jetbrains.dokka.DokkaSourceSetID import org.jetbrains.dokka.base.testApi.testRunner.BaseAbstractTest -import org.junit.jupiter.api.Test import org.junit.jupiter.api.io.TempDir import transformers.AbstractContextModuleAndPackageDocumentationReaderTest.Companion.texts import utils.OnlyDescriptorsMPP import java.nio.file.Path +import kotlin.test.Test import kotlin.test.assertEquals class ModuleAndPackageDocumentationTransformerFunctionalTest : BaseAbstractTest() { diff --git a/plugins/base/src/test/kotlin/transformers/ModuleAndPackageDocumentationTransformerUnitTest.kt b/plugins/base/src/test/kotlin/transformers/ModuleAndPackageDocumentationTransformerUnitTest.kt index 3cbb90ca..d404c6f1 100644 --- a/plugins/base/src/test/kotlin/transformers/ModuleAndPackageDocumentationTransformerUnitTest.kt +++ b/plugins/base/src/test/kotlin/transformers/ModuleAndPackageDocumentationTransformerUnitTest.kt @@ -2,6 +2,7 @@ package transformers import org.jetbrains.dokka.DokkaConfiguration +import org.jetbrains.dokka.analysis.kotlin.internal.ModuleAndPackageDocumentationReader import org.jetbrains.dokka.analysis.markdown.jb.MARKDOWN_ELEMENT_FILE_NAME import org.jetbrains.dokka.base.transformers.documentables.ModuleAndPackageDocumentationTransformer import org.jetbrains.dokka.links.DRI @@ -12,11 +13,10 @@ import org.jetbrains.dokka.model.doc.CustomDocTag import org.jetbrains.dokka.model.doc.Description import org.jetbrains.dokka.model.doc.DocumentationNode import org.jetbrains.dokka.model.doc.Text -import org.jetbrains.dokka.analysis.kotlin.internal.ModuleAndPackageDocumentationReader -import org.junit.jupiter.api.Assertions.assertEquals -import org.junit.jupiter.api.Test import testApi.testRunner.dPackage import testApi.testRunner.sourceSet +import kotlin.test.Test +import kotlin.test.assertEquals class ModuleAndPackageDocumentationTransformerUnitTest { diff --git a/plugins/base/src/test/kotlin/transformers/ReportUndocumentedTransformerTest.kt b/plugins/base/src/test/kotlin/transformers/ReportUndocumentedTransformerTest.kt index 431abef5..88fc7a9d 100644 --- a/plugins/base/src/test/kotlin/transformers/ReportUndocumentedTransformerTest.kt +++ b/plugins/base/src/test/kotlin/transformers/ReportUndocumentedTransformerTest.kt @@ -5,9 +5,9 @@ import org.jetbrains.dokka.DokkaDefaults import org.jetbrains.dokka.PackageOptionsImpl import org.jetbrains.dokka.Platform import org.jetbrains.dokka.base.testApi.testRunner.BaseAbstractTest -import org.junit.jupiter.api.Assertions.assertEquals -import org.junit.jupiter.api.Disabled -import org.junit.jupiter.api.Test +import kotlin.test.Ignore +import kotlin.test.Test +import kotlin.test.assertEquals class ReportUndocumentedTransformerTest : BaseAbstractTest() { @@ -181,7 +181,7 @@ class ReportUndocumentedTransformerTest : BaseAbstractTest() { } } - @Disabled + @Ignore @Test fun `undocumented secondary constructor gets reported`() { val configuration = dokkaConfiguration { diff --git a/plugins/base/src/test/kotlin/transformers/SourceLinkTransformerTest.kt b/plugins/base/src/test/kotlin/transformers/SourceLinkTransformerTest.kt index 532c9e81..a6ae5d7c 100644 --- a/plugins/base/src/test/kotlin/transformers/SourceLinkTransformerTest.kt +++ b/plugins/base/src/test/kotlin/transformers/SourceLinkTransformerTest.kt @@ -4,11 +4,11 @@ import org.jetbrains.dokka.DokkaSourceSetID import org.jetbrains.dokka.SourceLinkDefinitionImpl import org.jetbrains.dokka.base.testApi.testRunner.BaseAbstractTest import org.jsoup.nodes.Element -import org.junit.jupiter.api.Test import signatures.renderedContent import utils.OnlyDescriptorsMPP import utils.TestOutputWriterPlugin import java.net.URL +import kotlin.test.Test import kotlin.test.assertEquals class SourceLinkTransformerTest : BaseAbstractTest() { diff --git a/plugins/base/src/test/kotlin/transformers/SuppressTagFilterTest.kt b/plugins/base/src/test/kotlin/transformers/SuppressTagFilterTest.kt index de1ee46c..e6059e85 100644 --- a/plugins/base/src/test/kotlin/transformers/SuppressTagFilterTest.kt +++ b/plugins/base/src/test/kotlin/transformers/SuppressTagFilterTest.kt @@ -3,7 +3,7 @@ package transformers import org.jetbrains.dokka.base.testApi.testRunner.BaseAbstractTest import org.jetbrains.dokka.model.DEnum import org.jetbrains.dokka.model.WithCompanion -import org.junit.jupiter.api.Test +import kotlin.test.Test import kotlin.test.assertEquals import kotlin.test.assertNotNull import kotlin.test.assertNull @@ -204,4 +204,4 @@ class SuppressTagFilterTest : BaseAbstractTest() { } } } -}
\ No newline at end of file +} diff --git a/plugins/base/src/test/kotlin/transformers/SuppressedByConfigurationDocumentableFilterTransformerTest.kt b/plugins/base/src/test/kotlin/transformers/SuppressedByConfigurationDocumentableFilterTransformerTest.kt index a6060970..377c8bec 100644 --- a/plugins/base/src/test/kotlin/transformers/SuppressedByConfigurationDocumentableFilterTransformerTest.kt +++ b/plugins/base/src/test/kotlin/transformers/SuppressedByConfigurationDocumentableFilterTransformerTest.kt @@ -4,9 +4,8 @@ import org.jetbrains.dokka.DokkaDefaults import org.jetbrains.dokka.PackageOptionsImpl import org.jetbrains.dokka.base.testApi.testRunner.BaseAbstractTest import org.jetbrains.dokka.links.DRI -import org.junit.jupiter.api.Assertions.assertEquals -import org.junit.jupiter.api.Assertions.assertIterableEquals -import org.junit.jupiter.api.Test +import kotlin.test.Test +import kotlin.test.assertEquals class SuppressedByConfigurationDocumentableFilterTransformerTest : BaseAbstractTest() { @@ -90,7 +89,7 @@ class SuppressedByConfigurationDocumentableFilterTransformerTest : BaseAbstractT ) { documentablesMergingStage = { module -> assertEquals(2, module.packages.size, "Expected two packages in module") - assertIterableEquals( + assertEquals( listOf(DRI("parent.some"), DRI("parent.other.default")).sortedBy { it.packageName }, module.packages.map { it.dri }.sortedBy { it.packageName }, "Expected 'parent.some' and 'parent.other.default' packages to be not suppressed" diff --git a/plugins/base/src/test/kotlin/transformers/isExceptionTest.kt b/plugins/base/src/test/kotlin/transformers/isExceptionTest.kt index dd888ad6..b1ad7163 100644 --- a/plugins/base/src/test/kotlin/transformers/isExceptionTest.kt +++ b/plugins/base/src/test/kotlin/transformers/isExceptionTest.kt @@ -3,8 +3,8 @@ package transformers import org.jetbrains.dokka.base.transformers.documentables.isException import org.jetbrains.dokka.model.DClass import org.jetbrains.dokka.model.DTypeAlias -import org.junit.jupiter.api.Test import utils.AbstractModelTest +import kotlin.test.Test import utils.JavaCode import utils.UsingJDK @@ -147,4 +147,5 @@ class IsExceptionJavaTest: AbstractModelTest("/src/main/kotlin/java/Test.java", } } } -}
\ No newline at end of file +} + diff --git a/plugins/base/src/test/kotlin/translators/AccessorMethodNamingTest.kt b/plugins/base/src/test/kotlin/translators/AccessorMethodNamingTest.kt index dee4bf7a..6f928266 100644 --- a/plugins/base/src/test/kotlin/translators/AccessorMethodNamingTest.kt +++ b/plugins/base/src/test/kotlin/translators/AccessorMethodNamingTest.kt @@ -2,9 +2,9 @@ package translators import org.jetbrains.dokka.base.testApi.testRunner.BaseAbstractTest import org.jetbrains.dokka.model.DProperty -import org.junit.jupiter.api.Assertions.assertEquals -import org.junit.jupiter.api.Assertions.assertTrue -import org.junit.jupiter.api.Test +import kotlin.test.Test +import kotlin.test.assertEquals +import kotlin.test.assertTrue /** * https://kotlinlang.org/docs/java-to-kotlin-interop.html#properties diff --git a/plugins/base/src/test/kotlin/translators/Bug1341.kt b/plugins/base/src/test/kotlin/translators/Bug1341.kt index 3e1b403d..97d75334 100644 --- a/plugins/base/src/test/kotlin/translators/Bug1341.kt +++ b/plugins/base/src/test/kotlin/translators/Bug1341.kt @@ -2,8 +2,8 @@ package translators import org.jetbrains.dokka.base.testApi.testRunner.BaseAbstractTest import org.jetbrains.dokka.links.DRI -import org.junit.jupiter.api.Assertions.assertEquals -import org.junit.jupiter.api.Test +import kotlin.test.Test +import kotlin.test.assertEquals import utils.JavaCode class Bug1341 : BaseAbstractTest() { diff --git a/plugins/base/src/test/kotlin/translators/DefaultDescriptorToDocumentableTranslatorTest.kt b/plugins/base/src/test/kotlin/translators/DefaultDescriptorToDocumentableTranslatorTest.kt index 4ae8f7ac..c8411f31 100644 --- a/plugins/base/src/test/kotlin/translators/DefaultDescriptorToDocumentableTranslatorTest.kt +++ b/plugins/base/src/test/kotlin/translators/DefaultDescriptorToDocumentableTranslatorTest.kt @@ -7,13 +7,9 @@ import org.jetbrains.dokka.links.DRI import org.jetbrains.dokka.links.PointingToDeclaration import org.jetbrains.dokka.model.* import org.jetbrains.dokka.model.doc.* -import org.junit.jupiter.api.Assertions.* -import org.junit.jupiter.api.Disabled -import org.junit.jupiter.api.Test -import utils.OnlyDescriptors import utils.text -import kotlin.test.assertNotNull -import kotlin.test.assertTrue +import kotlin.test.* +import utils.OnlyDescriptors class DefaultDescriptorToDocumentableTranslatorTest : BaseAbstractTest() { val configuration = dokkaConfiguration { @@ -60,16 +56,17 @@ class DefaultDescriptorToDocumentableTranslatorTest : BaseAbstractTest() { configuration ) { documentablesMergingStage = { module -> - assert(module.documentationOf("XD", "copy") == "") - assert( + assertEquals("", module.documentationOf("XD", "copy")) + assertEquals( + "Memory is not what the heart desires. That is only a mirror.", module.documentationOf( "XD", "equals" - ) == "Memory is not what the heart desires. That is only a mirror." + ) ) - assert(module.documentationOf("XD", "hashCode") == "") - assert(module.documentationOf("XD", "toString") == "") - assert(module.documentationOf("XD", "custom") == "But the fat Hobbit, he knows. Eyes always watching.") + assertEquals("", module.documentationOf("XD", "hashCode")) + assertEquals("", module.documentationOf("XD", "toString")) + assertEquals("But the fat Hobbit, he knows. Eyes always watching.", module.documentationOf("XD", "custom")) } } } @@ -98,12 +95,13 @@ class DefaultDescriptorToDocumentableTranslatorTest : BaseAbstractTest() { configuration ) { documentablesMergingStage = { module -> - assert(module.documentationOf("XD", "custom") == "But the fat Hobbit, he knows. Eyes always watching.") - assert( + assertEquals("But the fat Hobbit, he knows. Eyes always watching.", module.documentationOf("XD", "custom")) + assertEquals( + "Memory is not what the heart desires. That is only a mirror.", module.documentationOf( "XD", "equals" - ) == "Memory is not what the heart desires. That is only a mirror." + ) ) } } @@ -656,7 +654,7 @@ val soapXml = node("soap-env:Envelope", soapAttrs, } } - @Disabled // The compiler throws away annotations on unresolved types upstream + @Ignore // The compiler throws away annotations on unresolved types upstream @Test fun `Can annotate unresolved type`() { testInline( @@ -813,7 +811,7 @@ val soapXml = node("soap-env:Envelope", soapAttrs, val testFunction = module.packages.find { it.name == "com.example" } ?.functions ?.single { it.name == "foo" } - checkNotNull(testFunction) + assertNotNull(testFunction) val documentationTags = testFunction.documentation.values.single().children assertEquals(7, documentationTags.size) @@ -873,7 +871,7 @@ val soapXml = node("soap-env:Envelope", soapAttrs, val kotlinEnum = module.packages.find { it.name == "test" } ?.classlikes ?.single { it.name == "KotlinEnum" } - checkNotNull(kotlinEnum) + assertNotNull(kotlinEnum) val valuesFunction = kotlinEnum.functions.single { it.name == "values" } val expectedValuesType = GenericTypeConstructor( @@ -936,7 +934,7 @@ val soapXml = node("soap-env:Envelope", soapAttrs, ?.classlikes ?.single { it.name == "KotlinEnum" } - checkNotNull(kotlinEnum) + assertNotNull(kotlinEnum) val entriesProperty = kotlinEnum.properties.single { it.name == "entries" } val expectedEntriesType = GenericTypeConstructor( @@ -999,7 +997,7 @@ val soapXml = node("soap-env:Envelope", soapAttrs, val kotlinEnum = module.packages.find { it.name == "test" } ?.classlikes ?.single { it.name == "KotlinEnum" } - checkNotNull(kotlinEnum) + assertNotNull(kotlinEnum) val expectedValueOfType = GenericTypeConstructor( dri = DRI( @@ -1067,9 +1065,9 @@ val soapXml = node("soap-env:Envelope", soapAttrs, val pckg = module.packages.single { it.name == "test" } val dataObject = pckg.classlikes.single { it.name == "KotlinDataObject" } - assertInstanceOf(DObject::class.java, dataObject) + assertTrue(dataObject is DObject) - val modifiers = (dataObject as DObject).modifiers().values.flatten() + val modifiers = dataObject.modifiers().values.flatten() assertEquals(1, modifiers.size) assertEquals(ExtraModifiers.KotlinOnlyModifiers.Data, modifiers[0]) } diff --git a/plugins/base/src/test/kotlin/translators/DefaultPsiToDocumentableTranslatorTest.kt b/plugins/base/src/test/kotlin/translators/DefaultPsiToDocumentableTranslatorTest.kt index b3f83d79..b75bc8e7 100644 --- a/plugins/base/src/test/kotlin/translators/DefaultPsiToDocumentableTranslatorTest.kt +++ b/plugins/base/src/test/kotlin/translators/DefaultPsiToDocumentableTranslatorTest.kt @@ -1,17 +1,13 @@ package translators import org.jetbrains.dokka.DokkaConfiguration +import org.jetbrains.dokka.DokkaConfiguration.Visibility import org.jetbrains.dokka.base.testApi.testRunner.BaseAbstractTest import org.jetbrains.dokka.links.DRI import org.jetbrains.dokka.links.PointingToDeclaration import org.jetbrains.dokka.model.* import org.jetbrains.dokka.model.doc.* -import org.jetbrains.dokka.plugability.DokkaPlugin -import org.jetbrains.dokka.plugability.DokkaPluginApiPreview -import org.jetbrains.dokka.plugability.PluginApiPreviewAcknowledgement -import org.jetbrains.dokka.DokkaConfiguration.Visibility -import org.junit.jupiter.api.Assertions.* -import org.junit.jupiter.api.Test +import kotlin.test.* import utils.JavaCode @JavaCode @@ -303,7 +299,7 @@ class DefaultPsiToDocumentableTranslatorTest : BaseAbstractTest() { val testedClass = module.packages.single().classlikes.single { it.name == "JavaClassUsingAnnotation" } val annotation = (testedClass as DClass).extra[Annotations]?.directAnnotations?.values?.single()?.single() - checkNotNull(annotation) + assertNotNull(annotation) assertEquals("JavaAnnotation", annotation.dri.classNames) @@ -404,9 +400,7 @@ class DefaultPsiToDocumentableTranslatorTest : BaseAbstractTest() { val testClass = module.packages.single().classlikes.single { it.name == "A" } val getterLookalikes = testClass.functions.filter { it.name == "getA" } - assertEquals(2, getterLookalikes.size) { - "Not all expected regular functions found, wrongly categorized as getters?" - } + assertEquals(2, getterLookalikes.size, "Not all expected regular functions found, wrongly categorized as getters?") } } } @@ -444,8 +438,8 @@ class DefaultPsiToDocumentableTranslatorTest : BaseAbstractTest() { val setter = property.setter assertNotNull(setter) - assertEquals(1, setter?.parameters?.size) - assertEquals(PrimitiveJavaType("int"), setter?.parameters?.get(0)?.type) + assertEquals(1, setter.parameters.size) + assertEquals(PrimitiveJavaType("int"), setter.parameters[0].type) val regularSetterFunctions = testClass.functions.filter { it.name == "setA" } assertEquals(4, regularSetterFunctions.size) @@ -489,12 +483,14 @@ class DefaultPsiToDocumentableTranslatorTest : BaseAbstractTest() { assertNotNull(field) { "Expected the foo property to exist because the field is private with a public getter" } - assertNull(requireNotNull(field).setter) + assertNull(field.setter) val setterMethodsWithSubtypeParams = testClass.functions.filter { it.name == "setFoo" } - assertEquals(2, setterMethodsWithSubtypeParams.size) { + assertEquals( + 2, + setterMethodsWithSubtypeParams.size, "Expected the setter methods to not qualify as accessors because of subtype parameters" - } + ) } } } @@ -517,9 +513,7 @@ class DefaultPsiToDocumentableTranslatorTest : BaseAbstractTest() { val tetClass = module.packages.single().classlikes.single { it.name == "A" } val property = tetClass.properties.firstOrNull { it.name == "a" } - assertNull(property) { - "Expected the property to stay private because there are no getters" - } + assertNull(property, "Expected the property to stay private because there are no getters") val regularSetterFunction = tetClass.functions.firstOrNull { it.name == "setA" } assertNotNull(regularSetterFunction) { @@ -757,7 +751,7 @@ class DefaultPsiToDocumentableTranslatorTest : BaseAbstractTest() { val kotlinEnum = module.packages.find { it.name == "test" } ?.classlikes ?.single { it.name == "JavaEnum" } - checkNotNull(kotlinEnum) + assertNotNull(kotlinEnum) val valuesFunction = kotlinEnum.functions.single { it.name == "values" } @@ -826,7 +820,7 @@ class DefaultPsiToDocumentableTranslatorTest : BaseAbstractTest() { val javaEnum = module.packages.find { it.name == "test" } ?.classlikes ?.single { it.name == "JavaEnum" } - checkNotNull(javaEnum) + assertNotNull(javaEnum) val valueOfFunction = javaEnum.functions.single { it.name == "valueOf" } diff --git a/plugins/base/src/test/kotlin/translators/ExternalDocumentablesTest.kt b/plugins/base/src/test/kotlin/translators/ExternalDocumentablesTest.kt index c4087b20..56ecf06a 100644 --- a/plugins/base/src/test/kotlin/translators/ExternalDocumentablesTest.kt +++ b/plugins/base/src/test/kotlin/translators/ExternalDocumentablesTest.kt @@ -1,15 +1,15 @@ package translators +import org.jetbrains.dokka.analysis.kotlin.internal.ExternalDocumentablesProvider +import org.jetbrains.dokka.analysis.kotlin.internal.InternalKotlinAnalysisPlugin import org.jetbrains.dokka.base.testApi.testRunner.BaseAbstractTest import org.jetbrains.dokka.model.DClass import org.jetbrains.dokka.model.DInterface import org.jetbrains.dokka.plugability.plugin import org.jetbrains.dokka.plugability.querySingle import org.jetbrains.dokka.utilities.cast -import org.jetbrains.dokka.analysis.kotlin.internal.ExternalDocumentablesProvider -import org.jetbrains.dokka.analysis.kotlin.internal.InternalKotlinAnalysisPlugin -import org.junit.jupiter.api.Assertions.assertEquals -import org.junit.jupiter.api.Test +import kotlin.test.Test +import kotlin.test.assertEquals import utils.OnlyDescriptors import utils.UsingJDK diff --git a/plugins/base/src/test/kotlin/translators/JavadocInheritDocsTest.kt b/plugins/base/src/test/kotlin/translators/JavadocInheritDocsTest.kt index a357491f..0434a662 100644 --- a/plugins/base/src/test/kotlin/translators/JavadocInheritDocsTest.kt +++ b/plugins/base/src/test/kotlin/translators/JavadocInheritDocsTest.kt @@ -5,9 +5,9 @@ import org.jetbrains.dokka.model.doc.CustomDocTag import org.jetbrains.dokka.model.doc.Description import org.jetbrains.dokka.model.doc.P import org.jetbrains.dokka.model.doc.Text -import org.junit.jupiter.api.Assertions.assertEquals -import org.junit.jupiter.api.Disabled -import org.junit.jupiter.api.Test +import kotlin.test.Ignore +import kotlin.test.Test +import kotlin.test.assertEquals import utils.JavaCode @JavaCode @@ -132,7 +132,7 @@ class JavadocInheritDocsTest : BaseAbstractTest() { } @Test - @Disabled("This should be enabled when we have proper tag inheritance in javadoc parser") + @Ignore // This should be enabled when we have proper tag inheritance in javadoc parser fun `work when inherited part is empty in supertype but present in its supertype`() { testInline( """ diff --git a/plugins/base/src/test/kotlin/translators/JavadocInheritedDocTagsTest.kt b/plugins/base/src/test/kotlin/translators/JavadocInheritedDocTagsTest.kt index 1e3d784a..15bc31ed 100644 --- a/plugins/base/src/test/kotlin/translators/JavadocInheritedDocTagsTest.kt +++ b/plugins/base/src/test/kotlin/translators/JavadocInheritedDocTagsTest.kt @@ -5,11 +5,11 @@ import org.jetbrains.dokka.links.DRI import org.jetbrains.dokka.links.PointingToDeclaration import org.jetbrains.dokka.model.DModule import org.jetbrains.dokka.model.doc.* -import org.junit.jupiter.api.Assertions.assertEquals -import org.junit.jupiter.api.Test -import utils.JavaCode +import kotlin.test.Test +import kotlin.test.assertEquals import org.jetbrains.dokka.model.doc.Deprecated as DokkaDeprecatedTag import org.jetbrains.dokka.model.doc.Throws as DokkaThrowsTag +import utils.JavaCode @JavaCode class JavadocInheritedDocTagsTest : BaseAbstractTest() { diff --git a/plugins/base/src/test/kotlin/translators/JavadocParserTest.kt b/plugins/base/src/test/kotlin/translators/JavadocParserTest.kt index 8bc307df..85a5e9cf 100644 --- a/plugins/base/src/test/kotlin/translators/JavadocParserTest.kt +++ b/plugins/base/src/test/kotlin/translators/JavadocParserTest.kt @@ -7,10 +7,10 @@ import org.jetbrains.dokka.model.childrenOfType import org.jetbrains.dokka.model.doc.* import org.jetbrains.dokka.model.firstChildOfType import org.jetbrains.dokka.model.firstMemberOfType -import org.junit.jupiter.api.Assertions.assertEquals -import org.junit.jupiter.api.Test -import utils.JavaCode import utils.text +import kotlin.test.Test +import kotlin.test.assertEquals +import utils.JavaCode @JavaCode class JavadocParserTest : BaseAbstractTest() { diff --git a/plugins/base/src/test/kotlin/utils/TestUtils.kt b/plugins/base/src/test/kotlin/utils/TestUtils.kt index 8cb126d5..8b794af0 100644 --- a/plugins/base/src/test/kotlin/utils/TestUtils.kt +++ b/plugins/base/src/test/kotlin/utils/TestUtils.kt @@ -4,10 +4,11 @@ import org.jetbrains.dokka.base.testApi.testRunner.BaseAbstractTest import org.jetbrains.dokka.model.* import org.jetbrains.dokka.model.doc.* import org.jetbrains.dokka.model.doc.P -import org.junit.jupiter.api.Assertions.assertEquals -import org.junit.jupiter.api.Assertions.assertTrue import kotlin.collections.orEmpty +import kotlin.test.assertEquals +import kotlin.test.assertTrue import kotlin.test.asserter +import kotlin.test.fail @DslMarker annotation class TestDSL @@ -25,7 +26,7 @@ abstract class ModelDSL : BaseAbstractTest() { interface AssertDSL { infix fun Any?.equals(other: Any?) = assertEquals(other, this) infix fun Collection<Any>?.allEquals(other: Any?) = - this?.onEach { it equals other } ?: run { assert(false) { "Collection is empty" } } + this?.onEach { it equals other } ?: run { fail("Collection is empty") } infix fun <T> Collection<T>?.exists(e: T) { assertTrue(this.orEmpty().isNotEmpty(), "Collection cannot be null or empty") assertTrue(this!!.any{it == e}, "Collection doesn't contain $e") @@ -36,7 +37,7 @@ interface AssertDSL { infix fun <T> T?.notNull(name: String): T = this.assertNotNull(name) 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()}") } /* diff --git a/plugins/gfm/build.gradle.kts b/plugins/gfm/build.gradle.kts index b7e6fc18..c238965a 100644 --- a/plugins/gfm/build.gradle.kts +++ b/plugins/gfm/build.gradle.kts @@ -18,11 +18,10 @@ dependencies { } } + testImplementation(kotlin("test")) testImplementation(projects.plugins.base) testImplementation(projects.plugins.base.baseTestUtils) testImplementation(projects.core.testApi) - testImplementation(platform(libs.junit.bom)) - testImplementation(libs.junit.jupiter) } registerDokkaArtifactPublication("gfmPlugin") { diff --git a/plugins/gfm/gfm-template-processing/build.gradle.kts b/plugins/gfm/gfm-template-processing/build.gradle.kts index 9611a8aa..12c95a08 100644 --- a/plugins/gfm/gfm-template-processing/build.gradle.kts +++ b/plugins/gfm/gfm-template-processing/build.gradle.kts @@ -16,9 +16,8 @@ dependencies { implementation(kotlin("reflect")) implementation(libs.kotlinx.coroutines.core) + testImplementation(kotlin("test")) testImplementation(projects.core.testApi) - testImplementation(platform(libs.junit.bom)) - testImplementation(libs.junit.jupiter) } registerDokkaArtifactPublication("dokkaGfmTemplateProcessing") { diff --git a/plugins/gfm/src/test/kotlin/renderers/gfm/CodeWrappingTest.kt b/plugins/gfm/src/test/kotlin/renderers/gfm/CodeWrappingTest.kt index ae40694c..676e263b 100644 --- a/plugins/gfm/src/test/kotlin/renderers/gfm/CodeWrappingTest.kt +++ b/plugins/gfm/src/test/kotlin/renderers/gfm/CodeWrappingTest.kt @@ -1,8 +1,8 @@ package renderers.gfm import org.jetbrains.dokka.gfm.renderer.CommonmarkRenderer -import org.junit.jupiter.api.Test import renderers.testPage +import kotlin.test.Test import kotlin.test.assertEquals class CodeWrappingTest : GfmRenderingOnlyTestBase() { diff --git a/plugins/gfm/src/test/kotlin/renderers/gfm/DivergentTest.kt b/plugins/gfm/src/test/kotlin/renderers/gfm/DivergentTest.kt index ae1b4d7f..32491154 100644 --- a/plugins/gfm/src/test/kotlin/renderers/gfm/DivergentTest.kt +++ b/plugins/gfm/src/test/kotlin/renderers/gfm/DivergentTest.kt @@ -5,10 +5,11 @@ import org.jetbrains.dokka.Platform import org.jetbrains.dokka.gfm.renderer.CommonmarkRenderer import org.jetbrains.dokka.links.DRI import org.jetbrains.dokka.pages.ContentDivergentGroup -import org.junit.jupiter.api.Test import renderers.testPage import testApi.testRunner.defaultSourceSet import java.io.File +import kotlin.test.Test +import kotlin.test.assertEquals class DivergentTest : GfmRenderingOnlyTestBase() { private val js = defaultSourceSet.copy( @@ -47,7 +48,7 @@ class DivergentTest : GfmRenderingOnlyTestBase() { |a""".trimMargin() CommonmarkRenderer(context).render(page) - assert(renderedContent == expect) + assertEquals(expect, renderedContent) } @Test @@ -67,7 +68,7 @@ class DivergentTest : GfmRenderingOnlyTestBase() { |a""".trimMargin() CommonmarkRenderer(context).render(page) - assert(renderedContent == expect) + assertEquals(expect, renderedContent) } @Test @@ -104,7 +105,7 @@ class DivergentTest : GfmRenderingOnlyTestBase() { |c""".trimMargin() CommonmarkRenderer(context).render(page) - assert(renderedContent == expect) + assertEquals(expect, renderedContent) } @Test @@ -138,7 +139,7 @@ class DivergentTest : GfmRenderingOnlyTestBase() { |c""".trimMargin() CommonmarkRenderer(context).render(page) - assert(renderedContent == expect) + assertEquals(expect, renderedContent) } @Test @@ -191,7 +192,7 @@ class DivergentTest : GfmRenderingOnlyTestBase() { |e""".trimMargin() CommonmarkRenderer(context).render(page) - assert(renderedContent == expect) + assertEquals(expect, renderedContent) } @Test @@ -260,7 +261,7 @@ class DivergentTest : GfmRenderingOnlyTestBase() { |e+""".trimMargin() CommonmarkRenderer(context).render(page) - assert(renderedContent == expect) + assertEquals(expect, renderedContent) } @Test @@ -295,7 +296,7 @@ class DivergentTest : GfmRenderingOnlyTestBase() { |b""".trimMargin() CommonmarkRenderer(context).render(page) - assert(renderedContent == expect) + assertEquals(expect, renderedContent) } @Test @@ -330,7 +331,7 @@ class DivergentTest : GfmRenderingOnlyTestBase() { |ab+""".trimMargin() CommonmarkRenderer(context).render(page) - assert(renderedContent == expect) + assertEquals(expect, renderedContent) } @Test @@ -373,7 +374,7 @@ class DivergentTest : GfmRenderingOnlyTestBase() { |ab+""".trimMargin() CommonmarkRenderer(context).render(page) - assert(renderedContent == expect) + assertEquals(expect, renderedContent) } @Test @@ -421,7 +422,7 @@ class DivergentTest : GfmRenderingOnlyTestBase() { |ab+""".trimMargin() CommonmarkRenderer(context).render(page) - assert(renderedContent == expect) + assertEquals(expect, renderedContent) } @Test @@ -495,6 +496,6 @@ class DivergentTest : GfmRenderingOnlyTestBase() { |e+""".trimMargin() CommonmarkRenderer(context).render(page) - assert(renderedContent == expect) + assertEquals(expect, renderedContent) } } diff --git a/plugins/gfm/src/test/kotlin/renderers/gfm/GroupWrappingTest.kt b/plugins/gfm/src/test/kotlin/renderers/gfm/GroupWrappingTest.kt index 1d6a79ca..d442b4b9 100644 --- a/plugins/gfm/src/test/kotlin/renderers/gfm/GroupWrappingTest.kt +++ b/plugins/gfm/src/test/kotlin/renderers/gfm/GroupWrappingTest.kt @@ -2,8 +2,9 @@ package renderers.gfm import org.jetbrains.dokka.gfm.renderer.CommonmarkRenderer import org.jetbrains.dokka.pages.TextStyle -import org.junit.jupiter.api.Test import renderers.testPage +import kotlin.test.Test +import kotlin.test.assertEquals class GroupWrappingTest : GfmRenderingOnlyTestBase() { @@ -21,7 +22,7 @@ class GroupWrappingTest : GfmRenderingOnlyTestBase() { |abc""".trimMargin() CommonmarkRenderer(context).render(page) - assert(renderedContent == expect) + assertEquals(expect, renderedContent) } @Test @@ -40,7 +41,7 @@ class GroupWrappingTest : GfmRenderingOnlyTestBase() { |c""".trimMargin() CommonmarkRenderer(context).render(page) - assert(renderedContent == expect) + assertEquals(expect, renderedContent) } @Test @@ -59,7 +60,7 @@ class GroupWrappingTest : GfmRenderingOnlyTestBase() { |c""".trimMargin() CommonmarkRenderer(context).render(page) - assert(renderedContent == expect) + assertEquals(expect, renderedContent) } @Test @@ -85,6 +86,6 @@ class GroupWrappingTest : GfmRenderingOnlyTestBase() { |d""".trimMargin() CommonmarkRenderer(context).render(page) - assert(renderedContent == expect) + assertEquals(expect, renderedContent) } } diff --git a/plugins/gfm/src/test/kotlin/renderers/gfm/SimpleElementsTest.kt b/plugins/gfm/src/test/kotlin/renderers/gfm/SimpleElementsTest.kt index e102f52a..a630576a 100644 --- a/plugins/gfm/src/test/kotlin/renderers/gfm/SimpleElementsTest.kt +++ b/plugins/gfm/src/test/kotlin/renderers/gfm/SimpleElementsTest.kt @@ -6,10 +6,10 @@ import org.jetbrains.dokka.pages.ContentEmbeddedResource import org.jetbrains.dokka.pages.ContentKind import org.jetbrains.dokka.pages.DCI import org.jetbrains.dokka.pages.TextStyle -import org.junit.Assert.assertEquals -import org.junit.jupiter.api.Test import renderers.RawTestPage import renderers.testPage +import kotlin.test.Test +import kotlin.test.assertEquals class SimpleElementsTest : GfmRenderingOnlyTestBase() { diff --git a/plugins/gfm/src/test/kotlin/renderers/gfm/SourceSetDependentHintTest.kt b/plugins/gfm/src/test/kotlin/renderers/gfm/SourceSetDependentHintTest.kt index dae9983a..9f8263ac 100644 --- a/plugins/gfm/src/test/kotlin/renderers/gfm/SourceSetDependentHintTest.kt +++ b/plugins/gfm/src/test/kotlin/renderers/gfm/SourceSetDependentHintTest.kt @@ -4,10 +4,11 @@ import org.jetbrains.dokka.DokkaSourceSetID import org.jetbrains.dokka.Platform import org.jetbrains.dokka.gfm.renderer.CommonmarkRenderer import org.jetbrains.dokka.pages.TextStyle -import org.junit.jupiter.api.Test import renderers.testPage import testApi.testRunner.defaultSourceSet import java.io.File +import kotlin.test.Test +import kotlin.test.assertEquals class SourceSetDependentHintTest : GfmRenderingOnlyTestBase() { @@ -45,7 +46,7 @@ class SourceSetDependentHintTest : GfmRenderingOnlyTestBase() { |abc""".trimMargin() CommonmarkRenderer(context).render(page) - assert(renderedContent == expect) + assertEquals(expect, renderedContent) } @Test @@ -69,7 +70,7 @@ class SourceSetDependentHintTest : GfmRenderingOnlyTestBase() { |c""".trimMargin() CommonmarkRenderer(context).render(page) - assert(renderedContent == expect) + assertEquals(expect, renderedContent) } @Test @@ -90,7 +91,7 @@ class SourceSetDependentHintTest : GfmRenderingOnlyTestBase() { |bc""".trimMargin() CommonmarkRenderer(context).render(page) - assert(renderedContent == expect) + assertEquals(expect, renderedContent) } @Test @@ -108,7 +109,7 @@ class SourceSetDependentHintTest : GfmRenderingOnlyTestBase() { |ab""".trimMargin() CommonmarkRenderer(context).render(page) - assert(renderedContent == expect) + assertEquals(expect, renderedContent) } @Test @@ -133,7 +134,7 @@ class SourceSetDependentHintTest : GfmRenderingOnlyTestBase() { |b""".trimMargin() CommonmarkRenderer(context).render(page) - assert(renderedContent == expect) + assertEquals(expect, renderedContent) } @Test @@ -153,7 +154,7 @@ class SourceSetDependentHintTest : GfmRenderingOnlyTestBase() { |ab""".trimMargin() CommonmarkRenderer(context).render(page) - assert(renderedContent == expect) + assertEquals(expect, renderedContent) } @Test @@ -174,6 +175,6 @@ class SourceSetDependentHintTest : GfmRenderingOnlyTestBase() { |b""".trimMargin() CommonmarkRenderer(context).render(page) - assert(renderedContent == expect) + assertEquals(expect, renderedContent) } } diff --git a/plugins/javadoc/build.gradle.kts b/plugins/javadoc/build.gradle.kts index 5c6d2eb6..e37e77db 100644 --- a/plugins/javadoc/build.gradle.kts +++ b/plugins/javadoc/build.gradle.kts @@ -17,11 +17,10 @@ dependencies { implementation(libs.kotlinx.html) implementation(libs.kotlinx.coroutines.core) + testImplementation(kotlin("test")) testImplementation(projects.plugins.base.baseTestUtils) testImplementation(projects.core.testApi) testImplementation(libs.jsoup) - testImplementation(platform(libs.junit.bom)) - testImplementation(libs.junit.jupiter) } registerDokkaArtifactPublication("javadocPlugin") { diff --git a/plugins/javadoc/src/test/kotlin/org/jetbrains/dokka/javadoc/JavadocAccessorNamingTest.kt b/plugins/javadoc/src/test/kotlin/org/jetbrains/dokka/javadoc/JavadocAccessorNamingTest.kt index eca46421..cf4260d1 100644 --- a/plugins/javadoc/src/test/kotlin/org/jetbrains/dokka/javadoc/JavadocAccessorNamingTest.kt +++ b/plugins/javadoc/src/test/kotlin/org/jetbrains/dokka/javadoc/JavadocAccessorNamingTest.kt @@ -1,9 +1,9 @@ package org.jetbrains.dokka.javadoc import org.jsoup.Jsoup -import org.junit.jupiter.api.Assertions.assertEquals -import org.junit.jupiter.api.Test import utils.TestOutputWriterPlugin +import kotlin.test.Test +import kotlin.test.assertEquals internal class JavadocAccessorNamingTest : AbstractJavadocTemplateMapTest() { diff --git a/plugins/javadoc/src/test/kotlin/org/jetbrains/dokka/javadoc/JavadocAllClassesTemplateMapTest.kt b/plugins/javadoc/src/test/kotlin/org/jetbrains/dokka/javadoc/JavadocAllClassesTemplateMapTest.kt index 6bfd068a..46e7535e 100644 --- a/plugins/javadoc/src/test/kotlin/org/jetbrains/dokka/javadoc/JavadocAllClassesTemplateMapTest.kt +++ b/plugins/javadoc/src/test/kotlin/org/jetbrains/dokka/javadoc/JavadocAllClassesTemplateMapTest.kt @@ -4,8 +4,8 @@ import org.jetbrains.dokka.javadoc.pages.AllClassesPage import org.jetbrains.dokka.javadoc.pages.LinkJavadocListEntry import org.jetbrains.dokka.links.DRI import org.jetbrains.dokka.pages.ContentKind -import org.junit.jupiter.api.Assertions.assertEquals -import org.junit.jupiter.api.Test +import kotlin.test.Test +import kotlin.test.assertEquals internal class JavadocAllClassesTemplateMapTest : AbstractJavadocTemplateMapTest() { @Test diff --git a/plugins/javadoc/src/test/kotlin/org/jetbrains/dokka/javadoc/JavadocClasslikeTemplateMapTest.kt b/plugins/javadoc/src/test/kotlin/org/jetbrains/dokka/javadoc/JavadocClasslikeTemplateMapTest.kt index 53167f71..619f0936 100644 --- a/plugins/javadoc/src/test/kotlin/org/jetbrains/dokka/javadoc/JavadocClasslikeTemplateMapTest.kt +++ b/plugins/javadoc/src/test/kotlin/org/jetbrains/dokka/javadoc/JavadocClasslikeTemplateMapTest.kt @@ -1,8 +1,8 @@ package org.jetbrains.dokka.javadoc import org.jetbrains.dokka.javadoc.pages.JavadocClasslikePageNode -import org.junit.jupiter.api.Assertions.assertEquals -import org.junit.jupiter.api.Test +import kotlin.test.Test +import kotlin.test.assertEquals internal class JavadocClasslikeTemplateMapTest : AbstractJavadocTemplateMapTest() { diff --git a/plugins/javadoc/src/test/kotlin/org/jetbrains/dokka/javadoc/JavadocDeprecatedTest.kt b/plugins/javadoc/src/test/kotlin/org/jetbrains/dokka/javadoc/JavadocDeprecatedTest.kt index f301baf6..c58a3801 100644 --- a/plugins/javadoc/src/test/kotlin/org/jetbrains/dokka/javadoc/JavadocDeprecatedTest.kt +++ b/plugins/javadoc/src/test/kotlin/org/jetbrains/dokka/javadoc/JavadocDeprecatedTest.kt @@ -2,8 +2,7 @@ package org.jetbrains.dokka.javadoc import org.jetbrains.dokka.javadoc.pages.DeprecatedPage import org.jetbrains.dokka.javadoc.renderer.TemplateMap -import org.junit.jupiter.api.Assertions -import org.junit.jupiter.api.Test +import kotlin.test.Test import kotlin.test.assertEquals internal class JavadocDeprecatedTest : AbstractJavadocTemplateMapTest() { @@ -12,7 +11,7 @@ internal class JavadocDeprecatedTest : AbstractJavadocTemplateMapTest() { fun `generates correct number of sections`() { testDeprecatedPageTemplateMaps { templateMap -> @Suppress("UNCHECKED_CAST") - Assertions.assertEquals(6, (templateMap["sections"] as List<TemplateMap>).size) + assertEquals(6, (templateMap["sections"] as List<TemplateMap>).size) } } @@ -20,7 +19,7 @@ internal class JavadocDeprecatedTest : AbstractJavadocTemplateMapTest() { fun `finds correct number of element for removal`() { testDeprecatedPageTemplateMaps { templateMap -> val map = templateMap.section("For Removal") - Assertions.assertEquals(1, map.elements().size) + assertEquals(1, map.elements().size) } } @@ -28,7 +27,7 @@ internal class JavadocDeprecatedTest : AbstractJavadocTemplateMapTest() { fun `finds correct number of deprecated constructors`() { testDeprecatedPageTemplateMaps { templateMap -> val map = templateMap.section("Constructors") - Assertions.assertEquals(1, map.elements().size) + assertEquals(1, map.elements().size) } } @@ -36,7 +35,7 @@ internal class JavadocDeprecatedTest : AbstractJavadocTemplateMapTest() { fun `finds correct number of deprecated classes`() { testDeprecatedPageTemplateMaps { templateMap -> val map = templateMap.section("Classes") - Assertions.assertEquals(1, map.elements().size) + assertEquals(1, map.elements().size) } } @@ -44,7 +43,7 @@ internal class JavadocDeprecatedTest : AbstractJavadocTemplateMapTest() { fun `finds correct number of deprecated enums`() { testDeprecatedPageTemplateMaps { templateMap -> val map = templateMap.section("Enums") - Assertions.assertEquals(1, map.elements().size) + assertEquals(1, map.elements().size) } } @@ -52,7 +51,7 @@ internal class JavadocDeprecatedTest : AbstractJavadocTemplateMapTest() { fun `finds correct number of deprecated exceptions`() { testDeprecatedPageTemplateMaps { templateMap -> val map = templateMap.section("Exceptions") - Assertions.assertEquals(2, map.elements().size) + assertEquals(2, map.elements().size) } } @@ -64,7 +63,7 @@ internal class JavadocDeprecatedTest : AbstractJavadocTemplateMapTest() { AnnotationTarget.ANNOTATION_CLASS::class.java.methods.any { it.name == "describeConstable" } val map = templateMap.section("Methods") - Assertions.assertEquals(if (hasAdditionalFunction()) 5 else 4, map.elements().size) + assertEquals(if (hasAdditionalFunction()) 5 else 4, map.elements().size) } } @@ -88,9 +87,9 @@ internal class JavadocDeprecatedTest : AbstractJavadocTemplateMapTest() { testDeprecatedPageTemplateMaps { templateMap -> val map = templateMap.section("Enums") map.elements().first().let { element -> - Assertions.assertEquals("package1.ClassCEnum", element["name"]) - Assertions.assertEquals("package1/ClassCEnum.html", element["address"]) - Assertions.assertEquals("Documentation for ClassCEnum", element["description"]) + assertEquals("package1.ClassCEnum", element["name"]) + assertEquals("package1/ClassCEnum.html", element["address"]) + assertEquals("Documentation for ClassCEnum", element["description"]) } } } @@ -188,4 +187,4 @@ internal class JavadocDeprecatedTest : AbstractJavadocTemplateMapTest() { @Suppress("UNCHECKED_CAST") private fun TemplateMap.elements() = this["elements"] as List<TemplateMap> -}
\ No newline at end of file +} diff --git a/plugins/javadoc/src/test/kotlin/org/jetbrains/dokka/javadoc/JavadocIndexTest.kt b/plugins/javadoc/src/test/kotlin/org/jetbrains/dokka/javadoc/JavadocIndexTest.kt index 4f334460..c4a3645b 100644 --- a/plugins/javadoc/src/test/kotlin/org/jetbrains/dokka/javadoc/JavadocIndexTest.kt +++ b/plugins/javadoc/src/test/kotlin/org/jetbrains/dokka/javadoc/JavadocIndexTest.kt @@ -3,8 +3,8 @@ package org.jetbrains.dokka.javadoc import org.jetbrains.dokka.javadoc.pages.IndexPage import org.jetbrains.dokka.javadoc.renderer.TemplateMap import org.jetbrains.dokka.links.DRI -import org.junit.jupiter.api.Assertions.assertEquals -import org.junit.jupiter.api.Test +import kotlin.test.Test +import kotlin.test.assertEquals import kotlin.test.assertNotNull internal class JavadocIndexTest : AbstractJavadocTemplateMapTest() { diff --git a/plugins/javadoc/src/test/kotlin/org/jetbrains/dokka/javadoc/JavadocLocationTemplateMapTest.kt b/plugins/javadoc/src/test/kotlin/org/jetbrains/dokka/javadoc/JavadocLocationTemplateMapTest.kt index ce14d675..cbba68c2 100644 --- a/plugins/javadoc/src/test/kotlin/org/jetbrains/dokka/javadoc/JavadocLocationTemplateMapTest.kt +++ b/plugins/javadoc/src/test/kotlin/org/jetbrains/dokka/javadoc/JavadocLocationTemplateMapTest.kt @@ -1,8 +1,8 @@ package org.jetbrains.dokka.javadoc import org.jetbrains.dokka.javadoc.pages.JavadocClasslikePageNode -import org.junit.jupiter.api.Assertions.assertEquals -import org.junit.jupiter.api.Test +import kotlin.test.Test +import kotlin.test.assertEquals internal class JavadocLocationTemplateMapTest : AbstractJavadocTemplateMapTest() { @Test @@ -35,4 +35,4 @@ internal class JavadocLocationTemplateMapTest : AbstractJavadocTemplateMapTest() assertEquals("../../../", map["pathToRoot"]) } } -}
\ No newline at end of file +} diff --git a/plugins/javadoc/src/test/kotlin/org/jetbrains/dokka/javadoc/JavadocModuleTemplateMapTest.kt b/plugins/javadoc/src/test/kotlin/org/jetbrains/dokka/javadoc/JavadocModuleTemplateMapTest.kt index b647cd6e..befcefc4 100644 --- a/plugins/javadoc/src/test/kotlin/org/jetbrains/dokka/javadoc/JavadocModuleTemplateMapTest.kt +++ b/plugins/javadoc/src/test/kotlin/org/jetbrains/dokka/javadoc/JavadocModuleTemplateMapTest.kt @@ -3,9 +3,9 @@ package org.jetbrains.dokka.javadoc import org.jetbrains.dokka.javadoc.pages.JavadocModulePageNode import org.jetbrains.dokka.javadoc.pages.RowJavadocListEntry import org.jetbrains.dokka.links.DRI -import org.junit.jupiter.api.Assertions.assertEquals -import org.junit.jupiter.api.Test import java.io.File +import kotlin.test.Test +import kotlin.test.assertEquals internal class JavadocModuleTemplateMapTest : AbstractJavadocTemplateMapTest() { diff --git a/plugins/javadoc/src/test/kotlin/org/jetbrains/dokka/javadoc/JavadocPackageTemplateMapTest.kt b/plugins/javadoc/src/test/kotlin/org/jetbrains/dokka/javadoc/JavadocPackageTemplateMapTest.kt index a02b01fa..e0d2505c 100644 --- a/plugins/javadoc/src/test/kotlin/org/jetbrains/dokka/javadoc/JavadocPackageTemplateMapTest.kt +++ b/plugins/javadoc/src/test/kotlin/org/jetbrains/dokka/javadoc/JavadocPackageTemplateMapTest.kt @@ -4,9 +4,9 @@ import org.jetbrains.dokka.javadoc.pages.JavadocContentKind import org.jetbrains.dokka.javadoc.pages.JavadocPackagePageNode import org.jetbrains.dokka.javadoc.pages.RowJavadocListEntry import org.jetbrains.dokka.links.DRI -import org.junit.jupiter.api.Assertions.assertEquals -import org.junit.jupiter.api.Test import java.io.File +import kotlin.test.Test +import kotlin.test.assertEquals internal class JavadocPackageTemplateMapTest : AbstractJavadocTemplateMapTest() { diff --git a/plugins/javadoc/src/test/kotlin/org/jetbrains/dokka/javadoc/location/JavadocLinkingTest.kt b/plugins/javadoc/src/test/kotlin/org/jetbrains/dokka/javadoc/location/JavadocLinkingTest.kt index afb4f04c..aff9504f 100644 --- a/plugins/javadoc/src/test/kotlin/org/jetbrains/dokka/javadoc/location/JavadocLinkingTest.kt +++ b/plugins/javadoc/src/test/kotlin/org/jetbrains/dokka/javadoc/location/JavadocLinkingTest.kt @@ -7,8 +7,8 @@ import org.jetbrains.dokka.kotlinStdlib import org.jetbrains.dokka.model.doc.DocumentationLink import org.jetbrains.dokka.model.doc.Text import org.jetbrains.dokka.utilities.cast -import org.junit.jupiter.api.Test import utils.TestOutputWriterPlugin +import kotlin.test.Test import kotlin.test.assertEquals class JavadocLinkingTest : BaseAbstractTest() { diff --git a/plugins/javadoc/src/test/kotlin/org/jetbrains/dokka/javadoc/location/JavadocLocationTest.kt b/plugins/javadoc/src/test/kotlin/org/jetbrains/dokka/javadoc/location/JavadocLocationTest.kt index 6f61f72b..de13e782 100644 --- a/plugins/javadoc/src/test/kotlin/org/jetbrains/dokka/javadoc/location/JavadocLocationTest.kt +++ b/plugins/javadoc/src/test/kotlin/org/jetbrains/dokka/javadoc/location/JavadocLocationTest.kt @@ -14,8 +14,8 @@ import org.jetbrains.dokka.pages.RootPageNode import org.jetbrains.dokka.plugability.DokkaContext import org.jetbrains.dokka.plugability.plugin import org.jetbrains.dokka.plugability.querySingle -import org.junit.jupiter.api.Assertions.assertEquals -import org.junit.jupiter.api.Test +import kotlin.test.Test +import kotlin.test.assertEquals class JavadocLocationTest : BaseAbstractTest() { diff --git a/plugins/javadoc/src/test/kotlin/org/jetbrains/dokka/javadoc/packagelist/JavadocPackageListTest.kt b/plugins/javadoc/src/test/kotlin/org/jetbrains/dokka/javadoc/packagelist/JavadocPackageListTest.kt index 1947fec7..95981df4 100644 --- a/plugins/javadoc/src/test/kotlin/org/jetbrains/dokka/javadoc/packagelist/JavadocPackageListTest.kt +++ b/plugins/javadoc/src/test/kotlin/org/jetbrains/dokka/javadoc/packagelist/JavadocPackageListTest.kt @@ -1,9 +1,9 @@ package org.jetbrains.dokka.javadoc.packagelist import org.jetbrains.dokka.javadoc.AbstractJavadocTemplateMapTest -import org.junit.jupiter.api.Assertions.assertEquals -import org.junit.jupiter.api.Test import utils.TestOutputWriterPlugin +import kotlin.test.Test +import kotlin.test.assertEquals internal class JavadocPackageListTest : AbstractJavadocTemplateMapTest() { @Test diff --git a/plugins/javadoc/src/test/kotlin/org/jetbrains/dokka/javadoc/search/JavadocIndexSearchTest.kt b/plugins/javadoc/src/test/kotlin/org/jetbrains/dokka/javadoc/search/JavadocIndexSearchTest.kt index 590fa186..9c4569cb 100644 --- a/plugins/javadoc/src/test/kotlin/org/jetbrains/dokka/javadoc/search/JavadocIndexSearchTest.kt +++ b/plugins/javadoc/src/test/kotlin/org/jetbrains/dokka/javadoc/search/JavadocIndexSearchTest.kt @@ -1,9 +1,9 @@ package org.jetbrains.dokka.javadoc.search import org.jetbrains.dokka.javadoc.AbstractJavadocTemplateMapTest -import org.junit.jupiter.api.Assertions.assertEquals -import org.junit.jupiter.api.Test import utils.TestOutputWriterPlugin +import kotlin.test.Test +import kotlin.test.assertEquals internal class JavadocIndexSearchTest : AbstractJavadocTemplateMapTest() { @Test @@ -59,4 +59,4 @@ internal class JavadocIndexSearchTest : AbstractJavadocTemplateMapTest() { assertEquals(expectedMembersJson, contents["member-search-index.js"]) } } -}
\ No newline at end of file +} diff --git a/plugins/javadoc/src/test/kotlin/org/jetbrains/dokka/javadoc/transformers/documentables/JavadocDocumentableJVMSourceSetFilterTest.kt b/plugins/javadoc/src/test/kotlin/org/jetbrains/dokka/javadoc/transformers/documentables/JavadocDocumentableJVMSourceSetFilterTest.kt index 0feae7fc..650a8016 100644 --- a/plugins/javadoc/src/test/kotlin/org/jetbrains/dokka/javadoc/transformers/documentables/JavadocDocumentableJVMSourceSetFilterTest.kt +++ b/plugins/javadoc/src/test/kotlin/org/jetbrains/dokka/javadoc/transformers/documentables/JavadocDocumentableJVMSourceSetFilterTest.kt @@ -2,7 +2,7 @@ package org.jetbrains.dokka.javadoc.transformers.documentables import org.jetbrains.dokka.DokkaSourceSetID import org.jetbrains.dokka.base.testApi.testRunner.BaseAbstractTest -import org.junit.jupiter.api.Test +import kotlin.test.Test import kotlin.test.assertEquals class JavadocDocumentableJVMSourceSetFilterTest: BaseAbstractTest() { @@ -87,4 +87,4 @@ class JavadocDocumentableJVMSourceSetFilterTest: BaseAbstractTest() { } } } -}
\ No newline at end of file +} diff --git a/plugins/javadoc/src/test/kotlin/org/jetbrains/dokka/javadoc/validity/MultiplatformConfiguredCheckerTest.kt b/plugins/javadoc/src/test/kotlin/org/jetbrains/dokka/javadoc/validity/MultiplatformConfiguredCheckerTest.kt index a892889d..4c4ad7b5 100644 --- a/plugins/javadoc/src/test/kotlin/org/jetbrains/dokka/javadoc/validity/MultiplatformConfiguredCheckerTest.kt +++ b/plugins/javadoc/src/test/kotlin/org/jetbrains/dokka/javadoc/validity/MultiplatformConfiguredCheckerTest.kt @@ -4,7 +4,7 @@ import org.jetbrains.dokka.DokkaConfigurationImpl import org.jetbrains.dokka.DokkaException import org.jetbrains.dokka.ExternalDocumentationLink import org.jetbrains.dokka.base.testApi.testRunner.BaseAbstractTest -import org.junit.jupiter.api.Test +import kotlin.test.Test import kotlin.test.assertFalse import kotlin.test.assertTrue @@ -87,4 +87,4 @@ class MultiplatformConfiguredCheckerTest : BaseAbstractTest() { } } } -}
\ No newline at end of file +} diff --git a/plugins/jekyll/build.gradle.kts b/plugins/jekyll/build.gradle.kts index ca8ad618..1ac03361 100644 --- a/plugins/jekyll/build.gradle.kts +++ b/plugins/jekyll/build.gradle.kts @@ -13,9 +13,8 @@ dependencies { implementation(kotlin("reflect")) + testImplementation(kotlin("test")) testImplementation(projects.core.testApi) - testImplementation(platform(libs.junit.bom)) - testImplementation(libs.junit.jupiter) } registerDokkaArtifactPublication("jekyllPlugin") { diff --git a/plugins/jekyll/jekyll-template-processing/build.gradle.kts b/plugins/jekyll/jekyll-template-processing/build.gradle.kts index d18b203e..1d993cdb 100644 --- a/plugins/jekyll/jekyll-template-processing/build.gradle.kts +++ b/plugins/jekyll/jekyll-template-processing/build.gradle.kts @@ -18,9 +18,8 @@ dependencies { implementation(kotlin("reflect")) implementation(libs.kotlinx.coroutines.core) + testImplementation(kotlin("test")) testImplementation(projects.core.testApi) - testImplementation(platform(libs.junit.bom)) - testImplementation(libs.junit.jupiter) } registerDokkaArtifactPublication("dokkaJekyllTemplateProcessing") { 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() { diff --git a/plugins/mathjax/build.gradle.kts b/plugins/mathjax/build.gradle.kts index 1d10d838..f84dad2e 100644 --- a/plugins/mathjax/build.gradle.kts +++ b/plugins/mathjax/build.gradle.kts @@ -13,12 +13,10 @@ dependencies { implementation(kotlin("reflect")) + testImplementation(kotlin("test")) testImplementation(libs.jsoup) testImplementation(projects.core.contentMatcherTestUtils) - testImplementation(kotlin("test-junit")) testImplementation(projects.core.testApi) - testImplementation(platform(libs.junit.bom)) - testImplementation(libs.junit.jupiter) symbolsTestConfiguration(project(path = ":subprojects:analysis-kotlin-symbols", configuration = "shadow")) descriptorsTestConfiguration(project(path = ":subprojects:analysis-kotlin-descriptors", configuration = "shadow")) diff --git a/plugins/mathjax/src/test/kotlin/MathjaxPluginTest.kt b/plugins/mathjax/src/test/kotlin/MathjaxPluginTest.kt index c603e588..9309d30f 100644 --- a/plugins/mathjax/src/test/kotlin/MathjaxPluginTest.kt +++ b/plugins/mathjax/src/test/kotlin/MathjaxPluginTest.kt @@ -4,8 +4,9 @@ import org.jetbrains.dokka.base.testApi.testRunner.BaseAbstractTest import org.jetbrains.dokka.mathjax.LIB_PATH import org.jetbrains.dokka.mathjax.MathjaxPlugin import org.jsoup.Jsoup -import org.junit.jupiter.api.Test import utils.TestOutputWriterPlugin +import kotlin.test.Test +import kotlin.test.assertTrue class MathjaxPluginTest : BaseAbstractTest() { @Test @@ -38,7 +39,7 @@ class MathjaxPluginTest : BaseAbstractTest() { .head() .select("link, script") .let { - assert(!it.`is`("[href=$LIB_PATH], [src=$LIB_PATH]")) + assertTrue(!it.`is`("[href=$LIB_PATH], [src=$LIB_PATH]")) } } } @@ -75,10 +76,10 @@ class MathjaxPluginTest : BaseAbstractTest() { val parsed = Jsoup.parse(writerPlugin.writer.contents.getValue("root/example/test.html")) // Ensure the MathJax CDN is loaded - assert(parsed.select("link, script").`is`("[href=$LIB_PATH], [src=$LIB_PATH]")) + assertTrue(parsed.select("link, script").`is`("[href=$LIB_PATH], [src=$LIB_PATH]")) // Ensure the contents are displayed - assert(parsed.select("p").any { + assertTrue(parsed.select("p").any { it.text().contains(math) }) } diff --git a/plugins/templating/build.gradle.kts b/plugins/templating/build.gradle.kts index 333daf22..4b3dc330 100644 --- a/plugins/templating/build.gradle.kts +++ b/plugins/templating/build.gradle.kts @@ -19,9 +19,10 @@ dependencies { implementation(kotlin("reflect")) implementation(libs.kotlinx.coroutines.core) + testImplementation(kotlin("test")) + testImplementation(libs.junit.jupiterParams) + testImplementation(projects.plugins.base.baseTestUtils) testImplementation(projects.core.testApi) - testImplementation(platform(libs.junit.bom)) - testImplementation(libs.junit.jupiter) testImplementation(libs.kotlinx.html) } diff --git a/plugins/templating/src/test/kotlin/org/jetbrains/dokka/templates/AddToNavigationCommandResolutionTest.kt b/plugins/templating/src/test/kotlin/org/jetbrains/dokka/templates/AddToNavigationCommandResolutionTest.kt index 81d39752..06edfabd 100644 --- a/plugins/templating/src/test/kotlin/org/jetbrains/dokka/templates/AddToNavigationCommandResolutionTest.kt +++ b/plugins/templating/src/test/kotlin/org/jetbrains/dokka/templates/AddToNavigationCommandResolutionTest.kt @@ -9,39 +9,42 @@ import org.jetbrains.dokka.DokkaModuleDescriptionImpl import org.jetbrains.dokka.base.renderers.html.templateCommand import org.jetbrains.dokka.base.templating.AddToNavigationCommand import org.jetbrains.dokka.plugability.DokkaContext -import org.junit.Rule -import org.junit.jupiter.api.Test +import org.junit.jupiter.api.io.TempDir import org.junit.jupiter.params.ParameterizedTest import org.junit.jupiter.params.provider.ValueSource -import org.junit.rules.TemporaryFolder import utils.assertHtmlEqualsIgnoringWhitespace +import java.io.File +import kotlin.test.Test class AddToNavigationCommandResolutionTest : TemplatingAbstractTest() { - @get:Rule - val folder: TemporaryFolder = TemporaryFolder() @Test - fun `should substitute AddToNavigationCommand in root directory`() = - addToNavigationTest { - val output = folder.root.resolve("navigation.html").readText() + fun `should substitute AddToNavigationCommand in root directory`(@TempDir outputDirectory: File) { + addToNavigationTest(outputDirectory) { + val output = outputDirectory.resolve("navigation.html").readText() val expected = expectedOutput( ModuleWithPrefix("module1"), ModuleWithPrefix("module2") ) assertHtmlEqualsIgnoringWhitespace(expected, output) } + } @ParameterizedTest @ValueSource(strings = ["module1", "module2"]) - fun `should substitute AddToNavigationCommand in modules directory`(moduleName: String) = - addToNavigationTest { - val output = folder.root.resolve(moduleName).resolve("navigation.html").readText() + fun `should substitute AddToNavigationCommand in modules directory`( + moduleName: String, + @TempDir outputDirectory: File + ) { + addToNavigationTest(outputDirectory) { + val output = outputDirectory.resolve(moduleName).resolve("navigation.html").readText() val expected = expectedOutput( ModuleWithPrefix("module1", ".."), ModuleWithPrefix("module2", "..") ) assertHtmlEqualsIgnoringWhitespace(expected, output) } + } private fun expectedOutput(vararg modulesWithPrefix: ModuleWithPrefix) = createHTML(prettyPrint = true) .div("sideMenu") { @@ -98,10 +101,9 @@ class AddToNavigationCommandResolutionTest : TemplatingAbstractTest() { } } - private fun addToNavigationTest(test: (DokkaContext) -> Unit) { - folder.create() - val module1 = folder.newFolder("module1") - val module2 = folder.newFolder("module2") + private fun addToNavigationTest(outputDirectory: File, test: (DokkaContext) -> Unit) { + val module1 = outputDirectory.resolve("module1").also { it.mkdirs() } + val module2 = outputDirectory.resolve("module2").also { it.mkdirs() } val configuration = dokkaConfiguration { modules = listOf( @@ -118,7 +120,7 @@ class AddToNavigationCommandResolutionTest : TemplatingAbstractTest() { sourceOutputDirectory = module2, ), ) - this.outputDir = folder.root + this.outputDir = outputDirectory } val module1Navigation = module1.resolve("navigation.html") diff --git a/plugins/templating/src/test/kotlin/org/jetbrains/dokka/templates/AddToSearchCommandResolutionTest.kt b/plugins/templating/src/test/kotlin/org/jetbrains/dokka/templates/AddToSearchCommandResolutionTest.kt index 45c70469..b62f0f61 100644 --- a/plugins/templating/src/test/kotlin/org/jetbrains/dokka/templates/AddToSearchCommandResolutionTest.kt +++ b/plugins/templating/src/test/kotlin/org/jetbrains/dokka/templates/AddToSearchCommandResolutionTest.kt @@ -5,54 +5,35 @@ import org.jetbrains.dokka.base.renderers.html.SearchRecord import org.jetbrains.dokka.base.templating.AddToSearch import org.jetbrains.dokka.base.templating.parseJson import org.jetbrains.dokka.base.templating.toJsonString -import org.junit.Rule +import org.junit.jupiter.api.io.TempDir import org.junit.jupiter.params.ParameterizedTest import org.junit.jupiter.params.provider.ValueSource -import org.junit.rules.TemporaryFolder import java.io.File import kotlin.test.assertEquals class AddToSearchCommandResolutionTest : TemplatingAbstractTest() { - companion object { - val elements = listOf( - SearchRecord(name = "name1", location = "location1"), - SearchRecord(name = "name2", location = "location2") - ) - val fromModule1 = AddToSearch( - moduleName = "module1", - elements = elements - ) - val fromModule2 = AddToSearch( - moduleName = "module2", - elements = elements - ) - } - - @get:Rule - val folder: TemporaryFolder = TemporaryFolder() @ParameterizedTest @ValueSource(strings = ["pages.json"]) - fun `should merge navigation templates`(fileName: String) { - setupTestDirectoriesWithContent(fileName) + fun `should merge navigation templates`(fileName: String, @TempDir outputDirectory: File) { + setupTestDirectoriesWithContent(outputDirectory, fileName) - val outputDir = folder.root val configuration = dokkaConfiguration { modules = listOf( DokkaModuleDescriptionImpl( name = "module1", - relativePathToOutputDirectory = folder.root.resolve("module1"), + relativePathToOutputDirectory = outputDirectory.resolve("module1"), includes = emptySet(), - sourceOutputDirectory = folder.root.resolve("module1"), + sourceOutputDirectory = outputDirectory.resolve("module1"), ), DokkaModuleDescriptionImpl( name = "module2", - relativePathToOutputDirectory = folder.root.resolve("module2"), + relativePathToOutputDirectory = outputDirectory.resolve("module2"), includes = emptySet(), - sourceOutputDirectory = folder.root.resolve("module2"), + sourceOutputDirectory = outputDirectory.resolve("module2"), ), ) - this.outputDir = outputDir + this.outputDir = outputDirectory } testFromData(configuration, useOutputLocationFromConfig = true) { @@ -61,17 +42,16 @@ class AddToSearchCommandResolutionTest : TemplatingAbstractTest() { elements.map { it.copy(location = "module2/${it.location}") } val output = - parseJson<List<SearchRecord>>(outputDir.resolve("scripts/${fileName}").readText()) + parseJson<List<SearchRecord>>(outputDirectory.resolve("scripts/${fileName}").readText()) assertEquals(expected, output.sortedBy { it.location }) } } } - private fun setupTestDirectoriesWithContent(fileName: String): List<File> { - folder.create() - val scriptsForModule1 = folder.newFolder("module1", "scripts") - val scriptsForModule2 = folder.newFolder("module2", "scripts") - folder.newFolder("scripts") + private fun setupTestDirectoriesWithContent(outputDirectory: File, fileName: String): List<File> { + val scriptsForModule1 = outputDirectory.resolve("module1/scripts").also { it.mkdirs() } + val scriptsForModule2 = outputDirectory.resolve("module2/scripts").also { it.mkdirs() } + outputDirectory.resolve("scripts").also { it.mkdirs() } val module1Navigation = scriptsForModule1.resolve(fileName) module1Navigation.writeText(toJsonString(fromModule1)) @@ -80,4 +60,19 @@ class AddToSearchCommandResolutionTest : TemplatingAbstractTest() { return listOf(module1Navigation, module2Navigation) } + + companion object { + val elements = listOf( + SearchRecord(name = "name1", location = "location1"), + SearchRecord(name = "name2", location = "location2") + ) + val fromModule1 = AddToSearch( + moduleName = "module1", + elements = elements + ) + val fromModule2 = AddToSearch( + moduleName = "module2", + elements = elements + ) + } } diff --git a/plugins/templating/src/test/kotlin/org/jetbrains/dokka/templates/SubstitutionCommandResolutionTest.kt b/plugins/templating/src/test/kotlin/org/jetbrains/dokka/templates/SubstitutionCommandResolutionTest.kt index c31f63c7..d03a1b36 100644 --- a/plugins/templating/src/test/kotlin/org/jetbrains/dokka/templates/SubstitutionCommandResolutionTest.kt +++ b/plugins/templating/src/test/kotlin/org/jetbrains/dokka/templates/SubstitutionCommandResolutionTest.kt @@ -9,19 +9,15 @@ import org.jetbrains.dokka.DokkaModuleDescriptionImpl import org.jetbrains.dokka.base.renderers.html.templateCommand import org.jetbrains.dokka.base.renderers.html.templateCommandAsHtmlComment import org.jetbrains.dokka.base.templating.PathToRootSubstitutionCommand -import org.junit.Rule -import org.junit.jupiter.api.Test -import org.junit.rules.TemporaryFolder +import org.junit.jupiter.api.io.TempDir import utils.assertHtmlEqualsIgnoringWhitespace import java.io.File +import kotlin.test.Test class SubstitutionCommandResolutionTest : TemplatingAbstractTest() { - @get:Rule - val folder: TemporaryFolder = TemporaryFolder() - @Test - fun `should handle PathToRootCommand`() { + fun `should handle PathToRootCommand`(@TempDir outputDirectory: File) { val template = createHTML() .templateCommand(PathToRootSubstitutionCommand(pattern = "###", default = "default")) { a { @@ -38,11 +34,11 @@ class SubstitutionCommandResolutionTest : TemplatingAbstractTest() { id = "logo" } } - checkSubstitutedResult(template, expected) + checkSubstitutedResult(outputDirectory, template, expected) } @Test - fun `should handle PathToRootCommand as HTML comment`() { + fun `should handle PathToRootCommand as HTML comment`(@TempDir outputDirectory: File) { val template = createHTML().span { templateCommandAsHtmlComment(PathToRootSubstitutionCommand(pattern = "###", default = "default")) { this@span.a { @@ -76,30 +72,22 @@ class SubstitutionCommandResolutionTest : TemplatingAbstractTest() { } } } - checkSubstitutedResult(template, expected) - } - - private fun createDirectoriesAndWriteContent(content: String): File { - folder.create() - val module1 = folder.newFolder("module1") - val module1Content = module1.resolve("index.html") - module1Content.writeText(content) - return module1Content + checkSubstitutedResult(outputDirectory, template, expected) } - private fun checkSubstitutedResult(template: String, expected:String) { - val testedFile = createDirectoriesAndWriteContent(template) + private fun checkSubstitutedResult(outputDirectory: File, template: String, expected:String) { + val testedFile = createDirectoriesAndWriteContent(outputDirectory, template) val configuration = dokkaConfiguration { modules = listOf( DokkaModuleDescriptionImpl( name = "module1", - relativePathToOutputDirectory = folder.root.resolve("module1"), + relativePathToOutputDirectory = outputDirectory.resolve("module1"), includes = emptySet(), - sourceOutputDirectory = folder.root.resolve("module1"), + sourceOutputDirectory = outputDirectory.resolve("module1"), ) ) - this.outputDir = folder.root + this.outputDir = outputDirectory } testFromData(configuration, useOutputLocationFromConfig = true){ @@ -108,4 +96,11 @@ class SubstitutionCommandResolutionTest : TemplatingAbstractTest() { } } } + + private fun createDirectoriesAndWriteContent(outputDirectory: File, content: String): File { + val module1 = outputDirectory.resolve("module1").also { it.mkdirs() } + val module1Content = module1.resolve("index.html") + module1Content.writeText(content) + return module1Content + } } diff --git a/plugins/versioning/build.gradle.kts b/plugins/versioning/build.gradle.kts index 68db9d1c..eee73795 100644 --- a/plugins/versioning/build.gradle.kts +++ b/plugins/versioning/build.gradle.kts @@ -26,7 +26,6 @@ dependencies { } } + testImplementation(kotlin("test")) testImplementation(projects.core.testApi) - testImplementation(platform(libs.junit.bom)) - testImplementation(libs.junit.jupiter) } |