### Question:
Properties { public static <T, P extends ObservableValue<T>> void whenPropertyIsSet(P property, Consumer<T> doWhenSet) { whenPropertyIsSet(property, () -> doWhenSet.accept(property.getValue())); } private  Properties(); static P newPropertyWithCallback(Supplier<P> propertyFactory, Consumer<T> callback); static void whenPropertyIsSet(P property, Consumer<T> doWhenSet); static void whenPropertyIsSet(P property, Function<A, B> adapter, Consumer<B> doWhenSet); static void bind(ObservableValue<S> from, Function<S, C> adapter, Property<C> to); static void whenPropertyIsSet(P property, Runnable doWhenSet);  }### Answer:
@Test public void awaitCallsDirectlyIfSet() { final Property<Object> valuedProp = new SimpleObjectProperty<>(new Object()); final Property<Object> listener = new SimpleObjectProperty<>(); whenPropertyIsSet(valuedProp, listener::setValue); assertThat(listener.getValue()).isEqualTo(valuedProp.getValue()); }
@Test public void awaitCallsAwaitsSetIfNullOriginally() { final Property<Object> valuedProp = new SimpleObjectProperty<>(); final Property<Object> listener = new SimpleObjectProperty<>(); whenPropertyIsSet(valuedProp, listener::setValue); assertThat(listener.getValue()).isNull(); valuedProp.setValue(new Object()); assertThat(listener.getValue()).isEqualTo(valuedProp.getValue()); }
@Test public void awaitShouldCallConsumerOnEverySetCall() { final Property<Integer> called = new SimpleObjectProperty<>(); final Property<Integer> property = new SimpleObjectProperty<>(); whenPropertyIsSet(property, called::setValue); assertThat(called.getValue()).isNull(); IntStream.range(0, 1000).forEach(value -> { property.setValue(value); assertThat(called.getValue()).isEqualTo(value); }); }