diff options
Diffstat (limited to 'core/src/test/kotlin/model/JavaTest.kt')
-rw-r--r-- | core/src/test/kotlin/model/JavaTest.kt | 92 |
1 files changed, 46 insertions, 46 deletions
diff --git a/core/src/test/kotlin/model/JavaTest.kt b/core/src/test/kotlin/model/JavaTest.kt index 903260d3..3d6f2e75 100644 --- a/core/src/test/kotlin/model/JavaTest.kt +++ b/core/src/test/kotlin/model/JavaTest.kt @@ -1,7 +1,7 @@ package org.jetbrains.dokka.tests -import org.jetbrains.dokka.DocumentationNode -import org.jetbrains.dokka.DocumentationReference +import org.jetbrains.dokka.NodeKind +import org.jetbrains.dokka.RefKind import org.junit.Test import kotlin.test.assertEquals import kotlin.test.assertFalse @@ -11,8 +11,8 @@ public class JavaTest { @Test fun function() { verifyJavaPackageMember("testdata/java/member.java") { cls -> assertEquals("Test", cls.name) - assertEquals(DocumentationNode.Kind.Class, cls.kind) - with(cls.members(DocumentationNode.Kind.Function).single()) { + assertEquals(NodeKind.Class, cls.kind) + with(cls.members(NodeKind.Function).single()) { assertEquals("fn", name) assertEquals("Summary for Function", content.summary.toTestString().trimEnd()) assertEquals(3, content.sections.size) @@ -30,16 +30,16 @@ public class JavaTest { assertEquals("Author", tag) assertEquals("yole", toTestString()) } - assertEquals("Unit", detail(DocumentationNode.Kind.Type).name) + assertEquals("Unit", detail(NodeKind.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) + assertEquals(NodeKind.Parameter, kind) + assertEquals("String", detail(NodeKind.Type).name) } with(details.first { it.name == "value" }) { - assertEquals(DocumentationNode.Kind.Parameter, kind) - assertEquals("Int", detail(DocumentationNode.Kind.Type).name) + assertEquals(NodeKind.Parameter, kind) + assertEquals("Int", detail(NodeKind.Type).name) } } } @@ -47,7 +47,7 @@ public class JavaTest { @Test fun memberWithModifiers() { verifyJavaPackageMember("testdata/java/memberWithModifiers.java") { cls -> - val modifiers = cls.details(DocumentationNode.Kind.Modifier).map { it.name } + val modifiers = cls.details(NodeKind.Modifier).map { it.name } assertTrue("abstract" in modifiers) with(cls.members.single { it.name == "fn" }) { assertEquals("protected", details[0].name) @@ -60,7 +60,7 @@ public class JavaTest { @Test fun superClass() { verifyJavaPackageMember("testdata/java/superClass.java") { cls -> - val superTypes = cls.details(DocumentationNode.Kind.Supertype) + val superTypes = cls.details(NodeKind.Supertype) assertEquals(2, superTypes.size) assertEquals("Exception", superTypes[0].name) assertEquals("Cloneable", superTypes[1].name) @@ -69,12 +69,12 @@ public class JavaTest { @Test fun arrayType() { verifyJavaPackageMember("testdata/java/arrayType.java") { cls -> - with(cls.members(DocumentationNode.Kind.Function).single()) { - val type = detail(DocumentationNode.Kind.Type) + with(cls.members(NodeKind.Function).single()) { + val type = detail(NodeKind.Type) assertEquals("Array", type.name) - assertEquals("String", type.detail(DocumentationNode.Kind.Type).name) - with(details(DocumentationNode.Kind.Parameter).single()) { - val parameterType = detail(DocumentationNode.Kind.Type) + assertEquals("String", type.detail(NodeKind.Type).name) + with(details(NodeKind.Parameter).single()) { + val parameterType = detail(NodeKind.Type) assertEquals("IntArray", parameterType.name) } } @@ -83,16 +83,16 @@ public class JavaTest { @Test fun typeParameter() { verifyJavaPackageMember("testdata/java/typeParameter.java") { cls -> - val typeParameters = cls.details(DocumentationNode.Kind.TypeParameter) + val typeParameters = cls.details(NodeKind.TypeParameter) with(typeParameters.single()) { assertEquals("T", name) - with(detail(DocumentationNode.Kind.UpperBound)) { + with(detail(NodeKind.UpperBound)) { assertEquals("Comparable", name) - assertEquals("T", detail(DocumentationNode.Kind.Type).name) + assertEquals("T", detail(NodeKind.Type).name) } } - with(cls.members(DocumentationNode.Kind.Function).single()) { - val methodTypeParameters = details(DocumentationNode.Kind.TypeParameter) + with(cls.members(NodeKind.Function).single()) { + val methodTypeParameters = details(NodeKind.TypeParameter) with(methodTypeParameters.single()) { assertEquals("E", name) } @@ -102,7 +102,7 @@ public class JavaTest { @Test fun constructors() { verifyJavaPackageMember("testdata/java/constructors.java") { cls -> - val constructors = cls.members(DocumentationNode.Kind.Constructor) + val constructors = cls.members(NodeKind.Constructor) assertEquals(2, constructors.size) with(constructors[0]) { assertEquals("<init>", name) @@ -112,39 +112,39 @@ public class JavaTest { @Test fun innerClass() { verifyJavaPackageMember("testdata/java/innerClass.java") { cls -> - val innerClass = cls.members(DocumentationNode.Kind.Class).single() + val innerClass = cls.members(NodeKind.Class).single() assertEquals("D", innerClass.name) } } @Test fun varargs() { verifyJavaPackageMember("testdata/java/varargs.java") { cls -> - val fn = cls.members(DocumentationNode.Kind.Function).single() - val param = fn.detail(DocumentationNode.Kind.Parameter) - assertEquals("vararg", param.details(DocumentationNode.Kind.Modifier).first().name) - val psiType = param.detail(DocumentationNode.Kind.Type) + val fn = cls.members(NodeKind.Function).single() + val param = fn.detail(NodeKind.Parameter) + assertEquals("vararg", param.details(NodeKind.Modifier).first().name) + val psiType = param.detail(NodeKind.Type) assertEquals("String", psiType.name) - assertTrue(psiType.details(DocumentationNode.Kind.Type).isEmpty()) + assertTrue(psiType.details(NodeKind.Type).isEmpty()) } } @Test fun fields() { verifyJavaPackageMember("testdata/java/field.java") { cls -> - val i = cls.members(DocumentationNode.Kind.Property).single { it.name == "i" } - assertEquals("Int", i.detail(DocumentationNode.Kind.Type).name) - assertTrue("var" in i.details(DocumentationNode.Kind.Modifier).map { it.name }) - - val s = cls.members(DocumentationNode.Kind.Property).single { it.name == "s" } - assertEquals("String", s.detail(DocumentationNode.Kind.Type).name) - assertFalse("var" in s.details(DocumentationNode.Kind.Modifier).map { it.name }) - assertTrue("static" in s.details(DocumentationNode.Kind.Modifier).map { it.name }) + val i = cls.members(NodeKind.Property).single { it.name == "i" } + assertEquals("Int", i.detail(NodeKind.Type).name) + assertTrue("var" in i.details(NodeKind.Modifier).map { it.name }) + + val s = cls.members(NodeKind.Property).single { it.name == "s" } + assertEquals("String", s.detail(NodeKind.Type).name) + assertFalse("var" in s.details(NodeKind.Modifier).map { it.name }) + assertTrue("static" in s.details(NodeKind.Modifier).map { it.name }) } } @Test fun staticMethod() { verifyJavaPackageMember("testdata/java/staticMethod.java") { cls -> - val m = cls.members(DocumentationNode.Kind.Function).single { it.name == "foo" } - assertTrue("static" in m.details(DocumentationNode.Kind.Modifier).map { it.name }) + val m = cls.members(NodeKind.Function).single { it.name == "foo" } + assertTrue("static" in m.details(NodeKind.Modifier).map { it.name }) } } @@ -154,10 +154,10 @@ public class JavaTest { with(cls.annotations[0]) { assertEquals(1, details.count()) with(details[0]) { - assertEquals(DocumentationNode.Kind.Parameter, kind) + assertEquals(NodeKind.Parameter, kind) assertEquals(1, details.count()) with(details[0]) { - assertEquals(DocumentationNode.Kind.Value, kind) + assertEquals(NodeKind.Value, kind) assertEquals("[AnnotationTarget.FIELD, AnnotationTarget.CLASS, AnnotationTarget.FILE, AnnotationTarget.FUNCTION, AnnotationTarget.PROPERTY_GETTER, AnnotationTarget.PROPERTY_SETTER]", name) } } @@ -167,30 +167,30 @@ public class JavaTest { @Test fun deprecation() { verifyJavaPackageMember("testdata/java/deprecation.java") { cls -> - val fn = cls.members(DocumentationNode.Kind.Function).single() + val fn = cls.members(NodeKind.Function).single() assertEquals("This should no longer be used", fn.deprecation!!.content.toTestString()) } } @Test fun javaLangObject() { verifyJavaPackageMember("testdata/java/javaLangObject.java") { cls -> - val fn = cls.members(DocumentationNode.Kind.Function).single() - assertEquals("Any", fn.detail(DocumentationNode.Kind.Type).name) + val fn = cls.members(NodeKind.Function).single() + assertEquals("Any", fn.detail(NodeKind.Type).name) } } @Test fun enumValues() { verifyJavaPackageMember("testdata/java/enumValues.java") { cls -> - val superTypes = cls.details(DocumentationNode.Kind.Supertype) + val superTypes = cls.details(NodeKind.Supertype) assertEquals(0, superTypes.size) - assertEquals(1, cls.members(DocumentationNode.Kind.EnumItem).size) + assertEquals(1, cls.members(NodeKind.EnumItem).size) } } @Test fun inheritorLinks() { verifyJavaPackageMember("testdata/java/inheritorLinks.java") { cls -> val fooClass = cls.members.single { it.name == "Foo" } - val inheritors = fooClass.references(DocumentationReference.Kind.Inheritor) + val inheritors = fooClass.references(RefKind.Inheritor) assertEquals(1, inheritors.size) } } |