use of org.springframework.boot.bind.RelaxedBindingNotWritablePropertyException in project spring-boot by spring-projects.
the class ConfigurationPropertiesBindingPostProcessorTests method unknownFieldFailureMessageContainsDetailsOfPropertyOrigin.
@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());
}
}
Aggregations