From b78ff1d61a4c6b1ee9f10c36ed45306e944706a9 Mon Sep 17 00:00:00 2001 From: Dmitriy Dolovov Date: Mon, 6 Dec 2021 18:31:45 +0300 Subject: [PATCH] [Native][tests] Minor. Organize imports --- .../support/runner/LocalTestNameExtractor.kt | 4 ++-- .../support/settings/GlobalSettings.kt | 14 +++++++------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/native/native.tests/tests/org/jetbrains/kotlin/konan/blackboxtest/support/runner/LocalTestNameExtractor.kt b/native/native.tests/tests/org/jetbrains/kotlin/konan/blackboxtest/support/runner/LocalTestNameExtractor.kt index c9b3785c018..7f2f5be9e5a 100644 --- a/native/native.tests/tests/org/jetbrains/kotlin/konan/blackboxtest/support/runner/LocalTestNameExtractor.kt +++ b/native/native.tests/tests/org/jetbrains/kotlin/konan/blackboxtest/support/runner/LocalTestNameExtractor.kt @@ -10,7 +10,7 @@ import org.jetbrains.kotlin.konan.blackboxtest.support.TestExecutable import org.jetbrains.kotlin.konan.blackboxtest.support.TestName import org.jetbrains.kotlin.konan.blackboxtest.support.util.TestOutputFilter import org.jetbrains.kotlin.konan.blackboxtest.support.util.parseGTestListing -import org.jetbrains.kotlin.test.services.JUnit5Assertions +import org.jetbrains.kotlin.test.services.JUnit5Assertions.fail import kotlin.time.Duration internal class LocalTestNameExtractor( @@ -30,7 +30,7 @@ internal class LocalTestNameExtractor( override fun buildResultHandler(runResult: RunResult.Completed) = ResultHandler(runResult) - override fun handleUnexpectedFailure(t: Throwable) = JUnit5Assertions.fail { + override fun handleUnexpectedFailure(t: Throwable) = fail { LoggedData.TestRunUnexpectedFailure(getLoggedParameters(), t) .withErrorMessage("Test name extraction failed with unexpected exception.") } diff --git a/native/native.tests/tests/org/jetbrains/kotlin/konan/blackboxtest/support/settings/GlobalSettings.kt b/native/native.tests/tests/org/jetbrains/kotlin/konan/blackboxtest/support/settings/GlobalSettings.kt index be9744d008d..2dfa5814293 100644 --- a/native/native.tests/tests/org/jetbrains/kotlin/konan/blackboxtest/support/settings/GlobalSettings.kt +++ b/native/native.tests/tests/org/jetbrains/kotlin/konan/blackboxtest/support/settings/GlobalSettings.kt @@ -7,7 +7,7 @@ package org.jetbrains.kotlin.konan.blackboxtest.support.settings import org.jetbrains.kotlin.konan.target.HostManager import org.jetbrains.kotlin.konan.target.KonanTarget -import org.jetbrains.kotlin.test.services.JUnit5Assertions +import org.jetbrains.kotlin.test.services.JUnit5Assertions.fail import java.io.File import java.net.URLClassLoader import kotlin.time.Duration @@ -30,7 +30,7 @@ internal class GlobalSettings( companion object { private val defaultKotlinNativeHome: File - get() = System.getProperty(KOTLIN_NATIVE_HOME)?.let(::File) ?: JUnit5Assertions.fail { "Non-specified $KOTLIN_NATIVE_HOME system property" } + get() = System.getProperty(KOTLIN_NATIVE_HOME)?.let(::File) ?: fail { "Non-specified $KOTLIN_NATIVE_HOME system property" } // Use isolated cached class loader. private val defaultKotlinNativeClassLoader: Lazy = lazy { @@ -38,7 +38,7 @@ internal class GlobalSettings( ?.split(':', ';') ?.map { File(it).toURI().toURL() } ?.toTypedArray() - ?: JUnit5Assertions.fail { "Non-specified $COMPILER_CLASSPATH system property" } + ?: fail { "Non-specified $COMPILER_CLASSPATH system property" } URLClassLoader(nativeClassPath, /* no parent class loader */ null).apply { setDefaultAssertionStatus(true) } } @@ -46,7 +46,7 @@ internal class GlobalSettings( private val defaultTestMode: TestMode = run { val testModeName = System.getProperty(TEST_MODE) ?: return@run TestMode.WITH_MODULES - TestMode.values().firstOrNull { it.name == testModeName } ?: JUnit5Assertions.fail { + TestMode.values().firstOrNull { it.name == testModeName } ?: fail { buildString { appendLine("Unknown test mode name $testModeName.") appendLine("One of the following test modes should be passed through $TEST_MODE system property:") @@ -60,7 +60,7 @@ internal class GlobalSettings( private val defaultCacheSettings: CacheSettings = run { val useCacheValue = System.getProperty(USE_CACHE) val useCache = if (useCacheValue != null) { - useCacheValue.toBooleanStrictOrNull() ?: JUnit5Assertions.fail { "Invalid value for $USE_CACHE system property: $useCacheValue" } + useCacheValue.toBooleanStrictOrNull() ?: fail { "Invalid value for $USE_CACHE system property: $useCacheValue" } } else true @@ -71,13 +71,13 @@ internal class GlobalSettings( val executionTimeoutValue = System.getProperty(EXECUTION_TIMEOUT) if (executionTimeoutValue != null) { executionTimeoutValue.toLongOrNull()?.milliseconds - ?: JUnit5Assertions.fail { "Invalid value for $EXECUTION_TIMEOUT system property: $executionTimeoutValue" } + ?: fail { "Invalid value for $EXECUTION_TIMEOUT system property: $executionTimeoutValue" } } else DEFAULT_EXECUTION_TIMEOUT } private val projectBuildDir: File - get() = System.getenv(PROJECT_BUILD_DIR)?.let(::File) ?: JUnit5Assertions.fail { "Non-specified $PROJECT_BUILD_DIR environment variable" } + get() = System.getenv(PROJECT_BUILD_DIR)?.let(::File) ?: fail { "Non-specified $PROJECT_BUILD_DIR environment variable" } private const val KOTLIN_NATIVE_HOME = "kotlin.internal.native.test.nativeHome" private const val COMPILER_CLASSPATH = "kotlin.internal.native.test.compilerClasspath"