[mpp, tests] Use JUnit5 in kotlin-project-model tests

This commit is contained in:
Dmitry Savvinov
2022-08-10 14:50:14 +02:00
parent c1e21f5b8f
commit afa9c2f8b9
2 changed files with 11 additions and 7 deletions
@@ -13,13 +13,17 @@ standardPublicJars()
dependencies {
implementation(kotlinStdlib())
implementation(project(":kotlin-tooling-core"))
testFixturesImplementation(kotlin("test-junit"))
testApiJUnit5(runner = true)
testFixturesImplementation(project(":kotlin-tooling-core"))
testFixturesImplementation(project(":core:util.runtime"))
testFixturesImplementation(projectTests(":generators:test-generator"))
testFixturesImplementation(project(":kotlin-reflect"))
}
projectTest(jUnitMode = JUnitMode.JUnit5) {
useJUnitPlatform()
}
tasks.withType<KotlinJvmCompile>().configureEach {
kotlinOptions {
languageVersion = "1.4"
@@ -5,10 +5,10 @@
package org.jetbrains.kotlin.project.model
import org.junit.Assume.assumeTrue
import org.junit.Test
import kotlin.test.assertEquals
import kotlin.test.assertTrue
import org.junit.jupiter.api.Assertions.assertEquals
import org.junit.jupiter.api.Assertions.assertTrue
import org.junit.jupiter.api.Assumptions.assumeTrue
import org.junit.jupiter.api.Test
internal class DefaultModuleFragmentsResolverTest {
val bundleFoo = simpleModuleBundle("foo")
@@ -34,7 +34,7 @@ internal class DefaultModuleFragmentsResolverTest {
val result = fragmentResolver.getChosenFragments(consumingFragment, moduleFooMain)
assertTrue(result is KpmFragmentResolution.ChosenFragments)
val expected = expectedVisibleFragments.getValue(consumingFragment.fragmentName)
assertEquals(expected, result.visibleFragments.map { it.fragmentName }.toSet())
assertEquals(expected, (result as KpmFragmentResolution.ChosenFragments).visibleFragments.map { it.fragmentName }.toSet())
}
}
@@ -53,7 +53,7 @@ internal class DefaultModuleFragmentsResolverTest {
val (commonMainResult, jsAndLinuxResult) = listOf("common", "jsAndLinux").map {
val chosenFragments = fragmentResolver.getChosenFragments(dependingModule.fragment(it), moduleFooMain)
assertTrue(chosenFragments is KpmFragmentResolution.ChosenFragments)
chosenFragments.visibleFragments.map { it.fragmentName }.toSet()
(chosenFragments as KpmFragmentResolution.ChosenFragments).visibleFragments.map { it.fragmentName }.toSet()
}
assertEquals(setOf("common", "jvmAndJs"), commonMainResult)