Suppress warnings
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2019 the original author or authors.
|
||||
* Copyright 2002-2022 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.
|
||||
@@ -30,7 +30,6 @@ import org.springframework.http.client.ClientHttpResponse;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
|
||||
/**
|
||||
* Tests for {@link InterceptingHttpAccessor}.
|
||||
*
|
||||
@@ -40,6 +39,7 @@ public class InterceptingHttpAccessorTests {
|
||||
|
||||
@Test
|
||||
public void getInterceptors() {
|
||||
@SuppressWarnings("resource")
|
||||
TestInterceptingHttpAccessor accessor = new TestInterceptingHttpAccessor();
|
||||
List<ClientHttpRequestInterceptor> interceptors = Arrays.asList(
|
||||
new SecondClientHttpRequestInterceptor(),
|
||||
|
||||
@@ -52,6 +52,7 @@ class AsyncIntegrationTests extends AbstractHttpHandlerIntegrationTests {
|
||||
startServer(httpServer);
|
||||
|
||||
URI url = new URI("http://localhost:" + port);
|
||||
@SuppressWarnings("resource")
|
||||
ResponseEntity<String> response = new RestTemplate().exchange(RequestEntity.get(url).build(), String.class);
|
||||
|
||||
assertThat(response.getBody()).isEqualTo("hello");
|
||||
|
||||
@@ -53,6 +53,7 @@ public class CookieIntegrationTests extends AbstractHttpHandlerIntegrationTests
|
||||
|
||||
URI url = new URI("http://localhost:" + port);
|
||||
String header = "SID=31d4d96e407aad42; lang=en-US";
|
||||
@SuppressWarnings("resource")
|
||||
ResponseEntity<Void> response = new RestTemplate().exchange(
|
||||
RequestEntity.get(url).header("Cookie", header).build(), Void.class);
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2019 the original author or authors.
|
||||
* Copyright 2002-2022 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.
|
||||
@@ -49,6 +49,7 @@ public class EchoHandlerIntegrationTests extends AbstractHttpHandlerIntegrationT
|
||||
public void echo(HttpServer httpServer) throws Exception {
|
||||
startServer(httpServer);
|
||||
|
||||
@SuppressWarnings("resource")
|
||||
RestTemplate restTemplate = new RestTemplate();
|
||||
|
||||
byte[] body = randomBytes();
|
||||
|
||||
@@ -49,6 +49,7 @@ class ErrorHandlerIntegrationTests extends AbstractHttpHandlerIntegrationTests {
|
||||
void responseBodyError(HttpServer httpServer) throws Exception {
|
||||
startServer(httpServer);
|
||||
|
||||
@SuppressWarnings("resource")
|
||||
RestTemplate restTemplate = new RestTemplate();
|
||||
restTemplate.setErrorHandler(NO_OP_ERROR_HANDLER);
|
||||
|
||||
@@ -62,6 +63,7 @@ class ErrorHandlerIntegrationTests extends AbstractHttpHandlerIntegrationTests {
|
||||
void handlingError(HttpServer httpServer) throws Exception {
|
||||
startServer(httpServer);
|
||||
|
||||
@SuppressWarnings("resource")
|
||||
RestTemplate restTemplate = new RestTemplate();
|
||||
restTemplate.setErrorHandler(NO_OP_ERROR_HANDLER);
|
||||
|
||||
@@ -75,6 +77,7 @@ class ErrorHandlerIntegrationTests extends AbstractHttpHandlerIntegrationTests {
|
||||
void emptyPathSegments(HttpServer httpServer) throws Exception {
|
||||
startServer(httpServer);
|
||||
|
||||
@SuppressWarnings("resource")
|
||||
RestTemplate restTemplate = new RestTemplate();
|
||||
restTemplate.setErrorHandler(NO_OP_ERROR_HANDLER);
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2019 the original author or authors.
|
||||
* Copyright 2002-2022 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,6 +57,7 @@ class MultipartIntegrationTests extends AbstractHttpHandlerIntegrationTests {
|
||||
void getFormParts(HttpServer httpServer) throws Exception {
|
||||
startServer(httpServer);
|
||||
|
||||
@SuppressWarnings("resource")
|
||||
RestTemplate restTemplate = new RestTemplate();
|
||||
RequestEntity<MultiValueMap<String, Object>> request = RequestEntity
|
||||
.post(new URI("http://localhost:" + port + "/form-parts"))
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2020 the original author or authors.
|
||||
* Copyright 2002-2022 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.
|
||||
@@ -59,6 +59,7 @@ class RandomHandlerIntegrationTests extends AbstractHttpHandlerIntegrationTests
|
||||
|
||||
// TODO: fix Reactor support
|
||||
|
||||
@SuppressWarnings("resource")
|
||||
RestTemplate restTemplate = new RestTemplate();
|
||||
|
||||
byte[] body = randomBytes();
|
||||
|
||||
@@ -46,6 +46,7 @@ class ServerHttpRequestIntegrationTests extends AbstractHttpHandlerIntegrationTe
|
||||
|
||||
URI url = new URI("http://localhost:" + port + "/foo?param=bar");
|
||||
RequestEntity<Void> request = RequestEntity.post(url).build();
|
||||
@SuppressWarnings("resource")
|
||||
ResponseEntity<Void> response = new RestTemplate().exchange(request, Void.class);
|
||||
assertThat(response.getStatusCode()).isEqualTo(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2019 the original author or authors.
|
||||
* Copyright 2002-2022 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.
|
||||
@@ -54,6 +54,7 @@ class WriteOnlyHandlerIntegrationTests extends AbstractHttpHandlerIntegrationTes
|
||||
void writeOnly(HttpServer httpServer) throws Exception {
|
||||
startServer(httpServer);
|
||||
|
||||
@SuppressWarnings("resource")
|
||||
RestTemplate restTemplate = new RestTemplate();
|
||||
|
||||
this.body = randomBytes();
|
||||
|
||||
@@ -61,6 +61,7 @@ class ZeroCopyIntegrationTests extends AbstractHttpHandlerIntegrationTests {
|
||||
|
||||
URI url = new URI("http://localhost:" + port);
|
||||
RequestEntity<?> request = RequestEntity.get(url).build();
|
||||
@SuppressWarnings("resource")
|
||||
ResponseEntity<byte[]> response = new RestTemplate().exchange(request, byte[].class);
|
||||
|
||||
assertThat(response.hasBody()).isTrue();
|
||||
|
||||
@@ -106,6 +106,7 @@ class RestTemplateTests {
|
||||
|
||||
@Test // gh-29008
|
||||
void defaultMessageConvertersWithKotlinSerialization() {
|
||||
@SuppressWarnings("resource")
|
||||
RestTemplate restTemplate = new RestTemplate();
|
||||
List<HttpMessageConverter<?>> httpMessageConverters = restTemplate.getMessageConverters();
|
||||
assertThat(httpMessageConverters).extracting("class").containsOnlyOnce(
|
||||
|
||||
Reference in New Issue
Block a user