From f7dd354b27c26c4aad817f1ff88da61110414efe Mon Sep 17 00:00:00 2001 From: Cedric Beust Date: Fri, 17 Feb 2017 10:38:25 -0800 Subject: [PATCH] Better ProfileTest. --- .../com/beust/kobalt/internal/ProfileTest.kt | 22 ++++++++----------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/src/test/kotlin/com/beust/kobalt/internal/ProfileTest.kt b/src/test/kotlin/com/beust/kobalt/internal/ProfileTest.kt index b77eb3c0..1ebbd54e 100644 --- a/src/test/kotlin/com/beust/kobalt/internal/ProfileTest.kt +++ b/src/test/kotlin/com/beust/kobalt/internal/ProfileTest.kt @@ -8,6 +8,7 @@ import com.beust.kobalt.api.Project import com.beust.kobalt.app.BuildFileCompiler import com.google.inject.Inject import org.assertj.core.api.Assertions.assertThat +import org.testng.annotations.DataProvider import org.testng.annotations.Guice import org.testng.annotations.Test @@ -26,24 +27,19 @@ class ProfileTest @Inject constructor(val compilerFactory: BuildFileCompiler.IFa val args = Args() if (enabled) args.profiles = "profile" -// val jvmCompilerPlugin = Kobalt.findPlugin("JvmCompiler") as JvmCompilerPlugin -// val pluginInfo = PluginInfo(KobaltPluginXml(), null, null).apply { -// projectContributors.add(jvmCompilerPlugin) -// } -// val projects = buildScriptUtil.runBuildScriptJarFile() val compileResult = compileBuildFile(buildFileString, args, compilerFactory) return compileResult.projects[0] } - @Test - fun profilesShouldWork() { + @DataProvider + fun dp() = arrayOf( + arrayOf(false, "profileOff"), + arrayOf(true, "profileOn")) + + @Test(dataProvider = "dp") + fun profilesShouldWork(enabled: Boolean, expected: String) { Kobalt.init(TestModule()) - assertThat(runTestWithProfile(true).name).isEqualTo("profileOn") -// Kobalt.INJECTOR.getInstance(Plugins::class.java).shutdownPlugins() -// Kobalt.init(TestModule()) -// val success = File(KFiles.KOBALT_DOT_DIR).deleteRecursively() -// println("DELETING " + File(KFiles.KOBALT_DOT_DIR).absolutePath + ": $success") -// assertThat(runTestWithProfile(false).name).isEqualTo("profileOff") + assertThat(runTestWithProfile(enabled).name).isEqualTo(expected) } }