parent
db2c532c07
commit
094479b55f
|
|
@ -221,7 +221,7 @@ public class AnnotationAsyncExecutionAspectTests {
|
|||
|
||||
@Async public Future<Integer> incrementReturningAFuture() {
|
||||
counter++;
|
||||
return new AsyncResult<Integer>(5);
|
||||
return new AsyncResult<>(5);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -256,7 +256,7 @@ public class AnnotationAsyncExecutionAspectTests {
|
|||
|
||||
public Future<Integer> incrementReturningAFuture() {
|
||||
counter++;
|
||||
return new AsyncResult<Integer>(5);
|
||||
return new AsyncResult<>(5);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -265,12 +265,12 @@ public class AnnotationAsyncExecutionAspectTests {
|
|||
|
||||
@Async
|
||||
public Future<Thread> defaultWork() {
|
||||
return new AsyncResult<Thread>(Thread.currentThread());
|
||||
return new AsyncResult<>(Thread.currentThread());
|
||||
}
|
||||
|
||||
@Async("e1")
|
||||
public ListenableFuture<Thread> e1Work() {
|
||||
return new AsyncResult<Thread>(Thread.currentThread());
|
||||
return new AsyncResult<>(Thread.currentThread());
|
||||
}
|
||||
|
||||
@Async("e1")
|
||||
|
|
|
|||
|
|
@ -1231,7 +1231,7 @@ public abstract class AbstractAopProxyTests {
|
|||
}
|
||||
}
|
||||
AdvisedSupport pc = new AdvisedSupport(ITestBean.class);
|
||||
MapAwareMethodInterceptor mami1 = new MapAwareMethodInterceptor(new HashMap<>(), new HashMap<String, String>());
|
||||
MapAwareMethodInterceptor mami1 = new MapAwareMethodInterceptor(new HashMap<>(), new HashMap<>());
|
||||
Map<String, String> firstValuesToAdd = new HashMap<>();
|
||||
firstValuesToAdd.put("test", "");
|
||||
MapAwareMethodInterceptor mami2 = new MapAwareMethodInterceptor(new HashMap<>(), firstValuesToAdd);
|
||||
|
|
|
|||
|
|
@ -37,11 +37,12 @@ public class AsyncResultTests {
|
|||
String value = "val";
|
||||
final Set<String> values = new HashSet<>(1);
|
||||
org.springframework.util.concurrent.ListenableFuture<String> future = AsyncResult.forValue(value);
|
||||
future.addCallback(new org.springframework.util.concurrent.ListenableFutureCallback<String>() {
|
||||
future.addCallback(new org.springframework.util.concurrent.ListenableFutureCallback<>() {
|
||||
@Override
|
||||
public void onSuccess(String result) {
|
||||
values.add(result);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable ex) {
|
||||
throw new AssertionError("Failure callback not expected: " + ex, ex);
|
||||
|
|
@ -59,11 +60,12 @@ public class AsyncResultTests {
|
|||
IOException ex = new IOException();
|
||||
final Set<Throwable> values = new HashSet<>(1);
|
||||
org.springframework.util.concurrent.ListenableFuture<String> future = AsyncResult.forExecutionException(ex);
|
||||
future.addCallback(new org.springframework.util.concurrent.ListenableFutureCallback<String>() {
|
||||
future.addCallback(new org.springframework.util.concurrent.ListenableFutureCallback<>() {
|
||||
@Override
|
||||
public void onSuccess(String result) {
|
||||
throw new AssertionError("Success callback not expected: " + result);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable ex) {
|
||||
values.add(ex);
|
||||
|
|
|
|||
|
|
@ -276,7 +276,7 @@ class ScheduledAnnotationBeanPostProcessorObservabilityTests {
|
|||
@Scheduled(fixedDelay = 10_000, initialDelay = 5_000)
|
||||
Mono<String> hasCurrentObservation() {
|
||||
return Mono.just("test")
|
||||
.tap(() -> new DefaultSignalListener<String>() {
|
||||
.tap(() -> new DefaultSignalListener<>() {
|
||||
@Override
|
||||
public void doFirst() throws Throwable {
|
||||
Observation observation = observationRegistry.getCurrentObservation();
|
||||
|
|
|
|||
|
|
@ -453,7 +453,7 @@ class ClassUtilsTests {
|
|||
void isNotLambda() {
|
||||
assertIsNotLambda(new EnigmaSupplier());
|
||||
|
||||
assertIsNotLambda(new Supplier<String>() {
|
||||
assertIsNotLambda(new Supplier<>() {
|
||||
@Override
|
||||
public String get() {
|
||||
return "anonymous inner class";
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ public class SpelExceptionTests {
|
|||
ExpressionParser parser = new SpelExpressionParser();
|
||||
Expression spelExpression = parser.parseExpression("#aMap['one'] eq 1");
|
||||
StandardEvaluationContext ctx = new StandardEvaluationContext();
|
||||
ctx.setVariables(new HashMap<String, Object>() {
|
||||
ctx.setVariables(new HashMap<>() {
|
||||
{
|
||||
put("aMap", new HashMap<String, Integer>() {
|
||||
{
|
||||
|
|
@ -98,7 +98,7 @@ public class SpelExceptionTests {
|
|||
ExpressionParser parser = new SpelExpressionParser();
|
||||
Expression spelExpression = parser.parseExpression("#aList.contains('one')");
|
||||
StandardEvaluationContext ctx = new StandardEvaluationContext();
|
||||
ctx.setVariables(new HashMap<String, Object>() {
|
||||
ctx.setVariables(new HashMap<>() {
|
||||
{
|
||||
put("aList", new ArrayList<String>() {
|
||||
{
|
||||
|
|
@ -120,7 +120,7 @@ public class SpelExceptionTests {
|
|||
ExpressionParser parser = new SpelExpressionParser();
|
||||
Expression spelExpression = parser.parseExpression("#aList[0] eq 'one'");
|
||||
StandardEvaluationContext ctx = new StandardEvaluationContext();
|
||||
ctx.setVariables(new HashMap<String, Object>() {
|
||||
ctx.setVariables(new HashMap<>() {
|
||||
{
|
||||
put("aList", new ArrayList<String>() {
|
||||
{
|
||||
|
|
@ -150,9 +150,9 @@ public class SpelExceptionTests {
|
|||
ExpressionParser parser = new SpelExpressionParser();
|
||||
Expression spelExpression = parser.parseExpression("#anArray[0] eq 1");
|
||||
StandardEvaluationContext ctx = new StandardEvaluationContext();
|
||||
ctx.setVariables(new HashMap<String, Object>() {
|
||||
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);
|
||||
|
|
|
|||
|
|
@ -248,8 +248,9 @@ class DefaultMessageListenerContainerTests {
|
|||
private static ConnectionFactory createRecoverableContainerFactory(final int failingAttempts) {
|
||||
try {
|
||||
ConnectionFactory connectionFactory = mock();
|
||||
given(connectionFactory.createConnection()).will(new Answer<Object>() {
|
||||
given(connectionFactory.createConnection()).will(new Answer<>() {
|
||||
int currentAttempts = 0;
|
||||
|
||||
@Override
|
||||
public Object answer(InvocationOnMock invocation) throws Throwable {
|
||||
currentAttempts++;
|
||||
|
|
|
|||
|
|
@ -56,7 +56,8 @@ 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<String>() {}).header("baz", "qux");
|
||||
builder.asyncPart("publisherPtr", publisher, new ParameterizedTypeReference<>() {
|
||||
}).header("baz", "qux");
|
||||
|
||||
MultiValueMap<String, HttpEntity<?>> result = builder.build();
|
||||
|
||||
|
|
|
|||
|
|
@ -169,7 +169,8 @@ class ChannelSendOperatorTests {
|
|||
return Mono.never();
|
||||
});
|
||||
|
||||
operator.subscribe(new BaseSubscriber<Void>() {});
|
||||
operator.subscribe(new BaseSubscriber<>() {
|
||||
});
|
||||
try {
|
||||
writeSubscriber.signalDemand(1); // Let cached signals ("foo" and error) be published..
|
||||
}
|
||||
|
|
|
|||
|
|
@ -166,7 +166,8 @@ class RestClientIntegrationTests {
|
|||
ValueContainer<Pojo> result = this.restClient.get()
|
||||
.uri("/json").accept(MediaType.APPLICATION_JSON)
|
||||
.retrieve()
|
||||
.body(new ParameterizedTypeReference<ValueContainer<Pojo>>() {});
|
||||
.body(new ParameterizedTypeReference<>() {
|
||||
});
|
||||
|
||||
assertThat(result.getContainerValue()).isNotNull();
|
||||
Pojo pojo = result.getContainerValue();
|
||||
|
|
@ -191,7 +192,8 @@ class RestClientIntegrationTests {
|
|||
ValueContainer<List<Pojo>> result = this.restClient.get()
|
||||
.uri("/json").accept(MediaType.APPLICATION_JSON)
|
||||
.retrieve()
|
||||
.body(new ParameterizedTypeReference<ValueContainer<List<Pojo>>>() {});
|
||||
.body(new ParameterizedTypeReference<>() {
|
||||
});
|
||||
|
||||
assertThat(result.containerValue).isNotNull();
|
||||
assertThat(result.containerValue).containsExactly(new Pojo("foofoo", "barbar"));
|
||||
|
|
|
|||
|
|
@ -138,7 +138,8 @@ class BodyExtractorsTests {
|
|||
@Test
|
||||
void toMonoParameterizedTypeReference() {
|
||||
BodyExtractor<Mono<Map<String, String>>, ReactiveHttpInputMessage> extractor =
|
||||
BodyExtractors.toMono(new ParameterizedTypeReference<Map<String, String>>() {});
|
||||
BodyExtractors.toMono(new ParameterizedTypeReference<>() {
|
||||
});
|
||||
|
||||
byte[] bytes = "{\"username\":\"foo\",\"password\":\"bar\"}".getBytes(StandardCharsets.UTF_8);
|
||||
DefaultDataBuffer dataBuffer = DefaultDataBufferFactory.sharedInstance.wrap(ByteBuffer.wrap(bytes));
|
||||
|
|
@ -183,7 +184,8 @@ class BodyExtractorsTests {
|
|||
@Test // SPR-15758
|
||||
void toMonoWithEmptyBodyAndNoContentType() {
|
||||
BodyExtractor<Mono<Map<String, String>>, ReactiveHttpInputMessage> extractor =
|
||||
BodyExtractors.toMono(new ParameterizedTypeReference<Map<String, String>>() {});
|
||||
BodyExtractors.toMono(new ParameterizedTypeReference<>() {
|
||||
});
|
||||
|
||||
MockServerHttpRequest request = MockServerHttpRequest.post("/").body(Flux.empty());
|
||||
Mono<Map<String, String>> result = extractor.extract(request, this.context);
|
||||
|
|
|
|||
|
|
@ -124,7 +124,8 @@ class WebClientDataBufferAllocatingTests extends AbstractDataBufferAllocatingTes
|
|||
Mono<Map<String, String>> mono = this.webClient.get()
|
||||
.uri("/sample").accept(MediaType.APPLICATION_JSON)
|
||||
.retrieve()
|
||||
.bodyToMono(new ParameterizedTypeReference<Map<String, String>>() {});
|
||||
.bodyToMono(new ParameterizedTypeReference<>() {
|
||||
});
|
||||
|
||||
StepVerifier.create(mono).expectError(WebClientResponseException.class).verify(Duration.ofSeconds(3));
|
||||
assertThat(this.server.getRequestCount()).isEqualTo(1);
|
||||
|
|
|
|||
|
|
@ -197,7 +197,8 @@ class WebClientIntegrationTests {
|
|||
Mono<ValueContainer<Pojo>> result = this.webClient.get()
|
||||
.uri("/json").accept(MediaType.APPLICATION_JSON)
|
||||
.retrieve()
|
||||
.bodyToMono(new ParameterizedTypeReference<ValueContainer<Pojo>>() {});
|
||||
.bodyToMono(new ParameterizedTypeReference<>() {
|
||||
});
|
||||
|
||||
StepVerifier.create(result)
|
||||
.assertNext(c -> assertThat(c.getContainerValue()).isEqualTo(new Pojo("foofoo", "barbar")))
|
||||
|
|
@ -804,7 +805,8 @@ class WebClientIntegrationTests {
|
|||
.uri("/greeting")
|
||||
.retrieve()
|
||||
.onStatus(HttpStatusCode::is5xxServerError, response -> Mono.just(new MyException("500 error!")))
|
||||
.bodyToMono(new ParameterizedTypeReference<String>() {});
|
||||
.bodyToMono(new ParameterizedTypeReference<>() {
|
||||
});
|
||||
|
||||
StepVerifier.create(result)
|
||||
.expectError(MyException.class)
|
||||
|
|
|
|||
|
|
@ -318,7 +318,7 @@ public class DefaultServerRequestTests {
|
|||
DefaultServerRequest request = new DefaultServerRequest(MockServerWebExchange.from(mockRequest), messageReaders);
|
||||
|
||||
Mono<Map<String, String>> resultMono = request.bodyToMono(
|
||||
new ParameterizedTypeReference<Map<String, String>>() {
|
||||
new ParameterizedTypeReference<>() {
|
||||
});
|
||||
StepVerifier.create(resultMono)
|
||||
.expectError(ServerWebInputException.class)
|
||||
|
|
|
|||
|
|
@ -100,7 +100,8 @@ class SseHandlerFunctionIntegrationTests extends AbstractRouterFunctionIntegrati
|
|||
.uri("/event")
|
||||
.accept(TEXT_EVENT_STREAM)
|
||||
.retrieve()
|
||||
.bodyToFlux(new ParameterizedTypeReference<ServerSentEvent<String>>() {});
|
||||
.bodyToFlux(new ParameterizedTypeReference<>() {
|
||||
});
|
||||
|
||||
StepVerifier.create(result)
|
||||
.consumeNextWith( event -> {
|
||||
|
|
|
|||
|
|
@ -134,7 +134,8 @@ class SseIntegrationTests extends AbstractHttpHandlerIntegrationTests {
|
|||
.uri("/event")
|
||||
.accept(TEXT_EVENT_STREAM)
|
||||
.retrieve()
|
||||
.bodyToFlux(new ParameterizedTypeReference<ServerSentEvent<Person>>() {});
|
||||
.bodyToFlux(new ParameterizedTypeReference<>() {
|
||||
});
|
||||
|
||||
verifyPersonEvents(result);
|
||||
}
|
||||
|
|
@ -147,7 +148,8 @@ class SseIntegrationTests extends AbstractHttpHandlerIntegrationTests {
|
|||
.uri("/event")
|
||||
.accept(TEXT_EVENT_STREAM)
|
||||
.retrieve()
|
||||
.bodyToFlux(new ParameterizedTypeReference<ServerSentEvent<Person>>() {});
|
||||
.bodyToFlux(new ParameterizedTypeReference<>() {
|
||||
});
|
||||
|
||||
verifyPersonEvents(result);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -60,7 +60,8 @@ class DefaultEntityResponseBuilderTests {
|
|||
void fromObjectTypeReference() {
|
||||
String body = "foo";
|
||||
EntityResponse<String> response = EntityResponse.fromObject(body,
|
||||
new ParameterizedTypeReference<String>() {})
|
||||
new ParameterizedTypeReference<>() {
|
||||
})
|
||||
.build();
|
||||
|
||||
assertThat(response.entity()).isSameAs(body);
|
||||
|
|
|
|||
|
|
@ -265,7 +265,8 @@ class DefaultServerRequestTests {
|
|||
DefaultServerRequest request = new DefaultServerRequest(servletRequest,
|
||||
List.of(new MappingJackson2HttpMessageConverter()));
|
||||
|
||||
List<String> result = request.body(new ParameterizedTypeReference<List<String>>() {});
|
||||
List<String> result = request.body(new ParameterizedTypeReference<>() {
|
||||
});
|
||||
assertThat(result).hasSize(2);
|
||||
assertThat(result).element(0).isEqualTo("foo");
|
||||
assertThat(result).element(1).isEqualTo("bar");
|
||||
|
|
|
|||
|
|
@ -293,7 +293,8 @@ class DefaultServerResponseBuilderTests {
|
|||
List<String> body = new ArrayList<>();
|
||||
body.add("foo");
|
||||
body.add("bar");
|
||||
ServerResponse response = ServerResponse.ok().body(body, new ParameterizedTypeReference<List<String>>() {});
|
||||
ServerResponse response = ServerResponse.ok().body(body, new ParameterizedTypeReference<>() {
|
||||
});
|
||||
|
||||
MockHttpServletRequest mockRequest = new MockHttpServletRequest("GET", "https://example.com");
|
||||
MockHttpServletResponse mockResponse = new MockHttpServletResponse();
|
||||
|
|
|
|||
|
|
@ -291,7 +291,7 @@ class ViewResolverTests {
|
|||
request.setAttribute(DispatcherServlet.WEB_APPLICATION_CONTEXT_ATTRIBUTE, this.wac);
|
||||
request.setAttribute(DispatcherServlet.LOCALE_RESOLVER_ATTRIBUTE, new AcceptHeaderLocaleResolver());
|
||||
View view = vr.resolveViewName("example1", Locale.getDefault());
|
||||
view.render(new HashMap<String, Object>(), request, this.response);
|
||||
view.render(new HashMap<>(), request, this.response);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
@ -327,7 +327,7 @@ class ViewResolverTests {
|
|||
request.setAttribute(DispatcherServlet.WEB_APPLICATION_CONTEXT_ATTRIBUTE, this.wac);
|
||||
request.setAttribute(DispatcherServlet.LOCALE_RESOLVER_ATTRIBUTE, new AcceptHeaderLocaleResolver());
|
||||
View view = vr.resolveViewName("example1", Locale.getDefault());
|
||||
view.render(new HashMap<String, Object>(), request, this.response);
|
||||
view.render(new HashMap<>(), request, this.response);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
|||
|
|
@ -216,7 +216,7 @@ abstract class AbstractSockJsIntegrationTests {
|
|||
CountDownLatch latch = new CountDownLatch(1);
|
||||
initSockJsClient(createWebSocketTransport());
|
||||
this.sockJsClient.doHandshake(handler, this.baseUrl + "/echo").addCallback(
|
||||
new org.springframework.util.concurrent.ListenableFutureCallback<WebSocketSession>() {
|
||||
new org.springframework.util.concurrent.ListenableFutureCallback<>() {
|
||||
@Override
|
||||
public void onSuccess(WebSocketSession result) {
|
||||
}
|
||||
|
|
|
|||
|
|
@ -137,10 +137,11 @@ class RestTemplateXhrTransportTests {
|
|||
|
||||
final CountDownLatch latch = new CountDownLatch(1);
|
||||
connect(restTemplate).addCallback(
|
||||
new org.springframework.util.concurrent.ListenableFutureCallback<WebSocketSession>() {
|
||||
new org.springframework.util.concurrent.ListenableFutureCallback<>() {
|
||||
@Override
|
||||
public void onSuccess(WebSocketSession result) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable ex) {
|
||||
if (ex == expected) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue