aboutsummaryrefslogtreecommitdiff
path: root/core/src/test/kotlin/utilities
diff options
context:
space:
mode:
authorsebastian.sellmair <sebastian.sellmair@jetbrains.com>2020-07-16 10:24:02 +0200
committerSebastian Sellmair <34319766+sellmair@users.noreply.github.com>2020-07-20 12:02:45 +0200
commit13edb873db122e2088207ca10b94382e30875636 (patch)
tree44b90392faac5069848b27f6c5084dbca61607fe /core/src/test/kotlin/utilities
parente7b50c6ba2102fc9a59a460172aa7a4d82ad08df (diff)
downloaddokka-13edb873db122e2088207ca10b94382e30875636.tar.gz
dokka-13edb873db122e2088207ca10b94382e30875636.tar.bz2
dokka-13edb873db122e2088207ca10b94382e30875636.zip
Use jackson for json serialization and parsing
Diffstat (limited to 'core/src/test/kotlin/utilities')
-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
+ )
+ }
+}