From 6fbccbe61d0a94c6873e257040e53b4434fb4ba5 Mon Sep 17 00:00:00 2001 From: Phillip Webb Date: Wed, 7 Jan 2015 22:24:32 -0800 Subject: [PATCH] Add a few more binding tests See gh-2304 --- ...tionPropertiesBindingPostProcessorTests.java | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/spring-boot/src/test/java/org/springframework/boot/context/properties/ConfigurationPropertiesBindingPostProcessorTests.java b/spring-boot/src/test/java/org/springframework/boot/context/properties/ConfigurationPropertiesBindingPostProcessorTests.java index a0444c9e09..0249931bd1 100644 --- a/spring-boot/src/test/java/org/springframework/boot/context/properties/ConfigurationPropertiesBindingPostProcessorTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/context/properties/ConfigurationPropertiesBindingPostProcessorTests.java @@ -135,22 +135,25 @@ public class ConfigurationPropertiesBindingPostProcessorTests { @Test public void testPropertyWithEnum() 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)); + doEnumTest("test.theValue:foo"); } @Test public void testRelaxedPropertyWithEnum() throws Exception { + doEnumTest("test.the-value:FoO"); + doEnumTest("TEST_THE_VALUE:FoO"); + doEnumTest("test.THE_VALUE:FoO"); + doEnumTest("test_the_value:FoO"); + } + + private void doEnumTest(String property) { this.context = new AnnotationConfigApplicationContext(); - EnvironmentTestUtils.addEnvironment(this.context, "TEST_THE_VALUE:FoO"); + EnvironmentTestUtils.addEnvironment(this.context, property); this.context.register(PropertyWithEnum.class); this.context.refresh(); assertThat(this.context.getBean(PropertyWithEnum.class).getTheValue(), equalTo(FooEnum.FOO)); + this.context.close(); } @Test