Skip to content

Commit 195f7cd

Browse files
committed
Move Kotlin method name test to appropriate class
1 parent 15b678f commit 195f7cd

File tree

2 files changed

+43
-14
lines changed

2 files changed

+43
-14
lines changed
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
/*
2+
* Copyright 2015-2017 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+
* http://www.eclipse.org/legal/epl-v20.html
9+
*/
10+
11+
package org.junit.jupiter.engine;
12+
13+
import static org.assertj.core.api.Assertions.assertThat;
14+
import static org.junit.jupiter.api.Assertions.assertAll;
15+
import static org.junit.jupiter.api.Assertions.assertEquals;
16+
17+
import org.junit.jupiter.api.Test;
18+
import org.junit.jupiter.engine.kotlin.ArbitraryNamingKotlinTestCase;
19+
import org.junit.platform.engine.TestDescriptor;
20+
import org.junit.platform.engine.test.event.ExecutionEventRecorder;
21+
22+
/**
23+
* Integration tests for JVM languages that allow special characters
24+
* in method names (e.g., Kotlin, Groovy, etc.) which are forbidden in
25+
* Java source code.
26+
*
27+
* @since 5.1
28+
*/
29+
class AtypicalJvmMethodNameTests extends AbstractJupiterTestEngineTests {
30+
31+
@Test
32+
void kotlinTestWithMethodNameContainingSpecialCharacters() {
33+
ExecutionEventRecorder eventRecorder = executeTestsForClass(ArbitraryNamingKotlinTestCase.class);
34+
assertThat(eventRecorder.getTestFinishedCount()).isEqualTo(1);
35+
36+
TestDescriptor testDescriptor = eventRecorder.getSuccessfulTestFinishedEvents().get(0).getTestDescriptor();
37+
assertAll(//
38+
() -> assertEquals(ArbitraryNamingKotlinTestCase.METHOD_NAME + "()", testDescriptor.getDisplayName()), //
39+
() -> assertEquals(ArbitraryNamingKotlinTestCase.METHOD_NAME + "()",
40+
testDescriptor.getLegacyReportingName()));
41+
}
42+
43+
}

junit-jupiter-engine/src/test/java/org/junit/jupiter/engine/TestInstanceLifecycleTests.java

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,9 @@
5454
import org.junit.jupiter.api.extension.TestInstancePostProcessor;
5555
import org.junit.jupiter.api.extension.TestTemplateInvocationContext;
5656
import org.junit.jupiter.api.extension.TestTemplateInvocationContextProvider;
57-
import org.junit.jupiter.engine.kotlin.ArbitraryNamingKotlinTestCase;
5857
import org.junit.jupiter.engine.kotlin.InstancePerClassKotlinTestCase;
5958
import org.junit.jupiter.engine.kotlin.InstancePerMethodKotlinTestCase;
6059
import org.junit.platform.commons.util.ReflectionUtils;
61-
import org.junit.platform.engine.TestDescriptor;
6260
import org.junit.platform.engine.test.event.ExecutionEventRecorder;
6361

6462
/**
@@ -554,18 +552,6 @@ void instancePerMethodIsDefaultForKotlinTestClasses() {
554552
.containsEntry("afterEach", 1);
555553
}
556554

557-
@Test
558-
void kotlinTestWithMethodNameContainingSpecialCharacters() {
559-
ExecutionEventRecorder eventRecorder = executeTestsForClass(ArbitraryNamingKotlinTestCase.class);
560-
assertThat(eventRecorder.getTestFinishedCount()).isEqualTo(1);
561-
562-
TestDescriptor testDescriptor = eventRecorder.getSuccessfulTestFinishedEvents().get(0).getTestDescriptor();
563-
assertAll(//
564-
() -> assertEquals(ArbitraryNamingKotlinTestCase.METHOD_NAME + "()", testDescriptor.getDisplayName()), //
565-
() -> assertEquals(ArbitraryNamingKotlinTestCase.METHOD_NAME + "()",
566-
testDescriptor.getLegacyReportingName()));
567-
}
568-
569555
private void performAssertions(Class<?> testClass, int containers, int tests,
570556
Map.Entry<Class<?>, Integer>[] instanceCountEntries, int allMethods, int eachMethods) {
571557

0 commit comments

Comments
 (0)