From 84ea5c68420a75c7b8401000dbe6dbf3ff2cd6d0 Mon Sep 17 00:00:00 2001
From: Dmitry Jemerov <yole@jetbrains.com>
Date: Wed, 4 Nov 2015 16:26:07 +0100
Subject: @Inject all the things

---
 test/src/TestAPI.kt                | 15 ++++++++-------
 test/src/format/PackageDocsTest.kt |  4 ++--
 test/src/model/KotlinAsJavaTest.kt |  3 +--
 3 files changed, 11 insertions(+), 11 deletions(-)

(limited to 'test/src')

diff --git a/test/src/TestAPI.kt b/test/src/TestAPI.kt
index e65164fe..79b5ba77 100644
--- a/test/src/TestAPI.kt
+++ b/test/src/TestAPI.kt
@@ -1,9 +1,11 @@
 package org.jetbrains.dokka.tests
 
+import com.google.inject.Guice
 import com.intellij.openapi.application.PathManager
 import com.intellij.openapi.util.Disposer
 import com.intellij.openapi.util.io.FileUtil
 import org.jetbrains.dokka.*
+import org.jetbrains.dokka.Utilities.DokkaModule
 import org.jetbrains.kotlin.cli.common.messages.CompilerMessageLocation
 import org.jetbrains.kotlin.cli.common.messages.CompilerMessageSeverity
 import org.jetbrains.kotlin.cli.common.messages.MessageCollector
@@ -17,7 +19,7 @@ import kotlin.test.fail
 public fun verifyModel(vararg roots: ContentRoot,
                        withJdk: Boolean = false,
                        withKotlinRuntime: Boolean = false,
-                       packageDocumentationBuilder: PackageDocumentationBuilder? = null,
+                       format: String = "html",
                        verifier: (DocumentationModule) -> Unit) {
     val messageCollector = object : MessageCollector {
         override fun report(severity: CompilerMessageSeverity, message: String, location: CompilerMessageLocation) {
@@ -48,10 +50,9 @@ public fun verifyModel(vararg roots: ContentRoot,
         }
         addRoots(roots.toList())
     }
-    val options = DocumentationOptions(includeNonPublic = true, skipEmptyPackages = false, sourceLinks = listOf<SourceLinkDefinition>())
-    val documentation = buildDocumentationModule(environment, "test", options,
-            packageDocumentationBuilder = packageDocumentationBuilder,
-            logger = DokkaConsoleLogger)
+    val options = DocumentationOptions("", format, includeNonPublic = true, skipEmptyPackages = false, sourceLinks = listOf<SourceLinkDefinition>())
+    val injector = Guice.createInjector(DokkaModule(environment, options, DokkaConsoleLogger))
+    val documentation = buildDocumentationModule(injector, "test")
     verifier(documentation)
     Disposer.dispose(environment)
 }
@@ -59,12 +60,12 @@ public fun verifyModel(vararg roots: ContentRoot,
 public fun verifyModel(source: String,
                        withJdk: Boolean = false,
                        withKotlinRuntime: Boolean = false,
-                       packageDocumentationBuilder: PackageDocumentationBuilder? = null,
+                       format: String = "html",
                        verifier: (DocumentationModule) -> Unit) {
     verifyModel(contentRootFromPath(source),
             withJdk = withJdk,
             withKotlinRuntime = withKotlinRuntime,
-            packageDocumentationBuilder = packageDocumentationBuilder,
+            format = format,
             verifier = verifier)
 }
 
diff --git a/test/src/format/PackageDocsTest.kt b/test/src/format/PackageDocsTest.kt
index 6815de6f..57a08563 100644
--- a/test/src/format/PackageDocsTest.kt
+++ b/test/src/format/PackageDocsTest.kt
@@ -9,8 +9,8 @@ import kotlin.test.assertEquals
 
 public class PackageDocsTest {
     @Test fun verifyParse() {
-        val docs = PackageDocs(null, null, DokkaConsoleLogger)
-        docs.parse("test/data/packagedocs/stdlib.md")
+        val docs = PackageDocs(null, DokkaConsoleLogger)
+        docs.parse("test/data/packagedocs/stdlib.md", null)
         val packageContent = docs.packageContent["kotlin"]!!
         val block = (packageContent.children.single() as ContentBlock).children.first() as ContentText
         assertEquals("Core functions and types", block.text)
diff --git a/test/src/model/KotlinAsJavaTest.kt b/test/src/model/KotlinAsJavaTest.kt
index 90ea13c8..18a1cfef 100644
--- a/test/src/model/KotlinAsJavaTest.kt
+++ b/test/src/model/KotlinAsJavaTest.kt
@@ -2,7 +2,6 @@ package org.jetbrains.dokka.tests
 
 import org.jetbrains.dokka.DocumentationModule
 import org.jetbrains.dokka.DocumentationNode
-import org.jetbrains.dokka.KotlinAsJavaDocumentationBuilder
 import org.junit.Test
 import kotlin.test.assertEquals
 
@@ -36,6 +35,6 @@ fun verifyModelAsJava(source: String,
                       verifier: (DocumentationModule) -> Unit) {
     verifyModel(source,
             withJdk = withJdk, withKotlinRuntime = withKotlinRuntime,
-            packageDocumentationBuilder = KotlinAsJavaDocumentationBuilder(),
+            format = "html-as-java",
             verifier = verifier)
 }
-- 
cgit