diff --git a/spring-aspects/src/test/java/org/springframework/scheduling/aspectj/AnnotationAsyncExecutionAspectTests.java b/spring-aspects/src/test/java/org/springframework/scheduling/aspectj/AnnotationAsyncExecutionAspectTests.java index 53c460c5705..b491c3168e2 100644 --- a/spring-aspects/src/test/java/org/springframework/scheduling/aspectj/AnnotationAsyncExecutionAspectTests.java +++ b/spring-aspects/src/test/java/org/springframework/scheduling/aspectj/AnnotationAsyncExecutionAspectTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2019 the original author or authors. + * Copyright 2002-2023 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-context/src/test/java/org/springframework/scheduling/annotation/AsyncResultTests.java b/spring-context/src/test/java/org/springframework/scheduling/annotation/AsyncResultTests.java index efbcd4b0814..f4930989c0e 100644 --- a/spring-context/src/test/java/org/springframework/scheduling/annotation/AsyncResultTests.java +++ b/spring-context/src/test/java/org/springframework/scheduling/annotation/AsyncResultTests.java @@ -42,7 +42,6 @@ public class AsyncResultTests { public void onSuccess(String result) { values.add(result); } - @Override public void onFailure(Throwable ex) { throw new AssertionError("Failure callback not expected: " + ex, ex); @@ -65,7 +64,6 @@ public class AsyncResultTests { public void onSuccess(String result) { throw new AssertionError("Success callback not expected: " + result); } - @Override public void onFailure(Throwable ex) { values.add(ex); diff --git a/spring-expression/src/test/java/org/springframework/expression/spel/SpelExceptionTests.java b/spring-expression/src/test/java/org/springframework/expression/spel/SpelExceptionTests.java index d0a0a9daa19..f0bfbe1fabf 100644 --- a/spring-expression/src/test/java/org/springframework/expression/spel/SpelExceptionTests.java +++ b/spring-expression/src/test/java/org/springframework/expression/spel/SpelExceptionTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2019 the original author or authors. + * Copyright 2002-2023 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. @@ -152,7 +152,7 @@ public class SpelExceptionTests { StandardEvaluationContext ctx = new StandardEvaluationContext(); ctx.setVariables(new HashMap<>() { { - put("anArray", new int[]{1, 2, 3}); + put("anArray", new int[] {1,2,3}); } }); boolean result = spelExpression.getValue(ctx, Boolean.class); diff --git a/spring-jms/src/test/java/org/springframework/jms/listener/DefaultMessageListenerContainerTests.java b/spring-jms/src/test/java/org/springframework/jms/listener/DefaultMessageListenerContainerTests.java index e00257fe3d8..ccc758a2211 100644 --- a/spring-jms/src/test/java/org/springframework/jms/listener/DefaultMessageListenerContainerTests.java +++ b/spring-jms/src/test/java/org/springframework/jms/listener/DefaultMessageListenerContainerTests.java @@ -250,7 +250,6 @@ class DefaultMessageListenerContainerTests { ConnectionFactory connectionFactory = mock(); given(connectionFactory.createConnection()).will(new Answer<>() { int currentAttempts = 0; - @Override public Object answer(InvocationOnMock invocation) throws Throwable { currentAttempts++; diff --git a/spring-web/src/test/java/org/springframework/http/client/MultipartBodyBuilderTests.java b/spring-web/src/test/java/org/springframework/http/client/MultipartBodyBuilderTests.java index f8d9cc4b5a6..cdbae58f783 100644 --- a/spring-web/src/test/java/org/springframework/http/client/MultipartBodyBuilderTests.java +++ b/spring-web/src/test/java/org/springframework/http/client/MultipartBodyBuilderTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2022 the original author or authors. + * Copyright 2002-2023 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. @@ -56,8 +56,7 @@ public class MultipartBodyBuilderTests { Publisher publisher = Flux.just("foo", "bar", "baz"); builder.asyncPart("publisherClass", publisher, String.class).header("baz", "qux"); - builder.asyncPart("publisherPtr", publisher, new ParameterizedTypeReference<>() { - }).header("baz", "qux"); + builder.asyncPart("publisherPtr", publisher, new ParameterizedTypeReference<>() {}).header("baz", "qux"); MultiValueMap> result = builder.build(); diff --git a/spring-web/src/test/java/org/springframework/http/server/reactive/ChannelSendOperatorTests.java b/spring-web/src/test/java/org/springframework/http/server/reactive/ChannelSendOperatorTests.java index 69c2854bb97..5c3c89d62bd 100644 --- a/spring-web/src/test/java/org/springframework/http/server/reactive/ChannelSendOperatorTests.java +++ b/spring-web/src/test/java/org/springframework/http/server/reactive/ChannelSendOperatorTests.java @@ -169,8 +169,7 @@ class ChannelSendOperatorTests { return Mono.never(); }); - operator.subscribe(new BaseSubscriber<>() { - }); + operator.subscribe(new BaseSubscriber<>() {}); try { writeSubscriber.signalDemand(1); // Let cached signals ("foo" and error) be published.. } diff --git a/spring-web/src/test/java/org/springframework/web/client/RestClientIntegrationTests.java b/spring-web/src/test/java/org/springframework/web/client/RestClientIntegrationTests.java index e5b24b4724e..9e20db92c32 100644 --- a/spring-web/src/test/java/org/springframework/web/client/RestClientIntegrationTests.java +++ b/spring-web/src/test/java/org/springframework/web/client/RestClientIntegrationTests.java @@ -166,8 +166,7 @@ class RestClientIntegrationTests { ValueContainer result = this.restClient.get() .uri("/json").accept(MediaType.APPLICATION_JSON) .retrieve() - .body(new ParameterizedTypeReference<>() { - }); + .body(new ParameterizedTypeReference<>() {}); assertThat(result.getContainerValue()).isNotNull(); Pojo pojo = result.getContainerValue(); @@ -192,8 +191,7 @@ class RestClientIntegrationTests { ValueContainer> result = this.restClient.get() .uri("/json").accept(MediaType.APPLICATION_JSON) .retrieve() - .body(new ParameterizedTypeReference<>() { - }); + .body(new ParameterizedTypeReference<>() {}); assertThat(result.containerValue).isNotNull(); assertThat(result.containerValue).containsExactly(new Pojo("foofoo", "barbar")); diff --git a/spring-webflux/src/test/java/org/springframework/web/reactive/function/BodyExtractorsTests.java b/spring-webflux/src/test/java/org/springframework/web/reactive/function/BodyExtractorsTests.java index 695049ff16d..f4eae109844 100644 --- a/spring-webflux/src/test/java/org/springframework/web/reactive/function/BodyExtractorsTests.java +++ b/spring-webflux/src/test/java/org/springframework/web/reactive/function/BodyExtractorsTests.java @@ -138,8 +138,7 @@ class BodyExtractorsTests { @Test void toMonoParameterizedTypeReference() { BodyExtractor>, ReactiveHttpInputMessage> extractor = - BodyExtractors.toMono(new ParameterizedTypeReference<>() { - }); + BodyExtractors.toMono(new ParameterizedTypeReference<>() {}); byte[] bytes = "{\"username\":\"foo\",\"password\":\"bar\"}".getBytes(StandardCharsets.UTF_8); DefaultDataBuffer dataBuffer = DefaultDataBufferFactory.sharedInstance.wrap(ByteBuffer.wrap(bytes)); @@ -184,8 +183,7 @@ class BodyExtractorsTests { @Test // SPR-15758 void toMonoWithEmptyBodyAndNoContentType() { BodyExtractor>, ReactiveHttpInputMessage> extractor = - BodyExtractors.toMono(new ParameterizedTypeReference<>() { - }); + BodyExtractors.toMono(new ParameterizedTypeReference<>() {}); MockServerHttpRequest request = MockServerHttpRequest.post("/").body(Flux.empty()); Mono> result = extractor.extract(request, this.context); diff --git a/spring-webflux/src/test/java/org/springframework/web/reactive/function/client/WebClientDataBufferAllocatingTests.java b/spring-webflux/src/test/java/org/springframework/web/reactive/function/client/WebClientDataBufferAllocatingTests.java index f11f9725888..7e1fafa0d37 100644 --- a/spring-webflux/src/test/java/org/springframework/web/reactive/function/client/WebClientDataBufferAllocatingTests.java +++ b/spring-webflux/src/test/java/org/springframework/web/reactive/function/client/WebClientDataBufferAllocatingTests.java @@ -124,8 +124,7 @@ class WebClientDataBufferAllocatingTests extends AbstractDataBufferAllocatingTes Mono> mono = this.webClient.get() .uri("/sample").accept(MediaType.APPLICATION_JSON) .retrieve() - .bodyToMono(new ParameterizedTypeReference<>() { - }); + .bodyToMono(new ParameterizedTypeReference<>() {}); StepVerifier.create(mono).expectError(WebClientResponseException.class).verify(Duration.ofSeconds(3)); assertThat(this.server.getRequestCount()).isEqualTo(1); diff --git a/spring-webflux/src/test/java/org/springframework/web/reactive/function/client/WebClientIntegrationTests.java b/spring-webflux/src/test/java/org/springframework/web/reactive/function/client/WebClientIntegrationTests.java index 598cf990ef9..2daa1164616 100644 --- a/spring-webflux/src/test/java/org/springframework/web/reactive/function/client/WebClientIntegrationTests.java +++ b/spring-webflux/src/test/java/org/springframework/web/reactive/function/client/WebClientIntegrationTests.java @@ -197,8 +197,7 @@ class WebClientIntegrationTests { Mono> result = this.webClient.get() .uri("/json").accept(MediaType.APPLICATION_JSON) .retrieve() - .bodyToMono(new ParameterizedTypeReference<>() { - }); + .bodyToMono(new ParameterizedTypeReference<>() {}); StepVerifier.create(result) .assertNext(c -> assertThat(c.getContainerValue()).isEqualTo(new Pojo("foofoo", "barbar"))) @@ -805,8 +804,7 @@ class WebClientIntegrationTests { .uri("/greeting") .retrieve() .onStatus(HttpStatusCode::is5xxServerError, response -> Mono.just(new MyException("500 error!"))) - .bodyToMono(new ParameterizedTypeReference<>() { - }); + .bodyToMono(new ParameterizedTypeReference<>() {}); StepVerifier.create(result) .expectError(MyException.class) diff --git a/spring-webflux/src/test/java/org/springframework/web/reactive/function/server/DefaultServerRequestTests.java b/spring-webflux/src/test/java/org/springframework/web/reactive/function/server/DefaultServerRequestTests.java index 5eba512cf4e..6f3b723c935 100644 --- a/spring-webflux/src/test/java/org/springframework/web/reactive/function/server/DefaultServerRequestTests.java +++ b/spring-webflux/src/test/java/org/springframework/web/reactive/function/server/DefaultServerRequestTests.java @@ -318,8 +318,7 @@ public class DefaultServerRequestTests { DefaultServerRequest request = new DefaultServerRequest(MockServerWebExchange.from(mockRequest), messageReaders); Mono> resultMono = request.bodyToMono( - new ParameterizedTypeReference<>() { - }); + new ParameterizedTypeReference<>() {}); StepVerifier.create(resultMono) .expectError(ServerWebInputException.class) .verify(); diff --git a/spring-webflux/src/test/java/org/springframework/web/reactive/function/server/SseHandlerFunctionIntegrationTests.java b/spring-webflux/src/test/java/org/springframework/web/reactive/function/server/SseHandlerFunctionIntegrationTests.java index bbb536ce6dc..9e0079acd5e 100644 --- a/spring-webflux/src/test/java/org/springframework/web/reactive/function/server/SseHandlerFunctionIntegrationTests.java +++ b/spring-webflux/src/test/java/org/springframework/web/reactive/function/server/SseHandlerFunctionIntegrationTests.java @@ -100,8 +100,7 @@ class SseHandlerFunctionIntegrationTests extends AbstractRouterFunctionIntegrati .uri("/event") .accept(TEXT_EVENT_STREAM) .retrieve() - .bodyToFlux(new ParameterizedTypeReference<>() { - }); + .bodyToFlux(new ParameterizedTypeReference<>() {}); StepVerifier.create(result) .consumeNextWith( event -> { diff --git a/spring-webflux/src/test/java/org/springframework/web/reactive/result/method/annotation/SseIntegrationTests.java b/spring-webflux/src/test/java/org/springframework/web/reactive/result/method/annotation/SseIntegrationTests.java index d72cf4820a6..2ca14327765 100644 --- a/spring-webflux/src/test/java/org/springframework/web/reactive/result/method/annotation/SseIntegrationTests.java +++ b/spring-webflux/src/test/java/org/springframework/web/reactive/result/method/annotation/SseIntegrationTests.java @@ -134,8 +134,7 @@ class SseIntegrationTests extends AbstractHttpHandlerIntegrationTests { .uri("/event") .accept(TEXT_EVENT_STREAM) .retrieve() - .bodyToFlux(new ParameterizedTypeReference<>() { - }); + .bodyToFlux(new ParameterizedTypeReference<>() {}); verifyPersonEvents(result); } @@ -148,8 +147,7 @@ class SseIntegrationTests extends AbstractHttpHandlerIntegrationTests { .uri("/event") .accept(TEXT_EVENT_STREAM) .retrieve() - .bodyToFlux(new ParameterizedTypeReference<>() { - }); + .bodyToFlux(new ParameterizedTypeReference<>() {}); verifyPersonEvents(result); } diff --git a/spring-webmvc/src/test/java/org/springframework/web/servlet/function/DefaultEntityResponseBuilderTests.java b/spring-webmvc/src/test/java/org/springframework/web/servlet/function/DefaultEntityResponseBuilderTests.java index 7a523bf9691..8ccecc9a54a 100644 --- a/spring-webmvc/src/test/java/org/springframework/web/servlet/function/DefaultEntityResponseBuilderTests.java +++ b/spring-webmvc/src/test/java/org/springframework/web/servlet/function/DefaultEntityResponseBuilderTests.java @@ -60,8 +60,7 @@ class DefaultEntityResponseBuilderTests { void fromObjectTypeReference() { String body = "foo"; EntityResponse response = EntityResponse.fromObject(body, - new ParameterizedTypeReference<>() { - }) + new ParameterizedTypeReference<>() {}) .build(); assertThat(response.entity()).isSameAs(body); diff --git a/spring-webmvc/src/test/java/org/springframework/web/servlet/function/DefaultServerRequestTests.java b/spring-webmvc/src/test/java/org/springframework/web/servlet/function/DefaultServerRequestTests.java index 0eaf2180c06..9b933c52fda 100644 --- a/spring-webmvc/src/test/java/org/springframework/web/servlet/function/DefaultServerRequestTests.java +++ b/spring-webmvc/src/test/java/org/springframework/web/servlet/function/DefaultServerRequestTests.java @@ -265,8 +265,7 @@ class DefaultServerRequestTests { DefaultServerRequest request = new DefaultServerRequest(servletRequest, List.of(new MappingJackson2HttpMessageConverter())); - List result = request.body(new ParameterizedTypeReference<>() { - }); + List result = request.body(new ParameterizedTypeReference<>() {}); assertThat(result).hasSize(2); assertThat(result).element(0).isEqualTo("foo"); assertThat(result).element(1).isEqualTo("bar"); diff --git a/spring-webmvc/src/test/java/org/springframework/web/servlet/function/DefaultServerResponseBuilderTests.java b/spring-webmvc/src/test/java/org/springframework/web/servlet/function/DefaultServerResponseBuilderTests.java index 7d53f1ddb22..335f7ece51b 100644 --- a/spring-webmvc/src/test/java/org/springframework/web/servlet/function/DefaultServerResponseBuilderTests.java +++ b/spring-webmvc/src/test/java/org/springframework/web/servlet/function/DefaultServerResponseBuilderTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2022 the original author or authors. + * Copyright 2002-2023 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. @@ -293,8 +293,7 @@ class DefaultServerResponseBuilderTests { List body = new ArrayList<>(); body.add("foo"); body.add("bar"); - ServerResponse response = ServerResponse.ok().body(body, new ParameterizedTypeReference<>() { - }); + ServerResponse response = ServerResponse.ok().body(body, new ParameterizedTypeReference<>() {}); MockHttpServletRequest mockRequest = new MockHttpServletRequest("GET", "https://example.com"); MockHttpServletResponse mockResponse = new MockHttpServletResponse(); diff --git a/spring-websocket/src/test/java/org/springframework/web/socket/sockjs/client/RestTemplateXhrTransportTests.java b/spring-websocket/src/test/java/org/springframework/web/socket/sockjs/client/RestTemplateXhrTransportTests.java index 12b19b534f9..ab34c4c80cb 100644 --- a/spring-websocket/src/test/java/org/springframework/web/socket/sockjs/client/RestTemplateXhrTransportTests.java +++ b/spring-websocket/src/test/java/org/springframework/web/socket/sockjs/client/RestTemplateXhrTransportTests.java @@ -141,7 +141,6 @@ class RestTemplateXhrTransportTests { @Override public void onSuccess(WebSocketSession result) { } - @Override public void onFailure(Throwable ex) { if (ex == expected) {