PropertyProviderImpl implements PropertyProvider { @SuppressWarnings("unchecked") @Override public Object getProperty(Object object, String propertyName) { Function<Object, Object> provider = (Function<Object, Object>) propertyProviders.get(propertyName); Preconditions.checkNotNull(provider, "Cannot find property '%s' for %s", propertyName, object); return provider.apply(object); }  @Override boolean hasProperty(String propertyName); @SuppressWarnings("unchecked") @Override Object getProperty(Object object, String propertyName); @Override void register(String property, Function<?, Object> function);  }
@Test void getProperty() { provider.register(PROPERTY, key -> VALUE); assertEquals(VALUE, provider.getProperty(null, PROPERTY)); }