Skip to content

Commit

Permalink
Fix javadoc tests for Java >=12 (#3263)
Browse files Browse the repository at this point in the history
* Fix the test `handles correct number of elements`

* Mute the test `finds correct number of deprecated methods`
  • Loading branch information
vmishenev authored Oct 26, 2023
1 parent 9b07435 commit b1ccc2b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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 ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -73,14 +72,15 @@ 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" }

testIndexPages(commonTestQuery) { indexPages ->
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" +
Expand Down

0 comments on commit b1ccc2b

Please sign in to comment.