aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVadim Mishenev <vad-mishenev@yandex.ru>2023-10-27 02:14:44 +0300
committerGitHub <noreply@github.com>2023-10-27 02:14:44 +0300
commitb1ccc2b346ea858762653933f9dd304b91c18505 (patch)
treede584624fb74c6d81caed28887a3fb78b98ff504
parent9b07435773831874d4d80066a2227596198af988 (diff)
downloaddokka-b1ccc2b346ea858762653933f9dd304b91c18505.tar.gz
dokka-b1ccc2b346ea858762653933f9dd304b91c18505.tar.bz2
dokka-b1ccc2b346ea858762653933f9dd304b91c18505.zip
Fix javadoc tests for Java >=12 (#3263)
* Fix the test `handles correct number of elements` * Mute the test `finds correct number of deprecated methods`
-rw-r--r--plugins/javadoc/src/test/kotlin/org/jetbrains/dokka/javadoc/JavadocDeprecatedTest.kt2
-rw-r--r--plugins/javadoc/src/test/kotlin/org/jetbrains/dokka/javadoc/JavadocIndexTest.kt4
2 files changed, 4 insertions, 2 deletions
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 beb6c60d..404e1aed 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
@@ -6,6 +6,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.Tag
import kotlin.test.Test
import kotlin.test.assertEquals
@@ -59,6 +60,7 @@ internal class JavadocDeprecatedTest : AbstractJavadocTemplateMapTest() {
}
}
+ @Tag("onlyDescriptors") // https://github.com/Kotlin/dokka/issues/3266 - `describeConstable` is in deprecated page on Java 17
@Test
fun `finds correct number of deprecated methods`() {
testDeprecatedPageTemplateMaps { templateMap ->
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 ba8f73cf..e574aeac 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
@@ -7,7 +7,6 @@ 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.Tag
import kotlin.test.Test
import kotlin.test.assertEquals
import kotlin.test.assertNotNull
@@ -73,6 +72,7 @@ internal class JavadocIndexTest : AbstractJavadocTemplateMapTest() {
@Test
fun `handles correct number of elements`() {
//We are checking whether we will have an additional function for enum classes
+ // e.g. since Java 12 it has `describeConstable`
fun hasAdditionalFunction() =
AnnotationTarget.ANNOTATION_CLASS::class.java.methods.any { it.name == "describeConstable" }
@@ -80,7 +80,7 @@ internal class JavadocIndexTest : AbstractJavadocTemplateMapTest() {
assertEquals("A-index: a, A\n" +
"B-index: b\n" +
"C-index: c, ClassA, ClassB, ClassC, ClassC.InnerClass, ClassCEnum, compareTo\n" +
- "D-index: d, D\n" +
+ (if (hasAdditionalFunction()) "D-index: d, D, describeConstable\n" else "D-index: d, D\n") +
"E-index: e, E, equals, equals\n" +
"F-index: f\n" +
"G-index: g, getDeclaringClass, getEntries, getName, getOrdinal\n" +