PropertySourceChangeSupport { public long load(Map<String, PropertyValue> properties){ Objects.requireNonNull(properties); if(changeSupport==ChangeSupport.SUPPORTED) { Set<String> changedKeys = calculateChangedKeys(this.valueMap, properties); if(!changedKeys.isEmpty()) { this.valueMap = properties; version.incrementAndGet(); fireListeners(changedKeys); } } else { if(!properties.equals(this.valueMap)){ this.valueMap = properties; version.incrementAndGet(); } } return version.get(); } PropertySourceChangeSupport(ChangeSupport changeSupport,
                                       PropertySource propertySource); ChangeSupport getChangeSupport(); String getVersion(); void addChangeListener(BiConsumer<Set<String>, PropertySource> l); void removeChangeListener(BiConsumer<Set<String>, PropertySource> l); void removeAllChangeListeners(); long load(Map<String, PropertyValue> properties); PropertyValue getValue(String key); Map<String, PropertyValue> getProperties(); void scheduleChangeMonitor(Supplier<Map<String, PropertyValue>> propertySupplier, long duration, TimeUnit timeUnit); void cancelSchedule();  }
@Test public void update() { PropertySource ps = BuildablePropertySource.builder().withName("test").build(); PropertySourceChangeSupport support = new PropertySourceChangeSupport(ChangeSupport.IMMUTABLE, ps); assertThatCode(() -> support.load(Collections.emptyMap())).doesNotThrowAnyException(); }