aboutsummaryrefslogtreecommitdiff
path: root/core/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'core/src/test')
-rw-r--r--core/src/test/kotlin/utilities/DokkaConfigurationJsonTest.kt68
1 files changed, 68 insertions, 0 deletions
diff --git a/core/src/test/kotlin/utilities/DokkaConfigurationJsonTest.kt b/core/src/test/kotlin/utilities/DokkaConfigurationJsonTest.kt
new file mode 100644
index 00000000..d0cb55a1
--- /dev/null
+++ b/core/src/test/kotlin/utilities/DokkaConfigurationJsonTest.kt
@@ -0,0 +1,68 @@
+package utilities
+
+import org.jetbrains.dokka.*
+import java.io.File
+import kotlin.test.Test
+import kotlin.test.assertEquals
+
+class DokkaConfigurationJsonTest {
+ @Test
+ fun `simple configuration toJsonString then parseJson`() {
+ val configuration = DokkaConfigurationImpl(
+ outputDir = "customOutputDir",
+ pluginsClasspath = listOf(File("plugins/customPlugin.jar")),
+ sourceSets = listOf(
+ DokkaSourceSetImpl(
+ moduleDisplayName = "customModuleDisplayName",
+ sourceRoots = listOf(SourceRootImpl("customSourceRoot")),
+ sourceSetID = DokkaSourceSetID("customModuleName", "customSourceSetName")
+ )
+ )
+ )
+
+ val jsonString = configuration.toJsonString()
+ val parsedConfiguration = DokkaConfigurationImpl(jsonString)
+ assertEquals(configuration, parsedConfiguration)
+ }
+
+ @Test
+ fun `parse simple configuration json`() {
+ val json = """
+ {
+ "outputDir": "customOutputDir",
+ "pluginsClasspath": [ "plugins/customPlugin.jar" ],
+ "sourceSets": [
+ {
+ "moduleDisplayName": "customModuleDisplayName",
+ "sourceSetID": {
+ "moduleName": "customModuleName",
+ "sourceSetName": "customSourceSetName"
+ },
+ "classpath": [],
+ "sourceRoots": [
+ {
+ "path": "customSourceRoot"
+ }
+ ]
+ }
+ ]
+ }
+ """.trimIndent()
+
+ val parsedConfiguration = DokkaConfigurationImpl(json)
+ assertEquals(
+ DokkaConfigurationImpl(
+ outputDir = "customOutputDir",
+ pluginsClasspath = listOf(File("plugins/customPlugin.jar")),
+ sourceSets = listOf(
+ DokkaSourceSetImpl(
+ moduleDisplayName = "customModuleDisplayName",
+ sourceRoots = listOf(SourceRootImpl("customSourceRoot")),
+ sourceSetID = DokkaSourceSetID("customModuleName", "customSourceSetName")
+ )
+ )
+ ),
+ parsedConfiguration
+ )
+ }
+}