diff --git a/implementation/src/test/java/io/smallrye/config/ConfigMappingInterfaceTest.java b/implementation/src/test/java/io/smallrye/config/ConfigMappingInterfaceTest.java index e69cde9f5..0e05a97aa 100644 --- a/implementation/src/test/java/io/smallrye/config/ConfigMappingInterfaceTest.java +++ b/implementation/src/test/java/io/smallrye/config/ConfigMappingInterfaceTest.java @@ -2288,4 +2288,23 @@ public String convert(final String value) throws IllegalArgumentException, NullP return value.trim(); } } + + @Test + void mapKeyQuotes() { + SmallRyeConfig config = new SmallRyeConfigBuilder() + .withMapping(MapKeyQuotes.class) + // TODO - Default Values does not properly sypport quoted keys due to how NameIterator works + .withSources(config("map.values.\"key.quoted\"", "1234", + "map.values.key.\"quoted\"", "1234")) + .build(); + + MapKeyQuotes mapping = config.getConfigMapping(MapKeyQuotes.class); + assertEquals("1234", mapping.values().get("key.quoted")); + assertEquals("1234", mapping.values().get("key.\"quoted\"")); + } + + @ConfigMapping(prefix = "map") + interface MapKeyQuotes { + Map values(); + } } diff --git a/implementation/src/test/java/io/smallrye/config/NameIteratorTest.java b/implementation/src/test/java/io/smallrye/config/NameIteratorTest.java index a59e96755..eeeabf6c1 100644 --- a/implementation/src/test/java/io/smallrye/config/NameIteratorTest.java +++ b/implementation/src/test/java/io/smallrye/config/NameIteratorTest.java @@ -34,4 +34,14 @@ void previous() { nameIterator.previous(); assertEquals("foo", nameIterator.getNextSegment()); } + + @Test + void quotes() { + NameIterator nameIterator = new NameIterator("one.\"two.three\".four"); + assertEquals("one", nameIterator.getNextSegment()); + nameIterator.next(); + assertEquals("two.three", nameIterator.getNextSegment()); + nameIterator.next(); + assertEquals("four", nameIterator.getNextSegment()); + } }