LeaseConfigChangeHandler implements ConfigChangeHandler { @Override public void apply(Configuration change) { Measure<TimeUnit> measure = Measure.parse(change.getValue().get(), TimeUnit.class); long quantity = measure.to(TimeUnit.MILLISECONDS).getQuantity(); leaseConfiguration.setLeaseLength(quantity); } LeaseConfigChangeHandler(LeaseConfiguration leaseConfiguration); @Override void validate(NodeContext nodeContext, Configuration change); @Override void apply(Configuration change);  }
@Test public void testApplyChange() { LeaseConfiguration leaseConfiguration = new LeaseConfiguration(1000L); LeaseConfigChangeHandler leaseConfigChangeHandler = new LeaseConfigChangeHandler(leaseConfiguration); leaseConfigChangeHandler.apply(set.toConfiguration(topology.getCluster())); assertThat(leaseConfiguration.getLeaseLength(), is(20000L)); }