Configure index in @ParameterizedTest display names
This commit prepends "[{index}] " to all custom display names configured via @ParameterizedTest. This provides better diagnostics between the "technical names" reported on the CI server vs. the "display names" reported within a developer's IDE. See gh-23451
This commit is contained in:
parent
b173a93e72
commit
c004ef888c
|
@ -857,7 +857,7 @@ class CronTriggerTests {
|
|||
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target(ElementType.METHOD)
|
||||
@ParameterizedTest(name = "localDateTime [{0}], time zone [{1}]")
|
||||
@ParameterizedTest(name = "[{index}] localDateTime[{0}], time zone[{1}]")
|
||||
@MethodSource("parameters")
|
||||
@interface ParameterizedCronTriggerTest {
|
||||
}
|
||||
|
|
|
@ -143,7 +143,7 @@ public abstract class AbstractDataBufferAllocatingTests {
|
|||
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target(ElementType.METHOD)
|
||||
@ParameterizedTest(name = "{0}")
|
||||
@ParameterizedTest(name = "[{index}] {0}")
|
||||
@MethodSource("org.springframework.core.io.buffer.AbstractDataBufferAllocatingTests#dataBufferFactories()")
|
||||
public @interface ParameterizedDataBufferAllocatingTest {
|
||||
}
|
||||
|
|
|
@ -51,7 +51,7 @@ class GenericXmlContextLoaderResourceLocationsTests {
|
|||
private static final Log logger = LogFactory.getLog(GenericXmlContextLoaderResourceLocationsTests.class);
|
||||
|
||||
|
||||
@ParameterizedTest(name = "{0}")
|
||||
@ParameterizedTest(name = "[{index}] {0}")
|
||||
@MethodSource("contextConfigurationLocationsData")
|
||||
void assertContextConfigurationLocations(String testClassName, String[] expectedLocations) throws Exception {
|
||||
Class<?> testClass = ClassUtils.forName(getClass().getName() + "$" + testClassName, getClass().getClassLoader());
|
||||
|
|
|
@ -118,7 +118,7 @@ public abstract class AbstractHttpHandlerIntegrationTests {
|
|||
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target(ElementType.METHOD)
|
||||
@ParameterizedTest(name = "{0}")
|
||||
@ParameterizedTest(name = "[{index}] {0}")
|
||||
@MethodSource("org.springframework.http.server.reactive.AbstractHttpHandlerIntegrationTests#httpServers()")
|
||||
// public for Kotlin
|
||||
public @interface ParameterizedHttpServerTest {
|
||||
|
|
|
@ -96,7 +96,7 @@ class HeadersAdaptersTests {
|
|||
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target(ElementType.METHOD)
|
||||
@ParameterizedTest(name = "{0}")
|
||||
@ParameterizedTest(name = "[{index}] {0}")
|
||||
@MethodSource("headers")
|
||||
@interface ParameterizedHeadersTest {
|
||||
}
|
||||
|
|
|
@ -57,15 +57,15 @@ class DefaultResponseErrorHandlerHttpStatusTests {
|
|||
private final ClientHttpResponse response = mock(ClientHttpResponse.class);
|
||||
|
||||
|
||||
@ParameterizedTest(name = "error: [{0}], exception: [{1}]")
|
||||
@ParameterizedTest(name = "[{index}] error: [{0}]")
|
||||
@DisplayName("hasError() returns true")
|
||||
@MethodSource("errorCodes")
|
||||
void hasErrorTrue(HttpStatus httpStatus, Class<? extends Throwable> expectedExceptionClass) throws Exception {
|
||||
void hasErrorTrue(HttpStatus httpStatus) throws Exception {
|
||||
given(this.response.getRawStatusCode()).willReturn(httpStatus.value());
|
||||
assertThat(this.handler.hasError(this.response)).isTrue();
|
||||
}
|
||||
|
||||
@ParameterizedTest(name = "error: [{0}], exception: [{1}]")
|
||||
@ParameterizedTest(name = "[{index}] error: [{0}], exception: [{1}]")
|
||||
@DisplayName("handleError() throws an exception")
|
||||
@MethodSource("errorCodes")
|
||||
void handleErrorException(HttpStatus httpStatus, Class<? extends Throwable> expectedExceptionClass) throws Exception {
|
||||
|
@ -75,8 +75,7 @@ class DefaultResponseErrorHandlerHttpStatusTests {
|
|||
given(this.response.getRawStatusCode()).willReturn(httpStatus.value());
|
||||
given(this.response.getHeaders()).willReturn(headers);
|
||||
|
||||
assertThatExceptionOfType(expectedExceptionClass).isThrownBy(() ->
|
||||
this.handler.handleError(this.response));
|
||||
assertThatExceptionOfType(expectedExceptionClass).isThrownBy(() -> this.handler.handleError(this.response));
|
||||
}
|
||||
|
||||
static Object[][] errorCodes() {
|
||||
|
|
|
@ -82,7 +82,7 @@ class RestTemplateIntegrationTests extends AbstractMockWebServerTests {
|
|||
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target(ElementType.METHOD)
|
||||
@ParameterizedTest(name = "{0}")
|
||||
@ParameterizedTest(name = "[{index}] {0}")
|
||||
@MethodSource("clientHttpRequestFactories")
|
||||
@interface ParameterizedRestTemplateTest {
|
||||
}
|
||||
|
|
|
@ -348,7 +348,7 @@ class ServletWebRequestHttpMethodsTests {
|
|||
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target(ElementType.METHOD)
|
||||
@ParameterizedTest(name = "{0}")
|
||||
@ParameterizedTest(name = "[{index}] {0}")
|
||||
@ValueSource(strings = { "GET", "HEAD" })
|
||||
@interface ParameterizedHttpMethodTest {
|
||||
}
|
||||
|
|
|
@ -73,7 +73,7 @@ class WebClientIntegrationTests {
|
|||
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target(ElementType.METHOD)
|
||||
@ParameterizedTest(name = "webClient [{0}]")
|
||||
@ParameterizedTest(name = "[{index}] webClient [{0}]")
|
||||
@MethodSource("arguments")
|
||||
@interface ParameterizedWebClientTest {
|
||||
}
|
||||
|
|
|
@ -65,7 +65,7 @@ class SseIntegrationTests extends AbstractHttpHandlerIntegrationTests {
|
|||
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target(ElementType.METHOD)
|
||||
@ParameterizedTest(name = "server [{0}] webClient [{1}]")
|
||||
@ParameterizedTest(name = "[{index}] server [{0}], webClient [{1}]")
|
||||
@MethodSource("arguments")
|
||||
protected @interface ParameterizedSseTest {
|
||||
}
|
||||
|
|
|
@ -80,7 +80,7 @@ abstract class AbstractWebSocketIntegrationTests {
|
|||
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target(ElementType.METHOD)
|
||||
@ParameterizedTest(name = "client[{0}] - server [{1}]")
|
||||
@ParameterizedTest(name = "[{index}] client[{0}], server[{1}]")
|
||||
@MethodSource("arguments")
|
||||
@interface ParameterizedWebSocketTest {
|
||||
}
|
||||
|
|
|
@ -116,7 +116,7 @@ class HandlerMethodAnnotationDetectionTests {
|
|||
}
|
||||
|
||||
|
||||
@ParameterizedTest(name = "controller [{0}], auto-proxy [{1}]")
|
||||
@ParameterizedTest(name = "[{index}] controller [{0}], auto-proxy [{1}]")
|
||||
@MethodSource("handlerTypes")
|
||||
void testRequestMappingMethod(Class<?> controllerType, boolean useAutoProxy) throws Exception {
|
||||
setUp(controllerType, useAutoProxy);
|
||||
|
|
|
@ -74,7 +74,7 @@ public abstract class AbstractWebSocketIntegrationTests {
|
|||
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target(ElementType.METHOD)
|
||||
@ParameterizedTest(name = "server [{0}], client [{1}]")
|
||||
@ParameterizedTest(name = "[{index}] server [{0}], client [{1}]")
|
||||
@MethodSource("argumentsFactory")
|
||||
protected @interface ParameterizedWebSocketTest {
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue