From f486bfbd93d7c0c09120d23197d1512d4a55807b Mon Sep 17 00:00:00 2001 From: Cedric Beust Date: Tue, 21 Mar 2017 16:49:26 -0700 Subject: [PATCH] Refactor. --- .../com/beust/kobalt/internal/TestNgRunner.kt | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/internal/TestNgRunner.kt b/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/internal/TestNgRunner.kt index 5f288204..19612c1c 100644 --- a/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/internal/TestNgRunner.kt +++ b/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/internal/TestNgRunner.kt @@ -69,8 +69,10 @@ class TestNgRunner : GenericTestRunner() { val testngDependencyVersion = Versions.toLongVersion(testngDependency) val result = if (testngDependencyVersion >= VERSION_6_10) { + context.logger.log(project.name, 1, "Modern TestNG, displaying colors") displayPrettyColors(project, context, classpath) } else { + context.logger.log(project.name, 1, "Older TestNG ($testngDependencyVersion), using the old runner") super.runTests(project, context, classpath, configName) } return result @@ -80,13 +82,15 @@ class TestNgRunner : GenericTestRunner() { : Boolean { val port = 2345 - val jf = context.dependencyManager.create("org.testng.testng-remote:testng-remote:1.3.0") - val tr = context.dependencyManager.create("org.testng.testng-remote:testng-remote6_10:1.3.0") - val testng = context.dependencyManager.create("org.testng:testng:6.10") - val dep1 = context.dependencyManager.transitiveClosure(listOf(jf, tr, testng)) + val dep = with(context.dependencyManager) { + val jf = create("org.testng.testng-remote:testng-remote:1.3.0") + val tr = create("org.testng.testng-remote:testng-remote6_10:1.3.0") + val testng = create("org.testng:testng:6.10") + transitiveClosure(listOf(jf, tr, testng)) + } val v = Versions.toLongVersion("6.10") - val cp = (classpath + dep1).map { it.jarFile.get() } + val cp = (classpath + dep).map { it.jarFile.get() } .joinToString(File.pathSeparator) val passedArgs = listOf( "-classpath",