This commit is contained in:
Phillip Webb
2017-07-06 16:52:53 -07:00
parent 222a09cfd3
commit aa57ca7e18
26 changed files with 191 additions and 173 deletions

View File

@@ -107,8 +107,8 @@ public class OAuth2RestOperationsConfiguration {
private final AccessTokenRequest accessTokenRequest;
public ClientContextConfiguration(@Qualifier("accessTokenRequest")
ObjectProvider<AccessTokenRequest> accessTokenRequest) {
public ClientContextConfiguration(
@Qualifier("accessTokenRequest") ObjectProvider<AccessTokenRequest> accessTokenRequest) {
this.accessTokenRequest = accessTokenRequest.getIfAvailable();
}

View File

@@ -93,7 +93,7 @@ public class ResourceProperties implements ResourceLoaderAware {
String[] normalized = new String[staticLocations.length];
for (int i = 0; i < staticLocations.length; i++) {
String location = staticLocations[i];
normalized[i] = location.endsWith("/") ? location : location + "/";
normalized[i] = (location.endsWith("/") ? location : location + "/");
}
return normalized;
}

View File

@@ -76,7 +76,8 @@ public class Neo4jPropertiesTests {
Neo4jProperties properties = load(true,
"spring.data.neo4j.uri=https://localhost:7474");
Configuration configuration = properties.createConfiguration();
assertDriver(configuration, Neo4jProperties.HTTP_DRIVER, "https://localhost:7474");
assertDriver(configuration, Neo4jProperties.HTTP_DRIVER,
"https://localhost:7474");
}
@Test

View File

@@ -47,13 +47,18 @@ public class OAuth2RestOperationsConfigurationTests {
public void clientIdConditionMatches() throws Exception {
EnvironmentTestUtils.addEnvironment(this.environment,
"security.oauth2.client.client-id=acme");
this.context = new SpringApplicationBuilder(OAuth2RestOperationsConfiguration.class).environment(this.environment).web(false).run();
assertThat(this.context.getBean(OAuth2RestOperationsConfiguration.class)).isNotNull();
this.context = new SpringApplicationBuilder(
OAuth2RestOperationsConfiguration.class).environment(this.environment)
.web(false).run();
assertThat(this.context.getBean(OAuth2RestOperationsConfiguration.class))
.isNotNull();
}
@Test
public void clientIdConditionDoesNotMatch() throws Exception {
this.context = new SpringApplicationBuilder(OAuth2RestOperationsConfiguration.class).environment(this.environment).web(false).run();
this.context = new SpringApplicationBuilder(
OAuth2RestOperationsConfiguration.class).environment(this.environment)
.web(false).run();
this.thrown.expect(NoSuchBeanDefinitionException.class);
this.context.getBean(OAuth2RestOperationsConfiguration.class);
}

View File

@@ -63,9 +63,8 @@ public class ResourcePropertiesTests {
@Test
public void customStaticLocationsAreNormalizedToEndWithTrailingSlash() {
this.properties.setStaticLocations(new String[] { "/foo", "/bar", "/baz/" });
assertThat(this.properties.getStaticLocations()).containsExactly("/foo/", "/bar/",
"/baz/");
String[] actual = this.properties.getStaticLocations();
assertThat(actual).containsExactly("/foo/", "/bar/", "/baz/");
}
}