Polish "Use diamond operator where feasible"

See gh-31916
This commit is contained in:
Stéphane Nicoll
2023-12-28 13:08:24 +01:00
parent 094479b55f
commit a6e87b40c7
17 changed files with 21 additions and 41 deletions

View File

@@ -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);

View File

@@ -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);

View File

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

View File

@@ -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();

View File

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

View File

@@ -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);
}