Skip to content

Commit 6ab959d

Browse files
committed
Fix build: parametrized tests for JUnit5
1 parent 85642f5 commit 6ab959d

File tree

3 files changed

+12
-11
lines changed

3 files changed

+12
-11
lines changed

dataframe-json/build.gradle.kts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,10 @@ dependencies {
2626
implementation(libs.serialization.json)
2727
implementation(libs.sl4j)
2828

29-
testImplementation(kotlin("test"))
30-
testImplementation(libs.junit)
29+
testImplementation(libs.kotlin.test)
30+
testImplementation(libs.junit.jupiter)
31+
testImplementation(libs.junit.jupiter.engine)
32+
testImplementation(libs.junit.jupiter.params)
3133
testImplementation(libs.kotestAssertions) {
3234
exclude("org.jetbrains.kotlin", "kotlin-stdlib-jdk8")
3335
}

dataframe-json/src/test/kotlin/org/jetbrains/kotlinx/dataframe/io/ImageSerializationTests.kt

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ import org.jetbrains.kotlinx.dataframe.impl.io.resizeKeepingAspectRatio
1313
import org.jetbrains.kotlinx.dataframe.io.Base64ImageEncodingOptions.Companion.ALL_OFF
1414
import org.jetbrains.kotlinx.dataframe.io.Base64ImageEncodingOptions.Companion.GZIP_ON
1515
import org.jetbrains.kotlinx.dataframe.io.Base64ImageEncodingOptions.Companion.LIMIT_SIZE_ON
16-
import org.junit.runner.RunWith
17-
import org.junit.runners.Parameterized
16+
import org.junit.jupiter.params.ParameterizedTest
17+
import org.junit.jupiter.params.provider.MethodSource
1818
import java.awt.image.BufferedImage
1919
import java.io.ByteArrayInputStream
2020
import java.io.ByteArrayOutputStream
@@ -23,12 +23,11 @@ import java.util.Base64
2323
import java.util.zip.GZIPInputStream
2424
import javax.imageio.ImageIO
2525
import kotlin.math.abs
26-
import kotlin.test.Test
2726

28-
@RunWith(Parameterized::class)
29-
class ImageSerializationTests(private val encodingOptions: Base64ImageEncodingOptions?) {
30-
@Test
31-
fun `serialize images as base64`() {
27+
class ImageSerializationTests {
28+
@ParameterizedTest
29+
@MethodSource("imageEncodingOptionsToTest")
30+
fun `serialize images as base64`(encodingOptions: Base64ImageEncodingOptions?) {
3231
val images = readImagesFromResources()
3332
val json = encodeImagesAsJson(images, encodingOptions)
3433

@@ -166,8 +165,7 @@ class ImageSerializationTests(private val encodingOptions: Base64ImageEncodingOp
166165
private val DISABLED = null
167166

168167
@JvmStatic
169-
@Parameterized.Parameters
170-
fun imageEncodingOptionsToTest(): Collection<Base64ImageEncodingOptions?> =
168+
fun imageEncodingOptionsToTest(): List<Base64ImageEncodingOptions?> =
171169
listOf(
172170
DEFAULT,
173171
GZIP_ON_RESIZE_OFF,

gradle/libs.versions.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ junit = { group = "junit", name = "junit", version.ref = "junit" }
9595
junit-bom = { group = "org.junit", name = "junit-bom", version.ref = "junit-jupiter" }
9696
junit-jupiter = { group = "org.junit.jupiter", name = "junit-jupiter", version.ref = "junit-jupiter" }
9797
junit-jupiter-engine = { group = "org.junit.jupiter", name = "junit-jupiter-engine", version.ref = "junit-jupiter" }
98+
junit-jupiter-params = { group = "org.junit.jupiter", name = "junit-jupiter-params", version.ref = "junit-jupiter" }
9899
junit-platform-commons = { group = "org.junit.platform", name = "junit-platform-commons", version.ref = "junit-platform" }
99100
junit-platform-launcher = { group = "org.junit.platform", name = "junit-platform-launcher", version.ref = "junit-platform" }
100101
junit-platform-runner = { group = "org.junit.platform", name = "junit-platform-runner", version.ref = "junit-platform" }

0 commit comments

Comments
 (0)