Commit fac04c12 authored by Stephane Nicoll's avatar Stephane Nicoll

Add test

#3386 was actually fixed as part of #2387. Add the test that used to
reproduce the issue.
parent 051dd4da
...@@ -56,6 +56,7 @@ import static org.hamcrest.Matchers.equalTo; ...@@ -56,6 +56,7 @@ import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.nullValue; import static org.hamcrest.Matchers.nullValue;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull; import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertThat; import static org.junit.Assert.assertThat;
...@@ -64,6 +65,7 @@ import static org.junit.Assert.assertThat; ...@@ -64,6 +65,7 @@ import static org.junit.Assert.assertThat;
* *
* @author Dave Syer * @author Dave Syer
* @author Phillip Webb * @author Phillip Webb
* @author Stephane Nicoll
*/ */
public class RelaxedDataBinderTests { public class RelaxedDataBinderTests {
...@@ -346,6 +348,22 @@ public class RelaxedDataBinderTests { ...@@ -346,6 +348,22 @@ public class RelaxedDataBinderTests {
assertEquals("123", target.getNested().get("foo.value")); assertEquals("123", target.getNested().get("foo.value"));
} }
@SuppressWarnings("unchecked")
@Test
public void testBindDoubleNestedMapWithDotInKeys() throws Exception {
TargetWithNestedMap target = new TargetWithNestedMap();
bind(target, "nested.foo: bar.key\n" + "nested[bar.key].spam: bucket\n"
+ "nested[bar.key].value: 123\nnested[bar.key].foo: crap");
assertEquals(2, target.getNested().size());
Map<String, Object> nestedMap = (Map<String, Object>) target.getNested().get("bar.key");
assertNotNull("nested map should be registered with 'bar.key'", nestedMap);
assertEquals(3, nestedMap.size());
assertEquals("123",
nestedMap.get("value"));
assertEquals("bar.key", target.getNested().get("foo"));
assertFalse(target.getNested().containsValue(target.getNested()));
}
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@Test @Test
public void testBindDoubleNestedMap() throws Exception { public void testBindDoubleNestedMap() throws Exception {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment