Remove deprecated APIs in spring-web

See gh-33809
This commit is contained in:
rstoyanchev
2025-01-13 16:30:14 +00:00
parent 00ee0ab99c
commit 9ddbf800b9
16 changed files with 19 additions and 545 deletions

View File

@@ -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.
@@ -168,7 +168,6 @@ class HttpStatusTests {
@SuppressWarnings("deprecation")
static List<Arguments> codesWithAliases() {
return List.of(
arguments(103, HttpStatus.EARLY_HINTS, HttpStatus.CHECKPOINT),
arguments(302, HttpStatus.FOUND, HttpStatus.MOVED_TEMPORARILY),
arguments(413, HttpStatus.PAYLOAD_TOO_LARGE, HttpStatus.REQUEST_ENTITY_TOO_LARGE),
arguments(414, HttpStatus.URI_TOO_LONG, HttpStatus.REQUEST_URI_TOO_LONG)

View File

@@ -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.
@@ -316,12 +316,11 @@ class ResponseEntityTests {
}
@Test
@SuppressWarnings("deprecation")
void customStatusCode() {
Integer entity = 42;
ResponseEntity<Integer> responseEntity = ResponseEntity.status(299).body(entity);
assertThat(responseEntity.getStatusCodeValue()).isEqualTo(299);
assertThat(responseEntity.getStatusCode().value()).isEqualTo(299);
assertThat(responseEntity.getBody()).isEqualTo(entity);
}

View File

@@ -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.

View File

@@ -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.
@@ -57,17 +57,6 @@ class ModelAndViewContainerTests {
assertThat(this.mavContainer.getModel().get("name2")).isEqualTo("value2");
}
@Test
@SuppressWarnings("deprecation")
public void redirectScenarioWithoutRedirectModel() {
this.mavContainer.setIgnoreDefaultModelOnRedirect(false);
this.mavContainer.addAttribute("name", "value");
this.mavContainer.setRedirectModelScenario(true);
assertThat(this.mavContainer.getModel()).hasSize(1);
assertThat(this.mavContainer.getModel().get("name")).isEqualTo("value");
}
@Test
void ignoreDefaultModel() {
this.mavContainer.addAttribute("name", "value");

View File

@@ -1,49 +0,0 @@
/*
* Copyright 2002-2024 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.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.web.util;
import org.junit.jupiter.api.Test;
import org.springframework.core.NestedExceptionUtils;
import static org.assertj.core.api.Assertions.assertThat;
@SuppressWarnings("deprecation")
public class NestedServletExceptionTests {
@Test
void testNestedServletExceptionString() {
NestedServletException exception = new NestedServletException("foo");
assertThat(exception.getMessage()).isEqualTo("foo");
}
@Test
void testNestedServletExceptionStringThrowable() {
Throwable cause = new RuntimeException();
NestedServletException exception = new NestedServletException("foo", cause);
assertThat(exception.getMessage()).isEqualTo(NestedExceptionUtils.buildMessage("foo", cause));
assertThat(exception.getCause()).isEqualTo(cause);
}
@Test
void testNestedServletExceptionStringNullThrowable() {
// This can happen if someone is sloppy with Throwable causes...
NestedServletException exception = new NestedServletException("foo", null);
assertThat(exception.getMessage()).isEqualTo("foo");
}
}