Java 类org.springframework.boot.bind.RelaxedBindingNotWritablePropertyException 实例源码
项目:https-github.com-g0t4-jenkins2-course-spring-boot
文件:ConfigurationPropertiesBindingPostProcessorTests.java
@Test
public void unknownFieldFailureMessageContainsDetailsOfPropertyOrigin() {
this.context = new AnnotationConfigApplicationContext();
TestPropertySourceUtils.addInlinedPropertiesToEnvironment(this.context,
"com.example.baz=spam");
this.context.register(TestConfiguration.class);
try {
this.context.refresh();
fail("Expected exception");
}
catch (BeanCreationException ex) {
RelaxedBindingNotWritablePropertyException bex = (RelaxedBindingNotWritablePropertyException) ex
.getRootCause();
assertThat(bex.getMessage())
.startsWith("Failed to bind 'com.example.baz' from '"
+ TestPropertySourceUtils.INLINED_PROPERTIES_PROPERTY_SOURCE_NAME
+ "' to 'baz' " + "property on '"
+ TestConfiguration.class.getName());
}
}
项目:spring-boot-concourse
文件:ConfigurationPropertiesBindingPostProcessorTests.java
@Test
public void unknownFieldFailureMessageContainsDetailsOfPropertyOrigin() {
this.context = new AnnotationConfigApplicationContext();
TestPropertySourceUtils.addInlinedPropertiesToEnvironment(this.context,
"com.example.baz=spam");
this.context.register(TestConfiguration.class);
try {
this.context.refresh();
fail("Expected exception");
}
catch (BeanCreationException ex) {
RelaxedBindingNotWritablePropertyException bex = (RelaxedBindingNotWritablePropertyException) ex
.getRootCause();
assertThat(bex.getMessage())
.startsWith("Failed to bind 'com.example.baz' from '"
+ TestPropertySourceUtils.INLINED_PROPERTIES_PROPERTY_SOURCE_NAME
+ "' to 'baz' " + "property on '"
+ TestConfiguration.class.getName());
}
}
项目:contestparser
文件:ConfigurationPropertiesBindingPostProcessorTests.java
@Test
public void unknownFieldFailureMessageContainsDetailsOfPropertyOrigin() {
this.context = new AnnotationConfigApplicationContext();
EnvironmentTestUtils.addEnvironment(this.context, "com.example.baz:spam");
this.context.register(TestConfiguration.class);
try {
this.context.refresh();
fail("Expected exception");
}
catch (BeanCreationException ex) {
RelaxedBindingNotWritablePropertyException bex = (RelaxedBindingNotWritablePropertyException) ex
.getRootCause();
assertThat(bex.getMessage(),
startsWith("Failed to bind 'com.example.baz' from 'test' to 'baz' "
+ "property on '" + TestConfiguration.class.getName()));
}
}