From 9af0b307a14253a21d11d340a78dd9061abee359 Mon Sep 17 00:00:00 2001 From: Vsevolod Tolstopyatov Date: Mon, 27 Mar 2023 03:01:34 -0700 Subject: Mark utilities.* API as Dokka-internal (#2937) * Deprecate unused declaration, remove inline declaration (as it's binary compatible), opt-in into internal API at project level * Opt-in into DokkaInternalApi where applicable * Get rid of intermediate test-utils module --- .../test/kotlin/org/jetbrains/dokka/javadoc/Asserts.kt | 17 +++++++++++++++++ .../dokka/javadoc/JavadocAllClassesTemplateMapTest.kt | 1 - .../dokka/javadoc/JavadocClasslikeTemplateMapTest.kt | 1 - .../dokka/javadoc/JavadocModuleTemplateMapTest.kt | 1 - .../dokka/javadoc/JavadocPackageTemplateMapTest.kt | 1 - 5 files changed, 17 insertions(+), 4 deletions(-) create mode 100644 plugins/javadoc/src/test/kotlin/org/jetbrains/dokka/javadoc/Asserts.kt (limited to 'plugins/javadoc/src/test/kotlin/org') diff --git a/plugins/javadoc/src/test/kotlin/org/jetbrains/dokka/javadoc/Asserts.kt b/plugins/javadoc/src/test/kotlin/org/jetbrains/dokka/javadoc/Asserts.kt new file mode 100644 index 00000000..9f48b1db --- /dev/null +++ b/plugins/javadoc/src/test/kotlin/org/jetbrains/dokka/javadoc/Asserts.kt @@ -0,0 +1,17 @@ +package org.jetbrains.dokka.javadoc + +import kotlin.contracts.* + +// TODO replace with assertIs from kotlin-test as part of #2924 +@OptIn(ExperimentalContracts::class) +inline fun assertIsInstance(obj: Any?): T { + contract { + returns() implies (obj is T) + } + + if (obj is T) { + return obj + } + + throw AssertionError("Expected instance of type ${T::class.qualifiedName} but found $obj") +} 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 f62c1886..6bfd068a 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,7 +4,6 @@ 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.jetbrains.dokka.test.assertIsInstance import org.junit.jupiter.api.Assertions.assertEquals import org.junit.jupiter.api.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 0f8d7e79..65fbd30f 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 @@ -3,7 +3,6 @@ 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 org.jetbrains.dokka.test.assertIsInstance internal class JavadocClasslikeTemplateMapTest : AbstractJavadocTemplateMapTest() { 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 f6b8439f..b647cd6e 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,7 +3,6 @@ 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.jetbrains.dokka.test.assertIsInstance import org.junit.jupiter.api.Assertions.assertEquals import org.junit.jupiter.api.Test import java.io.File 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 4a761ca6..a02b01fa 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,7 +4,6 @@ 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.jetbrains.dokka.test.assertIsInstance import org.junit.jupiter.api.Assertions.assertEquals import org.junit.jupiter.api.Test import java.io.File -- cgit