Skip to content

Commit 2e27ea7

Browse files
committed
Avoid reference from Java to Kotlin code
1 parent cc6b6b8 commit 2e27ea7

File tree

3 files changed

+61
-40
lines changed

3 files changed

+61
-40
lines changed

jupiter-tests/src/test/java/org/junit/jupiter/params/ParameterizedClassIntegrationTests.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -94,11 +94,11 @@ public class ParameterizedClassIntegrationTests extends AbstractJupiterTestEngin
9494

9595
@ParameterizedTest
9696
@ValueSource(classes = { ConstructorInjectionTestCase.class, RecordTestCase.class,
97-
RecordWithParameterAnnotationOnComponentTestCase.class, ParameterizedDataClassTestCase.class,
98-
FieldInjectionTestCase.class, RecordWithBuiltInConverterTestCase.class,
99-
RecordWithRegisteredConversionTestCase.class, FieldInjectionWithRegisteredConversionTestCase.class,
100-
RecordWithBuiltInAggregatorTestCase.class, FieldInjectionWithBuiltInAggregatorTestCase.class,
101-
RecordWithCustomAggregatorTestCase.class, FieldInjectionWithCustomAggregatorTestCase.class })
97+
RecordWithParameterAnnotationOnComponentTestCase.class, FieldInjectionTestCase.class,
98+
RecordWithBuiltInConverterTestCase.class, RecordWithRegisteredConversionTestCase.class,
99+
FieldInjectionWithRegisteredConversionTestCase.class, RecordWithBuiltInAggregatorTestCase.class,
100+
FieldInjectionWithBuiltInAggregatorTestCase.class, RecordWithCustomAggregatorTestCase.class,
101+
FieldInjectionWithCustomAggregatorTestCase.class })
102102
void injectsParametersIntoContainerTemplate(Class<?> containerTemplateClass) {
103103

104104
var results = executeTestsForClass(containerTemplateClass);
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
/*
2+
* Copyright 2015-2025 the original author or authors.
3+
*
4+
* All rights reserved. This program and the accompanying materials are
5+
* made available under the terms of the Eclipse Public License v2.0 which
6+
* accompanies this distribution and is available at
7+
*
8+
* https://www.eclipse.org/legal/epl-v20.html
9+
*/
10+
package org.junit.jupiter.params
11+
12+
import org.junit.jupiter.api.Assertions.assertEquals
13+
import org.junit.jupiter.api.Assertions.assertTrue
14+
import org.junit.jupiter.api.Test
15+
import org.junit.jupiter.api.TestInfo
16+
import org.junit.jupiter.params.provider.ValueSource
17+
import org.junit.platform.engine.discovery.DiscoverySelectors.selectClass
18+
import org.junit.platform.testkit.engine.EngineTestKit
19+
20+
class ParameterizedClassKotlinIntegrationTests {
21+
@Test
22+
fun supportsDataClasses() {
23+
val results =
24+
EngineTestKit
25+
.engine("junit-jupiter")
26+
.selectors(selectClass(TestCase::class.java))
27+
.execute()
28+
29+
results.containerEvents().assertStatistics {
30+
it.started(4).succeeded(4)
31+
}
32+
results.testEvents().assertStatistics {
33+
it.started(4).succeeded(2).failed(2)
34+
}
35+
}
36+
37+
@Suppress("JUnitMalformedDeclaration")
38+
@ParameterizedClass
39+
@ValueSource(ints = [-1, 1])
40+
data class TestCase(
41+
val value: Int,
42+
val testInfo: TestInfo
43+
) {
44+
@Test
45+
fun test1() {
46+
assertEquals("test1()", testInfo.displayName)
47+
assertTrue(value < 0, "negative")
48+
}
49+
50+
@Test
51+
fun test2() {
52+
assertEquals("test2()", testInfo.displayName)
53+
assertTrue(value < 0, "negative")
54+
}
55+
}
56+
}

jupiter-tests/src/test/kotlin/org/junit/jupiter/params/ParameterizedDataClassTestCase.kt

Lines changed: 0 additions & 35 deletions
This file was deleted.

0 commit comments

Comments
 (0)