|
| 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 | +} |
0 commit comments