aboutsummaryrefslogtreecommitdiff
path: root/test/src/model/JavaTest.kt
blob: 281d51efbb23ae395b0d9089874c22e7c093426f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
package org.jetbrains.dokka.tests

import kotlin.test.*
import org.jetbrains.dokka.*
import org.junit.*

public class JavaTest {
    Test fun function() {
        verifyModel("test/data/java/member.java") { model ->
            val pkg = model.members.single()
            with(pkg.members.single()) {
                assertEquals("Test", name)
                assertEquals(DocumentationNode.Kind.Class, kind)
                with(members.single()) {
                    assertEquals("fn", name)
                    assertEquals(DocumentationNode.Kind.Function, kind)
                    assertEquals("Summary for Function", content.summary.toTestString())
                    assertEquals("Unit", detail(DocumentationNode.Kind.Type).name)
                    assertTrue(members.none())
                    assertTrue(links.none())
                    with(details.first { it.name == "name" }) {
                        assertEquals(DocumentationNode.Kind.Parameter, kind)
                        assertEquals("String", detail(DocumentationNode.Kind.Type).name)
                    }
                    with(details.first { it.name == "value" }) {
                        assertEquals(DocumentationNode.Kind.Parameter, kind)
                        assertEquals("Int", detail(DocumentationNode.Kind.Type).name)
                    }
                }
            }
        }
    }

    Test fun memberWithModifiers() {
        verifyModel("test/data/java/memberWithModifiers.java") { model ->
            val pkg = model.members.single()
            with(pkg.members.single()) {
                assertEquals("abstract", details[0].name)
                with(members.single()) {
                    assertEquals("protected", details[0].name)
                }
            }
        }
    }
}