Use modern language features in tests

This commit is contained in:
Sam Brannen
2022-02-03 14:50:10 +01:00
parent 82a2544918
commit f8a5a8d7be
91 changed files with 577 additions and 1059 deletions

View File

@@ -111,7 +111,7 @@ public class BodyExtractorsTests {
return hints;
}
};
this.hints = new HashMap<String, Object>();
this.hints = new HashMap<>();
}

View File

@@ -36,7 +36,6 @@ import org.springframework.util.MultiValueMap;
import org.springframework.web.server.ResponseStatusException;
import org.springframework.web.server.ServerWebExchange;
import org.springframework.web.server.WebFilter;
import org.springframework.web.server.WebFilterChain;
import org.springframework.web.testfixture.http.server.reactive.MockServerHttpRequest;
import org.springframework.web.testfixture.http.server.reactive.MockServerHttpResponse;
import org.springframework.web.testfixture.server.MockServerWebExchange;
@@ -295,12 +294,9 @@ public class RouterFunctionsTests {
public void toHttpHandlerWebFilter() {
AtomicBoolean filterInvoked = new AtomicBoolean();
WebFilter webFilter = new WebFilter() {
@Override
public Mono<Void> filter(ServerWebExchange exchange, WebFilterChain chain) {
filterInvoked.set(true);
return chain.filter(exchange);
}
WebFilter webFilter = (exchange, chain) -> {
filterInvoked.set(true);
return chain.filter(exchange);
};
HandlerFunction<ServerResponse> handlerFunction = request -> ServerResponse.accepted().build();

View File

@@ -164,7 +164,7 @@ public class ResourceUrlProviderTests {
private Condition<PathPattern> pathPatternStringOf(String expected) {
return new Condition<PathPattern>(
return new Condition<>(
actual -> actual != null && actual.getPatternString().equals(expected),
"Pattern %s", expected);
}