Polish
This commit is contained in:
@@ -49,8 +49,8 @@ public class SamplePropertyValidationApplicationTests {
|
||||
@Test
|
||||
public void bindValidProperties() {
|
||||
this.context.register(SamplePropertyValidationApplication.class);
|
||||
TestPropertyValues.of("sample.host:192.168.0.1",
|
||||
"sample.port:9090").applyTo(this.context);
|
||||
TestPropertyValues.of("sample.host:192.168.0.1", "sample.port:9090")
|
||||
.applyTo(this.context);
|
||||
this.context.refresh();
|
||||
SampleProperties properties = this.context.getBean(SampleProperties.class);
|
||||
assertThat(properties.getHost()).isEqualTo("192.168.0.1");
|
||||
@@ -60,8 +60,8 @@ public class SamplePropertyValidationApplicationTests {
|
||||
@Test
|
||||
public void bindInvalidHost() {
|
||||
this.context.register(SamplePropertyValidationApplication.class);
|
||||
TestPropertyValues.of("sample.host:xxxxxx",
|
||||
"sample.port:9090").applyTo(this.context);
|
||||
TestPropertyValues.of("sample.host:xxxxxx", "sample.port:9090")
|
||||
.applyTo(this.context);
|
||||
this.thrown.expect(BeanCreationException.class);
|
||||
this.thrown.expectMessage("Failed to bind properties under 'sample'");
|
||||
this.context.refresh();
|
||||
@@ -79,8 +79,8 @@ public class SamplePropertyValidationApplicationTests {
|
||||
public void validatorOnlyCalledOnSupportedClass() {
|
||||
this.context.register(SamplePropertyValidationApplication.class);
|
||||
this.context.register(ServerProperties.class); // our validator will not apply
|
||||
TestPropertyValues.of("sample.host:192.168.0.1",
|
||||
"sample.port:9090").applyTo(this.context);
|
||||
TestPropertyValues.of("sample.host:192.168.0.1", "sample.port:9090")
|
||||
.applyTo(this.context);
|
||||
this.context.refresh();
|
||||
SampleProperties properties = this.context.getBean(SampleProperties.class);
|
||||
assertThat(properties.getHost()).isEqualTo("192.168.0.1");
|
||||
|
||||
Reference in New Issue
Block a user