@Test(expected = AssertionError.class) public void itThrowsIfObserverCallsFromActivityFromBackgroundThread() throws Throwable { final Future<Object> future = Executors.newSingleThreadExecutor().submit(new Callable<Object>() { @Override public Object call() throws Error { AppObservable.bindActivity(activity, Observable.empty()); return null; } }); try { future.get(1, TimeUnit.SECONDS); } catch (ExecutionException e) { throw e.getCause(); } }
public static <T> Observable<T> bindActivity(Activity activity, Observable<T> source) { Assertions.assertUiThread(); return source.observeOn(mainThread()) .lift(new OperatorConditionalBinding<T, Activity>(activity, ACTIVITY_VALIDATOR)); }
AppObservable { public static <T> Observable<T> bindActivity(Activity activity, Observable<T> source) { Assertions.assertUiThread(); return source.observeOn(mainThread()) .lift(new OperatorConditionalBinding<T, Activity>(activity, ACTIVITY_VALIDATOR)); } }
AppObservable { public static <T> Observable<T> bindActivity(Activity activity, Observable<T> source) { Assertions.assertUiThread(); return source.observeOn(mainThread()) .lift(new OperatorConditionalBinding<T, Activity>(activity, ACTIVITY_VALIDATOR)); } private  AppObservable(); }
AppObservable { public static <T> Observable<T> bindActivity(Activity activity, Observable<T> source) { Assertions.assertUiThread(); return source.observeOn(mainThread()) .lift(new OperatorConditionalBinding<T, Activity>(activity, ACTIVITY_VALIDATOR)); } private  AppObservable(); static Observable<T> bindActivity(Activity activity, Observable<T> source); static Observable<T> bindFragment(Fragment fragment, Observable<T> source); static Observable<T> bindSupportFragment(android.support.v4.app.Fragment fragment, Observable<T> source); }
AppObservable { public static <T> Observable<T> bindActivity(Activity activity, Observable<T> source) { Assertions.assertUiThread(); return source.observeOn(mainThread()) .lift(new OperatorConditionalBinding<T, Activity>(activity, ACTIVITY_VALIDATOR)); } private  AppObservable(); static Observable<T> bindActivity(Activity activity, Observable<T> source); static Observable<T> bindFragment(Fragment fragment, Observable<T> source); static Observable<T> bindSupportFragment(android.support.v4.app.Fragment fragment, Observable<T> source);  }