Merge pull request #10636 from izeye:polish-20171014

* pr/10636:
  Polish
This commit is contained in:
Stephane Nicoll 2017-10-17 15:29:56 +02:00
commit 3e18213362
18 changed files with 28 additions and 39 deletions

View File

@ -153,7 +153,7 @@ public class EndpointEnablementProviderTests {
}
@Test
public void defaultEnablementNeutralWebWithTechDisablement() {
public void defaultEnablementNeutralJmxWithTechDisablement() {
EndpointEnablement enablement = getEndpointEnablement("biz",
DefaultEnablement.NEUTRAL, EndpointExposure.JMX,
"endpoints.default.jmx.enabled=false");
@ -177,7 +177,7 @@ public class EndpointEnablementProviderTests {
}
@Test
public void defaultEnablementNeutralWebWithUnrelatedTechDisablement() {
public void defaultEnablementNeutralJmxWithUnrelatedTechDisablement() {
EndpointEnablement enablement = getEndpointEnablement("biz",
DefaultEnablement.NEUTRAL, EndpointExposure.JMX,
"endpoints.default.web.enabled=false");
@ -235,20 +235,20 @@ public class EndpointEnablementProviderTests {
}
private EndpointEnablement getEndpointEnablement(String id,
DefaultEnablement enabledByDefault, String... environment) {
return getEndpointEnablement(id, enabledByDefault, null, environment);
DefaultEnablement defaultEnablement, String... environment) {
return getEndpointEnablement(id, defaultEnablement, null, environment);
}
private EndpointEnablement getEndpointEnablement(String id,
DefaultEnablement enabledByDefault, EndpointExposure exposure,
DefaultEnablement defaultEnablement, EndpointExposure exposure,
String... environment) {
MockEnvironment env = new MockEnvironment();
TestPropertyValues.of(environment).applyTo(env);
EndpointEnablementProvider provider = new EndpointEnablementProvider(env);
if (exposure != null) {
return provider.getEndpointEnablement(id, enabledByDefault, exposure);
return provider.getEndpointEnablement(id, defaultEnablement, exposure);
}
return provider.getEndpointEnablement(id, enabledByDefault);
return provider.getEndpointEnablement(id, defaultEnablement);
}
private void validate(EndpointEnablement enablement, boolean enabled,

View File

@ -89,7 +89,7 @@ public class HealthEndpointAutoConfigurationTests {
}
@Test
public void runWhenEnabledPropertyIsFalseShouldNotHaveEndpointBean()
public void runWhenEnabledPropertyIsFalseShouldNotHaveStatusEndpointBean()
throws Exception {
this.contextRunner.withPropertyValues("endpoints.status.enabled:false").run(
(context) -> assertThat(context).doesNotHaveBean(StatusEndpoint.class));

View File

@ -108,7 +108,7 @@ public class WebFluxEndpointHandlerMapping extends RequestMappingInfoHandlerMapp
/**
* Creates a new {@code WebEndpointHandlerMapping} that provides mappings for the
* operations of the given {@code webEndpoints}.
* @param endpointMapping the path beneath which all endpoints should be mapped
* @param endpointMapping the base mapping for all endpoints
* @param webEndpoints the web endpoints
* @param endpointMediaTypes media types consumed and produced by the endpoints
* @param corsConfiguration the CORS configuration for the endpoints

View File

@ -68,7 +68,7 @@ public class AnnotationEndpointDiscovererTests {
}
@Test
public void endpointIsInParentContextIsDiscovered() {
public void endpointInParentContextIsDiscovered() {
AnnotationConfigApplicationContext parent = new AnnotationConfigApplicationContext(
TestEndpointConfiguration.class);
loadWithParent(parent, EmptyConfiguration.class, hasTestEndpoint());

View File

@ -37,12 +37,12 @@ public class OAuth2ClientProperties {
/**
* OAuth provider details.
*/
private Map<String, Provider> provider = new HashMap<>();
private final Map<String, Provider> provider = new HashMap<>();
/**
* OAuth client registrations.
*/
private Map<String, Registration> registration = new HashMap<>();
private final Map<String, Registration> registration = new HashMap<>();
public Map<String, Provider> getProvider() {
return this.provider;
@ -92,28 +92,28 @@ public class OAuth2ClientProperties {
private String clientSecret;
/**
* Client authentication method. May be left bank then using a pre-defined
* Client authentication method. May be left blank then using a pre-defined
* provider.
*/
private String clientAuthenticationMethod;
/**
* Authorization grant type. May be left bank then using a pre-defined provider.
* Authorization grant type. May be left blank then using a pre-defined provider.
*/
private String authorizationGrantType;
/**
* Redirect URI. May be left bank then using a pre-defined provider.
* Redirect URI. May be left blank then using a pre-defined provider.
*/
private String redirectUri;
/**
* Authorization scopes. May be left bank then using a pre-defined provider.
* Authorization scopes. May be left blank then using a pre-defined provider.
*/
private Set<String> scope;
/**
* Client name. May be left bank then using a pre-defined provider.
* Client name. May be left blank then using a pre-defined provider.
*/
private String clientName;

View File

@ -20,7 +20,7 @@ import org.springframework.boot.diagnostics.AbstractFailureAnalyzer;
import org.springframework.boot.diagnostics.FailureAnalysis;
/**
* A {@link AbstractFailureAnalyzer} for {@link NonUniqueSessionRepositoryException}.
* An {@link AbstractFailureAnalyzer} for {@link NonUniqueSessionRepositoryException}.
*
* @author Stephane Nicoll
*/

View File

@ -29,9 +29,7 @@ import org.apache.tomcat.jdbc.pool.DataSource;
import org.apache.tomcat.jdbc.pool.DataSourceProxy;
import org.apache.tomcat.jdbc.pool.jmx.ConnectionPool;
import org.junit.After;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.springframework.boot.autoconfigure.jmx.JmxAutoConfiguration;
import org.springframework.boot.test.util.TestPropertyValues;
@ -47,9 +45,6 @@ import static org.assertj.core.api.Assertions.assertThat;
*/
public class DataSourceJmxConfigurationTests {
@Rule
public ExpectedException thrown = ExpectedException.none();
private ConfigurableApplicationContext context;
@After

View File

@ -23,9 +23,7 @@ import com.mongodb.MongoCredential;
import com.mongodb.ServerAddress;
import com.mongodb.connection.Cluster;
import com.mongodb.connection.ClusterSettings;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Configuration;
@ -45,9 +43,6 @@ import static org.assertj.core.api.Assertions.assertThat;
*/
public class MongoClientFactoryTests {
@Rule
public ExpectedException thrown = ExpectedException.none();
private MockEnvironment environment = new MockEnvironment();
@Test

View File

@ -48,7 +48,7 @@ public class OAuth2ClientPropertiesRegistrationAdapterTests {
provider.setAuthorizationUri("http://example.com/auth");
provider.setTokenUri("http://example.com/token");
provider.setUserInfoUri("http://example.com/info");
provider.setJwkSetUri("http://example.com/jkw");
provider.setJwkSetUri("http://example.com/jwk");
Registration registration = new Registration();
registration.setProvider("provider");
registration.setClientId("clientId");
@ -69,7 +69,7 @@ public class OAuth2ClientPropertiesRegistrationAdapterTests {
assertThat(adaptedProvider.getTokenUri()).isEqualTo("http://example.com/token");
assertThat(adaptedProvider.getUserInfoEndpoint().getUri())
.isEqualTo("http://example.com/info");
assertThat(adaptedProvider.getJwkSetUri()).isEqualTo("http://example.com/jkw");
assertThat(adaptedProvider.getJwkSetUri()).isEqualTo("http://example.com/jwk");
assertThat(adapted.getRegistrationId()).isEqualTo("registration");
assertThat(adapted.getClientId()).isEqualTo("clientId");
assertThat(adapted.getClientSecret()).isEqualTo("clientSecret");

View File

@ -123,7 +123,7 @@ When you're ready to push your Spring Boot application to production, we've got
<<production-ready-features.adoc#production-ready-customizing-endpoints, Customization>>
* *Connection options:*
<<production-ready-features.adoc#production-ready-monitoring, HTTP>> |
<<production-ready-features.adoc#production-ready-jmx, JMX>> |
<<production-ready-features.adoc#production-ready-jmx, JMX>>
* *Monitoring:*
<<production-ready-features.adoc#production-ready-metrics, Metrics>> |
<<production-ready-features.adoc#production-ready-auditing, Auditing>> |

View File

@ -252,7 +252,7 @@ endif::[]
[[getting-started-installing-the-cli]]
=== Installing the Spring Boot CLI
The Spring Boot CLI is a command line tool that can be used if you want to quickly
prototype with Spring. It allows you to run http://groovy.codehaus.org/[Groovy] scripts,
prototype with Spring. It allows you to run http://groovy-lang.org/[Groovy] scripts,
which means that you have a familiar Java-like syntax, without so much boilerplate code.
You don't need to use the CLI to work with Spring Boot but it's definitely the quickest

View File

@ -581,7 +581,7 @@ The `application.properties` example above will change the endpoint from `/appli
NOTE: Unless the management port has been configured to
<<production-ready-customizing-management-server-port,expose endpoints using a different
HTTP port>>, `management.endpoints.web.base-path` is relative to `server.context-path`. If `management.server.port`
is configured, `management.endpoints.web.base-path`, is relative to `management.server.context-path`.
is configured, `management.endpoints.web.base-path`, is relative to `management.server.servlet.context-path`.

View File

@ -27,7 +27,7 @@ import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
/**
* A {@link AbstractApplicationContextRunner ApplicationContext runner} for a standard,
* An {@link AbstractApplicationContextRunner ApplicationContext runner} for a standard,
* non-web environment {@link ConfigurableApplicationContext}.
* <p>
* See {@link AbstractApplicationContextRunner} for details.

View File

@ -27,7 +27,7 @@ import org.springframework.boot.web.reactive.context.GenericReactiveWebApplicati
import org.springframework.context.ApplicationContext;
/**
* A {@link AbstractApplicationContextRunner ApplicationContext runner} for a
* An {@link AbstractApplicationContextRunner ApplicationContext runner} for a
* {@link ConfigurableReactiveWebApplicationContext}.
* <p>
* See {@link AbstractApplicationContextRunner} for details.

View File

@ -29,7 +29,7 @@ import org.springframework.web.context.WebApplicationContext;
import org.springframework.web.context.support.AnnotationConfigWebApplicationContext;
/**
* A {@link AbstractApplicationContextRunner ApplicationContext runner} for a Servlet
* An {@link AbstractApplicationContextRunner ApplicationContext runner} for a Servlet
* based {@link ConfigurableWebApplicationContext}.
* <p>
* See {@link AbstractApplicationContextRunner} for details.

View File

@ -74,7 +74,6 @@ public class ApplicationContextAssertTests {
@Test
public void hasBeanWhenNotStartedShouldFail() {
this.thrown.expect(AssertionError.class);
this.thrown.expectMessage("failed to start");
this.thrown.expectMessage(String
.format("but context failed to start:%n java.lang.RuntimeException"));
assertThat(getAssert(this.failure)).hasBean("foo");

View File

@ -20,7 +20,7 @@ import org.springframework.boot.configurationsample.DefaultEnablement;
import org.springframework.boot.configurationsample.Endpoint;
/**
* An endpoint that is enabled unless configured explicitly..
* An endpoint that is enabled unless configured explicitly.
*
* @author Stephane Nicoll
*/

View File

@ -52,7 +52,7 @@ class UnresolvedDependenciesAnalyzer {
StringBuilder message = new StringBuilder();
message.append("\nDuring the build, one or more dependencies that were "
+ "declared without a version failed to resolve:\n");
this.dependenciesWithNoVersion.stream()
this.dependenciesWithNoVersion
.forEach((dependency) -> message.append(" " + dependency + "\n"));
message.append("\nDid you forget to apply the "
+ "io.spring.dependency-management plugin to the " + project.getName()