LazyEvaluation { public T getLatestValue() { if (replaySubject.hasValue()) { return replaySubject.getValue(); } else { throw new RuntimeException("Result not set"); } } LazyEvaluation(); void addCallback(Consumer<T> fn); void addCallbacks(List<Consumer<T>> callbacks); void addValue(T v); T getLatestValue();  }
@Test(expected = RuntimeException.class) public void testExceptionNoValue() { LazyEvaluation<Long> lazyLong = new LazyEvaluation<>(); lazyLong.getLatestValue(); System.out.println("latest value: " + lazyLong.getLatestValue()); }