use of android.support.test.annotation.UiThreadTest in project realm-java by realm.
the class RxJavaTests method realm_closeInDoOnUnsubscribe.
@Test
@UiThreadTest
public void realm_closeInDoOnUnsubscribe() {
Observable<Realm> observable = realm.asObservable().doOnUnsubscribe(new Action0() {
@Override
public void call() {
realm.close();
}
});
subscription = observable.subscribe(new Action1<Realm>() {
@Override
public void call(Realm rxRealm) {
}
});
subscription.unsubscribe();
assertTrue(realm.isClosed());
}
use of android.support.test.annotation.UiThreadTest in project realm-java by realm.
the class RxJavaTests method realmObject_closeInDoOnUnsubscribe.
@Test
@UiThreadTest
public void realmObject_closeInDoOnUnsubscribe() {
realm.beginTransaction();
realm.createObject(AllTypes.class);
realm.commitTransaction();
Observable<AllTypes> observable = realm.where(AllTypes.class).findFirst().<AllTypes>asObservable().doOnUnsubscribe(new Action0() {
@Override
public void call() {
realm.close();
}
});
subscription = observable.subscribe(new Action1<AllTypes>() {
@Override
public void call(AllTypes allTypes) {
}
});
subscription.unsubscribe();
assertTrue(realm.isClosed());
}
use of android.support.test.annotation.UiThreadTest in project RxBinding by JakeWharton.
the class RxActionMenuViewTest method itemClicks.
@Test
@UiThreadTest
public void itemClicks() {
Menu menu = view.getMenu();
MenuItem item1 = menu.add(0, 1, 0, "Hi");
MenuItem item2 = menu.add(0, 2, 0, "Hey");
RecordingObserver<MenuItem> o = new RecordingObserver<>();
RxActionMenuView.itemClicks(view).subscribe(o);
o.assertNoMoreEvents();
menu.performIdentifierAction(2, 0);
assertSame(item2, o.takeNext());
menu.performIdentifierAction(1, 0);
assertSame(item1, o.takeNext());
o.dispose();
menu.performIdentifierAction(2, 0);
o.assertNoMoreEvents();
}
use of android.support.test.annotation.UiThreadTest in project RxBinding by JakeWharton.
the class RxPopupMenuTest method itemClicks.
@Test
@UiThreadTest
public void itemClicks() {
Menu menu = view.getMenu();
MenuItem item1 = menu.add(0, 1, 0, "Hi");
MenuItem item2 = menu.add(0, 2, 0, "Hey");
RecordingObserver<MenuItem> o = new RecordingObserver<>();
RxPopupMenu.itemClicks(view).subscribe(o);
o.assertNoMoreEvents();
menu.performIdentifierAction(2, 0);
assertSame(item2, o.takeNext());
menu.performIdentifierAction(1, 0);
assertSame(item1, o.takeNext());
o.dispose();
menu.performIdentifierAction(2, 0);
o.assertNoMoreEvents();
}
use of android.support.test.annotation.UiThreadTest in project RxBinding by JakeWharton.
the class RxTabLayoutTest method selectionEventsNoInitial.
@Test
@UiThreadTest
public void selectionEventsNoInitial() {
TabLayout empty = new TabLayout(context);
RecordingObserver<TabLayoutSelectionEvent> o = new RecordingObserver<>();
RxTabLayout.selectionEvents(empty).subscribe(o);
o.assertNoMoreEvents();
}
Aggregations