diff --git a/spring-test/src/main/java/org/springframework/mock/http/server/reactive/MockServerHttpRequest.java b/spring-test/src/main/java/org/springframework/mock/http/server/reactive/MockServerHttpRequest.java index 26c808d525..d28816d52b 100644 --- a/spring-test/src/main/java/org/springframework/mock/http/server/reactive/MockServerHttpRequest.java +++ b/spring-test/src/main/java/org/springframework/mock/http/server/reactive/MockServerHttpRequest.java @@ -209,22 +209,6 @@ public final class MockServerHttpRequest extends AbstractServerHttpRequest { return method(method, toUri(uri, vars)); } - /** - * Create a builder with a raw HTTP method value that is outside the - * range of {@link HttpMethod} enum values. - * @param httpMethod the HTTP methodValue value - * @param uri the URI template for target the URL - * @param vars variables to expand into the template - * @return the created builder - * @since 5.2.7 - * @deprecated as of Spring Framework 6.0 in favor of {@link #method(HttpMethod, String, Object...)} - */ - @Deprecated(since = "6.0") - public static BodyBuilder method(String httpMethod, String uri, @Nullable Object... vars) { - Assert.hasText(httpMethod, "HTTP method is required."); - return new DefaultBodyBuilder(HttpMethod.valueOf(httpMethod), toUri(uri, vars)); - } - private static URI toUri(String uri, @Nullable Object[] vars) { return UriComponentsBuilder.fromUriString(uri).buildAndExpand(vars).encode().toUri(); } @@ -295,14 +279,6 @@ public final class MockServerHttpRequest extends AbstractServerHttpRequest { */ B header(String headerName, String... headerValues); - /** - * Add the given header values. - * @param headers the header values - * @deprecated Use {@link #headers(HttpHeaders)} - */ - @Deprecated - B headers(MultiValueMap headers); - /** * Add the given header values. * @param headers the header values @@ -491,13 +467,6 @@ public final class MockServerHttpRequest extends AbstractServerHttpRequest { return this; } - @Override - @Deprecated - public BodyBuilder headers(MultiValueMap headers) { - this.headers.putAll(headers); - return this; - } - @Override public BodyBuilder headers(HttpHeaders headers) { this.headers.putAll(headers); diff --git a/spring-test/src/main/java/org/springframework/test/web/reactive/server/DefaultWebTestClient.java b/spring-test/src/main/java/org/springframework/test/web/reactive/server/DefaultWebTestClient.java index 71efb61dfb..4a7390c9d0 100644 --- a/spring-test/src/main/java/org/springframework/test/web/reactive/server/DefaultWebTestClient.java +++ b/spring-test/src/main/java/org/springframework/test/web/reactive/server/DefaultWebTestClient.java @@ -347,12 +347,6 @@ class DefaultWebTestClient implements WebTestClient { return this; } - @Override - @Deprecated - public RequestHeadersSpec syncBody(Object body) { - return bodyValue(body); - } - @Override public ResponseSpec exchange() { ClientRequest request = (this.inserter != null ? diff --git a/spring-test/src/main/java/org/springframework/test/web/reactive/server/DefaultWebTestClientBuilder.java b/spring-test/src/main/java/org/springframework/test/web/reactive/server/DefaultWebTestClientBuilder.java index 8b704c7adb..8e563a1f2c 100644 --- a/spring-test/src/main/java/org/springframework/test/web/reactive/server/DefaultWebTestClientBuilder.java +++ b/spring-test/src/main/java/org/springframework/test/web/reactive/server/DefaultWebTestClientBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2024 the original author or authors. + * Copyright 2002-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -246,16 +246,6 @@ class DefaultWebTestClientBuilder implements WebTestClient.Builder { return this; } - @Override - @Deprecated - public WebTestClient.Builder exchangeStrategies(Consumer configurer) { - if (this.strategiesConfigurers == null) { - this.strategiesConfigurers = new ArrayList<>(4); - } - this.strategiesConfigurers.add(configurer); - return this; - } - @Override public WebTestClient.Builder apply(WebTestClientConfigurer configurer) { configurer.afterConfigurerAdded(this, this.httpHandlerBuilder, this.connector); diff --git a/spring-test/src/main/java/org/springframework/test/web/reactive/server/WebTestClient.java b/spring-test/src/main/java/org/springframework/test/web/reactive/server/WebTestClient.java index 921cf49dae..d9849d8c27 100644 --- a/spring-test/src/main/java/org/springframework/test/web/reactive/server/WebTestClient.java +++ b/spring-test/src/main/java/org/springframework/test/web/reactive/server/WebTestClient.java @@ -490,16 +490,6 @@ public interface WebTestClient { */ Builder exchangeStrategies(ExchangeStrategies strategies); - /** - * Customize the strategies configured via - * {@link #exchangeStrategies(ExchangeStrategies)}. This method is - * designed for use in scenarios where multiple parties wish to update - * the {@code ExchangeStrategies}. - * @deprecated as of 5.1.13 in favor of {@link #codecs(Consumer)} - */ - @Deprecated - Builder exchangeStrategies(Consumer configurer); - /** * Max amount of time to wait for responses. *

By default 5 seconds. @@ -771,15 +761,6 @@ public interface WebTestClient { * @see org.springframework.web.reactive.function.BodyInserters */ RequestHeadersSpec body(BodyInserter inserter); - - /** - * Shortcut for {@link #body(BodyInserter)} with a - * {@linkplain BodyInserters#fromValue value inserter}. - * As of 5.2 this method delegates to {@link #bodyValue(Object)}. - * @deprecated as of Spring Framework 5.2 in favor of {@link #bodyValue(Object)} - */ - @Deprecated - RequestHeadersSpec syncBody(Object body); } diff --git a/spring-test/src/main/java/org/springframework/test/web/servlet/ResultMatcher.java b/spring-test/src/main/java/org/springframework/test/web/servlet/ResultMatcher.java index 44aae68e15..5fbc10aba7 100644 --- a/spring-test/src/main/java/org/springframework/test/web/servlet/ResultMatcher.java +++ b/spring-test/src/main/java/org/springframework/test/web/servlet/ResultMatcher.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2021 the original author or authors. + * Copyright 2002-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -57,21 +57,4 @@ public interface ResultMatcher { */ void match(MvcResult result) throws Exception; - - /** - * Static method for matching with an array of result matchers. - * @param matchers the matchers - * @since 5.1 - * @deprecated as of Spring Framework 5.3.10, in favor of - * {@link ResultActions#andExpectAll(ResultMatcher...)} - */ - @Deprecated - static ResultMatcher matchAll(ResultMatcher... matchers) { - return result -> { - for (ResultMatcher matcher : matchers) { - matcher.match(result); - } - }; - } - } diff --git a/spring-test/src/main/java/org/springframework/test/web/servlet/result/ContentResultMatchers.java b/spring-test/src/main/java/org/springframework/test/web/servlet/result/ContentResultMatchers.java index fa3c9dcf76..61182c4f6e 100644 --- a/spring-test/src/main/java/org/springframework/test/web/servlet/result/ContentResultMatchers.java +++ b/spring-test/src/main/java/org/springframework/test/web/servlet/result/ContentResultMatchers.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2024 the original author or authors. + * Copyright 2002-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-test/src/main/java/org/springframework/test/web/servlet/result/StatusResultMatchers.java b/spring-test/src/main/java/org/springframework/test/web/servlet/result/StatusResultMatchers.java index f4d74c238a..d7555f5c55 100644 --- a/spring-test/src/main/java/org/springframework/test/web/servlet/result/StatusResultMatchers.java +++ b/spring-test/src/main/java/org/springframework/test/web/servlet/result/StatusResultMatchers.java @@ -146,16 +146,6 @@ public class StatusResultMatchers { return matcher(HttpStatus.PROCESSING); } - /** - * Assert the response status code is {@code HttpStatus.CHECKPOINT} (103). - * @see #isEarlyHints() - * @deprecated in favor of {@link #isEarlyHints()} - */ - @Deprecated(since = "6.0.5") - public ResultMatcher isCheckpoint() { - return isEarlyHints(); - } - /** * Assert the response status code is {@code HttpStatus.EARLY_HINTS} (103). * @since 6.0.5 diff --git a/spring-test/src/main/kotlin/org/springframework/test/web/servlet/result/StatusResultMatchersDsl.kt b/spring-test/src/main/kotlin/org/springframework/test/web/servlet/result/StatusResultMatchersDsl.kt index d07bb1e6fb..195178bec7 100644 --- a/spring-test/src/main/kotlin/org/springframework/test/web/servlet/result/StatusResultMatchersDsl.kt +++ b/spring-test/src/main/kotlin/org/springframework/test/web/servlet/result/StatusResultMatchersDsl.kt @@ -1,5 +1,5 @@ /* - * Copyright 2002-2023 the original author or authors. + * Copyright 2002-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -114,15 +114,6 @@ class StatusResultMatchersDsl internal constructor (private val actions: ResultA actions.andExpect(matchers.isProcessing()) } - /** - * @see isEarlyHints - */ - @Deprecated("use isEarlyHints() instead", replaceWith= ReplaceWith("isEarlyHints()")) - fun isCheckpoint() { - @Suppress("DEPRECATION") - actions.andExpect(matchers.isCheckpoint()) - } - /** * @see StatusResultMatchers.isEarlyHints * @since 6.0.5 diff --git a/spring-test/src/test/java/org/springframework/mock/http/server/reactive/MockServerHttpRequestTests.java b/spring-test/src/test/java/org/springframework/mock/http/server/reactive/MockServerHttpRequestTests.java index bd541fe1a0..0a02563193 100644 --- a/spring-test/src/test/java/org/springframework/mock/http/server/reactive/MockServerHttpRequestTests.java +++ b/spring-test/src/test/java/org/springframework/mock/http/server/reactive/MockServerHttpRequestTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2024 the original author or authors. + * Copyright 2002-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,6 +16,7 @@ package org.springframework.mock.http.server.reactive; +import java.net.URI; import java.util.Arrays; import java.util.stream.Stream; @@ -27,7 +28,6 @@ import org.junit.jupiter.params.provider.MethodSource; import org.springframework.http.HttpCookie; import org.springframework.http.HttpHeaders; -import org.springframework.http.HttpMethod; import org.springframework.web.util.UriComponentsBuilder; import static org.assertj.core.api.Assertions.assertThat; @@ -74,15 +74,12 @@ class MockServerHttpRequestTests { .withMessageContaining("HTTP method is required."); } - @SuppressWarnings("deprecation") static Stream> httpMethodNotNullOrEmpty() { String uriTemplate = "/foo bar?a=b"; + URI uri = UriComponentsBuilder.fromUriString(uriTemplate).build().toUri(); return Stream.of( - named("null HttpMethod, URI", () -> MockServerHttpRequest.method(null, UriComponentsBuilder.fromUriString(uriTemplate).build("")).build()), - named("null HttpMethod, uriTemplate", () -> MockServerHttpRequest.method((HttpMethod) null, uriTemplate).build()), - named("null String, uriTemplate", () -> MockServerHttpRequest.method((String) null, uriTemplate).build()), - named("empty String, uriTemplate", () -> MockServerHttpRequest.method("", uriTemplate).build()), - named("blank String, uriTemplate", () -> MockServerHttpRequest.method(" ", uriTemplate).build()) + named("null HttpMethod, URI", () -> MockServerHttpRequest.method(null, uri).build()), + named("null HttpMethod, uriTemplate", () -> MockServerHttpRequest.method(null, uriTemplate).build()) ); }