TrialAppPropertiesManager implements AppPropertiesManager { @Override public AppProperties loadProps(List<String> configUris) { Map<String, String> map = readAllConfigs(configUris); return buildConfig(map); }  @Override AppProperties loadProps(List<String> configUris); @Override void printProperties(AppProperties props, PrintStream sync); void setValueParser(PropertyValueParser valueParser); void addLoader(StringPairLoader loader); void setDefinitionsManager(PropertyDefinitionsManager definitionsManager);  }
@Test public void normalFlow() { AppProperties props = target.loadProps(Arrays.asList("test:test")); assertEquals(1, props.get("key1")); }
@Test public void overrideProperties() { when(mockLoader.load("test:test2")).thenReturn(singletonMap("key1", "2")); AppProperties props = target.loadProps(Arrays.asList("test:test", "test:test2")); assertEquals(2, props.get("key1")); }
@Test public void overrideWithEmpty() { when(mockLoader.load("test:test2")).thenReturn(singletonMap("key1", "")); AppProperties props = target.loadProps(Arrays.asList("test:test", "test:test2")); assertNull(props.get("key1")); }
@Test public void incompatibleValueForDatatype() { when(mockLoader.load("test:test")).thenReturn(singletonMap("key1", "aa")); AppProperties props = target.loadProps(Arrays.asList("test:test")); assertNull(props.get("key1")); }
@Test public void overrideWithInvalid() { when(mockLoader.load("test:test2")).thenReturn(singletonMap("key1", "aa")); AppProperties props = target.loadProps(Arrays.asList("test:test", "test:test2")); assertNull(props.get("key1")); }
@Test public void missingProperties() { definitions.put("key2", new PropertyDefinition("key2", PropertyType.STRING)); when(mockLoader.load("test:test")).thenReturn(singletonMap("key1", "aa")); AppProperties props = target.loadProps(Arrays.asList("test:test")); assertThat(props.getMissingProperties(), hasItem("key2")); }
@Test public void additionalPropertiesNotDefined() { when(mockLoader.load("test:test")).thenReturn(singletonMap("key2", "aa")); AppProperties props = target.loadProps(Arrays.asList("test:test")); assertNull(props.get("key2")); }