@Test
public void testInvalidationEfficiency() {

    StringProperty s1 = new SimpleStringProperty("a");
    StringProperty s2 = new SimpleStringProperty("b");
    StringProperty s3 = new SimpleStringProperty("c");
    Val<String> firstNonNull = Val.orElse(s1, s2).orElse(s3);
    Counter invalidationCounter = new Counter();
    firstNonNull.addListener(obs -> invalidationCounter.inc());
    assertEquals(0, invalidationCounter.get());
    firstNonNull.getValue();
    assertEquals(0, invalidationCounter.get());
    s2.set("B");
    assertEquals(0, invalidationCounter.get());
    s3.set("C");
    assertEquals(0, invalidationCounter.get());
    s1.set("A");
    assertEquals(1, invalidationCounter.getAndReset());
}