-
Notifications
You must be signed in to change notification settings - Fork 4
Open
Labels
Description
@Test
public void testSomeFieldsReferToTheSamePropertyName() {
when(configSource.loadConfig()).thenReturn(toConfigProps(mapBuilder().put("prop", "key=value").build()));
ConfigRegistry configRegistry = newConfigRegistry(configSource);
Map<String, String> bindingMap = ImmutableMap.<String, String>builder()
.put("stringProperty", "prop")
.put("stringListProperty", "prop")
.put("stringMultimapProperty", "prop")
.build();
OnePropertyRepresentation objectProperty =
configRegistry.objectProperty(bindingMap, OnePropertyRepresentation.class).value().get();
assertEquals("key=value", objectProperty.stringProperty);
assertEquals(ImmutableList.of("key=value"), objectProperty.stringListProperty);
assertEquals(ImmutableMap.of("key", ImmutableList.of("value")), objectProperty.stringMultimapProperty);
}
public static class OnePropertyRepresentation {
String stringProperty;
List<String> stringListProperty;
Map<String, List<String>> stringMultimapProperty;
}