Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exception occurred when a few fields refer to the same property name #36

Open
segabriel opened this issue Dec 11, 2017 · 0 comments
Open
Labels

Comments

@segabriel
Copy link
Member

  @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;
  }
@artem-v artem-v added the bug label Dec 13, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants