Upgrade to spring-javaformat 0.0.11

This commit is contained in:
Andy Wilkinson
2019-06-07 09:44:58 +01:00
parent d548c5ed31
commit 8f1be4cded
1940 changed files with 16814 additions and 28498 deletions

View File

@@ -36,8 +36,7 @@ public class SamplePropertiesValidator implements Validator {
ValidationUtils.rejectIfEmpty(errors, "host", "host.empty");
ValidationUtils.rejectIfEmpty(errors, "port", "port.empty");
SampleProperties properties = (SampleProperties) o;
if (properties.getHost() != null
&& !this.pattern.matcher(properties.getHost()).matches()) {
if (properties.getHost() != null && !this.pattern.matcher(properties.getHost()).matches()) {
errors.rejectValue("host", "Invalid host");
}
}

View File

@@ -49,8 +49,7 @@ public class SamplePropertyValidationApplicationTests {
@Test
public void bindValidProperties() {
this.context.register(SamplePropertyValidationApplication.class);
EnvironmentTestUtils.addEnvironment(this.context, "sample.host:192.168.0.1",
"sample.port:9090");
EnvironmentTestUtils.addEnvironment(this.context, "sample.host:192.168.0.1", "sample.port:9090");
this.context.refresh();
SampleProperties properties = this.context.getBean(SampleProperties.class);
assertThat(properties.getHost()).isEqualTo("192.168.0.1");
@@ -60,8 +59,7 @@ public class SamplePropertyValidationApplicationTests {
@Test
public void bindInvalidHost() {
this.context.register(SamplePropertyValidationApplication.class);
EnvironmentTestUtils.addEnvironment(this.context, "sample.host:xxxxxx",
"sample.port:9090");
EnvironmentTestUtils.addEnvironment(this.context, "sample.host:xxxxxx", "sample.port:9090");
this.thrown.expect(BeanCreationException.class);
this.thrown.expectMessage("xxxxxx");
this.context.refresh();
@@ -80,8 +78,7 @@ public class SamplePropertyValidationApplicationTests {
public void validatorOnlyCalledOnSupportedClass() {
this.context.register(SamplePropertyValidationApplication.class);
this.context.register(ServerProperties.class); // our validator will not apply
EnvironmentTestUtils.addEnvironment(this.context, "sample.host:192.168.0.1",
"sample.port:9090");
EnvironmentTestUtils.addEnvironment(this.context, "sample.host:192.168.0.1", "sample.port:9090");
this.context.refresh();
SampleProperties properties = this.context.getBean(SampleProperties.class);
assertThat(properties.getHost()).isEqualTo("192.168.0.1");