PropertyManager { public <T> T get(PropertyKey<T> key) { return getProvider(key).get(); } PropertyManager(); PropertyListenerHandle<T> addListener(PropertyKey<T> key, PropertyListener<T> listener); void removeListener(PropertyKey<T> key, PropertyListener<T> listener); void setProvider(PropertyKey<T> key, PropertyProvider<T> provider); T get(PropertyKey<T> key); List<PropertyKey<?>> getKeys(); PropertyKey<?> getKey(String name); T set(PropertyKey<T> key, V value); void firePropertyChanged(PropertyKey<T> key, V value, final T oldValue);  }
@Test public void testGetReturnsDefaultValue() { final PropertyKey<String> KEY = PropertyKey.builder("test", String.class).defaultValue("default").build(); final PropertyKey<Integer> KEY2 = PropertyKey.builder("test2", Integer.class).defaultValue(666).build(); PropertyManager pm = new PropertyManager(); assertEquals("default", pm.get(KEY)); assertEquals(666, pm.get(KEY2).intValue()); }