ReadOnlyProperty { @NonNull public final Optional<T> get() { return getLatest(); } protected  ReadOnlyProperty(@NonNull Observable<T> observable); @NonNull static ReadOnlyProperty<T> create(@NonNull Observable<T> observable); @NonNull final Observable<T> asObservable(); @NonNull final Optional<T> get();  }
@Test public void testGet() { ReadOnlyProperty<Integer> property; property = ReadOnlyProperty.create(Observable.empty()); assertFalse(property.get().isPresent()); property = ReadOnlyProperty.create(Observable.never()); assertFalse(property.get().isPresent()); Integer a = 1; property = ReadOnlyProperty.create(Observable.just(a)); assertTrue(property.get().isPresent()); assertEquals(property.get().get(), a); property = ReadOnlyProperty.create(Observable.just(a).concatWith(Observable.never())); assertTrue(property.get().isPresent()); assertEquals(property.get().get(), a); Integer b = 2; property = ReadOnlyProperty.create(Observable.just(a, b).concatWith(Observable.never())); assertTrue(property.get().isPresent()); assertEquals(property.get().get(), b); }