/
CliTest.kt
30 lines (22 loc) · 1.13 KB
/
CliTest.kt
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
package org.jetbrains.dokka
import junit.framework.Assert.assertTrue
import org.junit.Test
import java.lang.IllegalStateException
import java.nio.file.Paths
import kotlin.test.assertEquals
class CliIntegrationTest {
@Test
fun `should apply global settings to all source sets`() {
val jsonPath = Paths.get(javaClass.getResource("/my-file.json")?.toURI() ?: throw IllegalStateException("No JSON found!")).toFile().toString()
val globalArguments = GlobalArguments(arrayOf(jsonPath))
val configuration = initializeConfiguration(globalArguments)
configuration.sourceSets.forEach {
assertTrue(it.perPackageOptions.isNotEmpty())
assertTrue(it.sourceLinks.isNotEmpty())
assertTrue(it.externalDocumentationLinks.isNotEmpty())
assertTrue(it.externalDocumentationLinks.any { it.url.toString() == "https://docs.oracle.com/javase/8/docs/api/" })
assertEquals(it.sourceLinks.single().localDirectory, "/home/Vadim.Mishenev/dokka/examples/cli/src/main/kotlin")
assertEquals(it.perPackageOptions.single().matchingRegex, "my-custom-regex")
}
}
}