aboutsummaryrefslogtreecommitdiff
path: root/plugins/base/src/test/kotlin/translators/DefaultPsiToDocumentableTranslatorTest.kt
diff options
context:
space:
mode:
authorIgnat Beresnev <ignat.beresnev@jetbrains.com>2023-08-30 15:58:46 +0200
committerGitHub <noreply@github.com>2023-08-30 15:58:46 +0200
commitc63ea36637ce956029fb15b1482c0683ecb8a587 (patch)
tree2b75a8a976b43530820e73dc60cce4b10d9fc005 /plugins/base/src/test/kotlin/translators/DefaultPsiToDocumentableTranslatorTest.kt
parent0e00edc6fcd406fcf38673ef6a2f8f59e8374de2 (diff)
downloaddokka-c63ea36637ce956029fb15b1482c0683ecb8a587.tar.gz
dokka-c63ea36637ce956029fb15b1482c0683ecb8a587.tar.bz2
dokka-c63ea36637ce956029fb15b1482c0683ecb8a587.zip
Migrate to JUnit 5 and unify used test API (#3138)
Diffstat (limited to 'plugins/base/src/test/kotlin/translators/DefaultPsiToDocumentableTranslatorTest.kt')
-rw-r--r--plugins/base/src/test/kotlin/translators/DefaultPsiToDocumentableTranslatorTest.kt34
1 files changed, 14 insertions, 20 deletions
diff --git a/plugins/base/src/test/kotlin/translators/DefaultPsiToDocumentableTranslatorTest.kt b/plugins/base/src/test/kotlin/translators/DefaultPsiToDocumentableTranslatorTest.kt
index b3f83d79..b75bc8e7 100644
--- a/plugins/base/src/test/kotlin/translators/DefaultPsiToDocumentableTranslatorTest.kt
+++ b/plugins/base/src/test/kotlin/translators/DefaultPsiToDocumentableTranslatorTest.kt
@@ -1,17 +1,13 @@
package translators
import org.jetbrains.dokka.DokkaConfiguration
+import org.jetbrains.dokka.DokkaConfiguration.Visibility
import org.jetbrains.dokka.base.testApi.testRunner.BaseAbstractTest
import org.jetbrains.dokka.links.DRI
import org.jetbrains.dokka.links.PointingToDeclaration
import org.jetbrains.dokka.model.*
import org.jetbrains.dokka.model.doc.*
-import org.jetbrains.dokka.plugability.DokkaPlugin
-import org.jetbrains.dokka.plugability.DokkaPluginApiPreview
-import org.jetbrains.dokka.plugability.PluginApiPreviewAcknowledgement
-import org.jetbrains.dokka.DokkaConfiguration.Visibility
-import org.junit.jupiter.api.Assertions.*
-import org.junit.jupiter.api.Test
+import kotlin.test.*
import utils.JavaCode
@JavaCode
@@ -303,7 +299,7 @@ class DefaultPsiToDocumentableTranslatorTest : BaseAbstractTest() {
val testedClass = module.packages.single().classlikes.single { it.name == "JavaClassUsingAnnotation" }
val annotation = (testedClass as DClass).extra[Annotations]?.directAnnotations?.values?.single()?.single()
- checkNotNull(annotation)
+ assertNotNull(annotation)
assertEquals("JavaAnnotation", annotation.dri.classNames)
@@ -404,9 +400,7 @@ class DefaultPsiToDocumentableTranslatorTest : BaseAbstractTest() {
val testClass = module.packages.single().classlikes.single { it.name == "A" }
val getterLookalikes = testClass.functions.filter { it.name == "getA" }
- assertEquals(2, getterLookalikes.size) {
- "Not all expected regular functions found, wrongly categorized as getters?"
- }
+ assertEquals(2, getterLookalikes.size, "Not all expected regular functions found, wrongly categorized as getters?")
}
}
}
@@ -444,8 +438,8 @@ class DefaultPsiToDocumentableTranslatorTest : BaseAbstractTest() {
val setter = property.setter
assertNotNull(setter)
- assertEquals(1, setter?.parameters?.size)
- assertEquals(PrimitiveJavaType("int"), setter?.parameters?.get(0)?.type)
+ assertEquals(1, setter.parameters.size)
+ assertEquals(PrimitiveJavaType("int"), setter.parameters[0].type)
val regularSetterFunctions = testClass.functions.filter { it.name == "setA" }
assertEquals(4, regularSetterFunctions.size)
@@ -489,12 +483,14 @@ class DefaultPsiToDocumentableTranslatorTest : BaseAbstractTest() {
assertNotNull(field) {
"Expected the foo property to exist because the field is private with a public getter"
}
- assertNull(requireNotNull(field).setter)
+ assertNull(field.setter)
val setterMethodsWithSubtypeParams = testClass.functions.filter { it.name == "setFoo" }
- assertEquals(2, setterMethodsWithSubtypeParams.size) {
+ assertEquals(
+ 2,
+ setterMethodsWithSubtypeParams.size,
"Expected the setter methods to not qualify as accessors because of subtype parameters"
- }
+ )
}
}
}
@@ -517,9 +513,7 @@ class DefaultPsiToDocumentableTranslatorTest : BaseAbstractTest() {
val tetClass = module.packages.single().classlikes.single { it.name == "A" }
val property = tetClass.properties.firstOrNull { it.name == "a" }
- assertNull(property) {
- "Expected the property to stay private because there are no getters"
- }
+ assertNull(property, "Expected the property to stay private because there are no getters")
val regularSetterFunction = tetClass.functions.firstOrNull { it.name == "setA" }
assertNotNull(regularSetterFunction) {
@@ -757,7 +751,7 @@ class DefaultPsiToDocumentableTranslatorTest : BaseAbstractTest() {
val kotlinEnum = module.packages.find { it.name == "test" }
?.classlikes
?.single { it.name == "JavaEnum" }
- checkNotNull(kotlinEnum)
+ assertNotNull(kotlinEnum)
val valuesFunction = kotlinEnum.functions.single { it.name == "values" }
@@ -826,7 +820,7 @@ class DefaultPsiToDocumentableTranslatorTest : BaseAbstractTest() {
val javaEnum = module.packages.find { it.name == "test" }
?.classlikes
?.single { it.name == "JavaEnum" }
- checkNotNull(javaEnum)
+ assertNotNull(javaEnum)
val valueOfFunction = javaEnum.functions.single { it.name == "valueOf" }