@ -1,5 +1,5 @@
/ *
/ *
* Copyright 2012 - 201 4 the original author or authors .
* Copyright 2012 - 201 5 the original author or authors .
*
*
* Licensed under the Apache License , Version 2.0 ( the "License" ) ;
* Licensed under the Apache License , Version 2.0 ( the "License" ) ;
* you may not use this file except in compliance with the License .
* you may not use this file except in compliance with the License .
@ -136,10 +136,20 @@ public class ConfigurationPropertiesBindingPostProcessorTests {
@Test
@Test
public void testPropertyWithEnum ( ) throws Exception {
public void testPropertyWithEnum ( ) throws Exception {
this . context = new AnnotationConfigApplicationContext ( ) ;
this . context = new AnnotationConfigApplicationContext ( ) ;
EnvironmentTestUtils . addEnvironment ( this . context , "test. value:foo") ;
EnvironmentTestUtils . addEnvironment ( this . context , "test. the- value:foo") ;
this . context . register ( PropertyWithEnum . class ) ;
this . context . register ( PropertyWithEnum . class ) ;
this . context . refresh ( ) ;
this . context . refresh ( ) ;
assertThat ( this . context . getBean ( PropertyWithEnum . class ) . getValue ( ) ,
assertThat ( this . context . getBean ( PropertyWithEnum . class ) . getTheValue ( ) ,
equalTo ( FooEnum . FOO ) ) ;
}
@Test
public void testRelaxedPropertyWithEnum ( ) throws Exception {
this . context = new AnnotationConfigApplicationContext ( ) ;
EnvironmentTestUtils . addEnvironment ( this . context , "TEST_THE_VALUE:FoO" ) ;
this . context . register ( PropertyWithEnum . class ) ;
this . context . refresh ( ) ;
assertThat ( this . context . getBean ( PropertyWithEnum . class ) . getTheValue ( ) ,
equalTo ( FooEnum . FOO ) ) ;
equalTo ( FooEnum . FOO ) ) ;
}
}
@ -349,14 +359,14 @@ public class ConfigurationPropertiesBindingPostProcessorTests {
@ConfigurationProperties ( prefix = "test" )
@ConfigurationProperties ( prefix = "test" )
public static class PropertyWithEnum {
public static class PropertyWithEnum {
private FooEnum v alue;
private FooEnum theV alue;
public void set Value( FooEnum value ) {
public void set The Value( FooEnum value ) {
this . v alue = value ;
this . theV alue = value ;
}
}
public FooEnum get Value( ) {
public FooEnum get The Value( ) {
return this . v alue;
return this . theV alue;
}
}
}
}