use of com.ctrip.framework.apollo.util.OrderedProperties in project apollo by ctripcorp.
the class DefaultConfigTest method testGetPropertyNamesWithOrderedProperties.
@Test
public void testGetPropertyNamesWithOrderedProperties() {
String someKeyPrefix = "someKey";
String someValuePrefix = "someValue";
when(propertiesFactory.getPropertiesInstance()).thenAnswer(new Answer<Properties>() {
@Override
public Properties answer(InvocationOnMock invocation) {
return new OrderedProperties();
}
});
// set up config repo
someProperties = new OrderedProperties();
for (int i = 0; i < 10; i++) {
someProperties.setProperty(someKeyPrefix + i, someValuePrefix + i);
}
when(configRepository.getConfig()).thenReturn(someProperties);
DefaultConfig defaultConfig = new DefaultConfig(someNamespace, configRepository);
Set<String> propertyNames = defaultConfig.getPropertyNames();
assertEquals(10, propertyNames.size());
assertEquals(someProperties.stringPropertyNames(), propertyNames);
}
Aggregations