Polish "Use diamond operator where feasible"
See gh-31916
This commit is contained in:
parent
094479b55f
commit
a6e87b40c7
|
@ -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.
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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++;
|
||||
|
|
|
@ -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<String> 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<String, HttpEntity<?>> result = builder.build();
|
||||
|
||||
|
|
|
@ -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..
|
||||
}
|
||||
|
|
|
@ -166,8 +166,7 @@ class RestClientIntegrationTests {
|
|||
ValueContainer<Pojo> 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<List<Pojo>> 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"));
|
||||
|
|
|
@ -138,8 +138,7 @@ class BodyExtractorsTests {
|
|||
@Test
|
||||
void toMonoParameterizedTypeReference() {
|
||||
BodyExtractor<Mono<Map<String, String>>, 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<Mono<Map<String, String>>, ReactiveHttpInputMessage> extractor =
|
||||
BodyExtractors.toMono(new ParameterizedTypeReference<>() {
|
||||
});
|
||||
BodyExtractors.toMono(new ParameterizedTypeReference<>() {});
|
||||
|
||||
MockServerHttpRequest request = MockServerHttpRequest.post("/").body(Flux.empty());
|
||||
Mono<Map<String, String>> result = extractor.extract(request, this.context);
|
||||
|
|
|
@ -124,8 +124,7 @@ class WebClientDataBufferAllocatingTests extends AbstractDataBufferAllocatingTes
|
|||
Mono<Map<String, String>> 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);
|
||||
|
|
|
@ -197,8 +197,7 @@ class WebClientIntegrationTests {
|
|||
Mono<ValueContainer<Pojo>> 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)
|
||||
|
|
|
@ -318,8 +318,7 @@ public class DefaultServerRequestTests {
|
|||
DefaultServerRequest request = new DefaultServerRequest(MockServerWebExchange.from(mockRequest), messageReaders);
|
||||
|
||||
Mono<Map<String, String>> resultMono = request.bodyToMono(
|
||||
new ParameterizedTypeReference<>() {
|
||||
});
|
||||
new ParameterizedTypeReference<>() {});
|
||||
StepVerifier.create(resultMono)
|
||||
.expectError(ServerWebInputException.class)
|
||||
.verify();
|
||||
|
|
|
@ -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 -> {
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -60,8 +60,7 @@ class DefaultEntityResponseBuilderTests {
|
|||
void fromObjectTypeReference() {
|
||||
String body = "foo";
|
||||
EntityResponse<String> response = EntityResponse.fromObject(body,
|
||||
new ParameterizedTypeReference<>() {
|
||||
})
|
||||
new ParameterizedTypeReference<>() {})
|
||||
.build();
|
||||
|
||||
assertThat(response.entity()).isSameAs(body);
|
||||
|
|
|
@ -265,8 +265,7 @@ class DefaultServerRequestTests {
|
|||
DefaultServerRequest request = new DefaultServerRequest(servletRequest,
|
||||
List.of(new MappingJackson2HttpMessageConverter()));
|
||||
|
||||
List<String> result = request.body(new ParameterizedTypeReference<>() {
|
||||
});
|
||||
List<String> result = request.body(new ParameterizedTypeReference<>() {});
|
||||
assertThat(result).hasSize(2);
|
||||
assertThat(result).element(0).isEqualTo("foo");
|
||||
assertThat(result).element(1).isEqualTo("bar");
|
||||
|
|
|
@ -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<String> 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();
|
||||
|
|
|
@ -141,7 +141,6 @@ class RestTemplateXhrTransportTests {
|
|||
@Override
|
||||
public void onSuccess(WebSocketSession result) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable ex) {
|
||||
if (ex == expected) {
|
||||
|
|
Loading…
Reference in New Issue