This commit is contained in:
Phillip Webb
2018-01-26 11:38:04 -08:00
parent 62d9d0fd29
commit b234501af3
38 changed files with 142 additions and 134 deletions

View File

@@ -99,7 +99,7 @@ public class BeansEndpointTests {
parentRunner.run((parent) -> {
new ApplicationContextRunner()
.withUserConfiguration(EndpointConfiguration.class).withParent(parent)
.run(child -> {
.run((child) -> {
ApplicationBeans result = child.getBean(BeansEndpoint.class).beans();
assertThat(result.getContexts().get(parent.getId()).getBeans())
.containsKey("bean");

View File

@@ -42,7 +42,7 @@ public class ConfigurationPropertiesReportEndpointParentTests {
.run((parent) -> {
new ApplicationContextRunner()
.withUserConfiguration(ClassConfigurationProperties.class)
.withParent(parent).run(child -> {
.withParent(parent).run((child) -> {
ConfigurationPropertiesReportEndpoint endpoint = child
.getBean(ConfigurationPropertiesReportEndpoint.class);
ApplicationConfigurationProperties applicationProperties = endpoint
@@ -65,7 +65,7 @@ public class ConfigurationPropertiesReportEndpointParentTests {
new ApplicationContextRunner()
.withUserConfiguration(
BeanMethodConfigurationProperties.class)
.withParent(parent).run(child -> {
.withParent(parent).run((child) -> {
ConfigurationPropertiesReportEndpoint endpoint = child
.getBean(ConfigurationPropertiesReportEndpoint.class);
ApplicationConfigurationProperties applicationProperties = endpoint

View File

@@ -159,9 +159,8 @@ public abstract class AbstractWebEndpointIntegrationTests<T extends Configurable
@Test
public void readOperationWithMappingFailureProducesBadRequestResponse() {
load(QueryEndpointConfiguration.class, (client) -> {
WebTestClient.BodyContentSpec body = client.get()
.uri("/query?two=two").exchange().expectStatus().isBadRequest()
.expectBody();
WebTestClient.BodyContentSpec body = client.get().uri("/query?two=two")
.exchange().expectStatus().isBadRequest().expectBody();
validateErrorBody(body, HttpStatus.BAD_REQUEST, "/endpoints/query",
"Missing parameters: one");
});
@@ -282,9 +281,8 @@ public abstract class AbstractWebEndpointIntegrationTests<T extends Configurable
@Test
public void readOperationWithMissingRequiredParametersReturnsBadRequestResponse() {
load(RequiredParameterEndpointConfiguration.class, (client) -> {
WebTestClient.BodyContentSpec body = client.get()
.uri("/requiredparameters").exchange().expectStatus().isBadRequest()
.expectBody();
WebTestClient.BodyContentSpec body = client.get().uri("/requiredparameters")
.exchange().expectStatus().isBadRequest().expectBody();
validateErrorBody(body, HttpStatus.BAD_REQUEST,
"/endpoints/requiredparameters", "Missing parameters: foo");
});
@@ -334,9 +332,8 @@ public abstract class AbstractWebEndpointIntegrationTests<T extends Configurable
protected void validateErrorBody(WebTestClient.BodyContentSpec body,
HttpStatus status, String path, String message) {
body.jsonPath("status").isEqualTo(status.value())
.jsonPath("error").isEqualTo(status.getReasonPhrase())
.jsonPath("path").isEqualTo(path)
body.jsonPath("status").isEqualTo(status.value()).jsonPath("error")
.isEqualTo(status.getReasonPhrase()).jsonPath("path").isEqualTo(path)
.jsonPath("message").isEqualTo(message);
}

View File

@@ -68,8 +68,8 @@ class BaseConfiguration {
ParameterValueMapper parameterMapper = new ConversionServiceParameterValueMapper(
DefaultConversionService.getSharedInstance());
return new WebEndpointDiscoverer(applicationContext, parameterMapper,
endpointMediaTypes(), PathMapper.useEndpointId(),
Collections.emptyList(), Collections.emptyList());
endpointMediaTypes(), PathMapper.useEndpointId(), Collections.emptyList(),
Collections.emptyList());
}
@Bean

View File

@@ -298,9 +298,9 @@ public class WebEndpointDiscovererTests {
Map<WebOperationRequestPredicate, Long> matchCounts = new HashMap<>();
for (WebOperationRequestPredicate predicate : predicates) {
matchCounts.put(predicate, Stream.of(matchers)
.filter(matcher -> matcher.matches(predicate)).count());
.filter((matcher) -> matcher.matches(predicate)).count());
}
return matchCounts.values().stream().noneMatch(count -> count != 1);
return matchCounts.values().stream().noneMatch((count) -> count != 1);
}, Arrays.toString(matchers));
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2017 the original author or authors.
* Copyright 2012-2018 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.
@@ -100,7 +100,7 @@ public class SpringIntegrationMetricsIntegrationTests {
(e) -> e.id("toJson"))
.handle(String.class, this::fahrenheitToCelsius,
(e) -> e.id("temperatureConverter"))
.transform(this::extractResult, e -> e.id("toResponse"));
.transform(this::extractResult, (e) -> e.id("toResponse"));
}
private double extractResult(String json) {