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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
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(
moduleName = "moduleName",
outputDir = File("customOutputDir"),
pluginsClasspath = listOf(File("plugins/customPlugin.jar")),
sourceSets = listOf(
DokkaSourceSetImpl(
sourceRoots = setOf(File("customSourceRoot")),
sourceSetID = DokkaSourceSetID("customModuleName", "customSourceSetName")
)
)
)
val jsonString = configuration.toJsonString()
val parsedConfiguration = DokkaConfigurationImpl(jsonString)
assertEquals(configuration, parsedConfiguration)
}
@Test
fun `parse simple configuration json`() {
val json = """
{
"moduleName": "moduleName",
"outputDir": "customOutputDir",
"pluginsClasspath": [ "plugins/customPlugin.jar" ],
"sourceSets": [
{
"sourceSetID": {
"scopeId": "customModuleName",
"sourceSetName": "customSourceSetName"
},
"sourceRoots": [ "customSourceRoot" ],
"classpath": [ "classpath/custom1.jar", "classpath/custom2.jar" ]
}
]
}
""".trimIndent()
val parsedConfiguration = DokkaConfigurationImpl(json)
assertEquals(
DokkaConfigurationImpl(
moduleName = "moduleName",
outputDir = File("customOutputDir"),
pluginsClasspath = listOf(File("plugins/customPlugin.jar")),
sourceSets = listOf(
DokkaSourceSetImpl(
sourceRoots = setOf(File("customSourceRoot")),
sourceSetID = DokkaSourceSetID("customModuleName", "customSourceSetName"),
classpath = listOf(File("classpath/custom1.jar"), File("classpath/custom2.jar"))
)
)
),
parsedConfiguration
)
}
}
|