本文整理匯總了Java中rx.observers.TestSubscriber.assertReceivedOnNext方法的典型用法代碼示例。如果您正苦於以下問題:Java TestSubscriber.assertReceivedOnNext方法的具體用法?Java TestSubscriber.assertReceivedOnNext怎麽用?Java TestSubscriber.assertReceivedOnNext使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類rx.observers.TestSubscriber
的用法示例。
在下文中一共展示了TestSubscriber.assertReceivedOnNext方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: setRibots
import rx.observers.TestSubscriber; //導入方法依賴的package包/類
@Test
public void setRibots() {
Ribot ribot1 = TestDataFactory.makeRibot("r1");
Ribot ribot2 = TestDataFactory.makeRibot("r2");
List<Ribot> ribots = Arrays.asList(ribot1, ribot2);
TestSubscriber<Ribot> result = new TestSubscriber<>();
mDatabaseHelper.setRibots(ribots).subscribe(result);
result.assertNoErrors();
result.assertReceivedOnNext(ribots);
Cursor cursor = mDatabaseHelper.getBriteDb()
.query("SELECT * FROM " + Db.RibotProfileTable.TABLE_NAME);
assertEquals(2, cursor.getCount());
for (Ribot ribot : ribots) {
cursor.moveToNext();
assertEquals(ribot.profile(), Db.RibotProfileTable.parseCursor(cursor));
}
}
示例2: iterateAllFilesInApkDirectory
import rx.observers.TestSubscriber; //導入方法依賴的package包/類
@Test
public void iterateAllFilesInApkDirectory() {
File locationActivityFolder = getFolder("de/philipphager/disclosure/smali/apkWithSubdirs");
LibraryParser libraryParser = new LibraryParser(locationActivityFolder);
TestSubscriber<List<Method>> subscriber = new TestSubscriber<>();
libraryParser.findMethodInvocations()
.toBlocking()
.subscribe(subscriber);
// The folder apkWithSubdirs contains the LocationActivity two times,
// but one copy is in a subdirectory. If the subdir was successfully
// parsed, all methods should be found twice.
List<Method> expectedMethods = new ArrayList<>(LocationActivity.INVOKED_METHODS);
expectedMethods.addAll(LocationActivity.INVOKED_METHODS);
subscriber.assertReceivedOnNext(Collections.singletonList(expectedMethods));
subscriber.assertNoErrors();
subscriber.assertCompleted();
}
示例3: fetchLibrariesFromApiAndSaveThem
import rx.observers.TestSubscriber; //導入方法依賴的package包/類
@Test
public void fetchLibrariesFromApiAndSaveThem() {
OffsetDateTime lastUpdated = OffsetDateTime.of(2016, 1, 1, 0, 0, 0, 0, ZoneOffset.UTC);
when(libraryService.lastUpdated()).thenReturn(Observable.just(lastUpdated));
List<Library> newLibraries = Collections.singletonList(MockLibrary.TEST);
when(disclosureApi.allLibraries(any(), anyInt(), anyInt()))
.thenReturn(Observable.just(newLibraries))
.thenReturn(Observable.just(new ArrayList<>()));
TestSubscriber<List<Library>> testSubscriber = new TestSubscriber<>();
syncLibraries.run()
.toBlocking()
.subscribe(testSubscriber);
verify(disclosureApi).allLibraries(lastUpdated, 1, 50);
verify(libraryService).insertOrUpdate(newLibraries);
testSubscriber.assertReceivedOnNext(Collections.singletonList(newLibraries));
testSubscriber.assertNoErrors();
testSubscriber.assertCompleted();
}
示例4: zipTheOutputsOfTwoStreamsAndSubscribeToTheResultingStream
import rx.observers.TestSubscriber; //導入方法依賴的package包/類
@Test public void zipTheOutputsOfTwoStreamsAndSubscribeToTheResultingStream() {
String mockItemOne = "mockItemOne";
String mockItemTwo = "mockItemTwo";
Observable<String> streamOne = Observable.just(mockItemOne);
Observable<String> streamTwo = Observable.just(mockItemTwo);
TestSubscriber<List<String>> testSubscriber = new TestSubscriber<>();
RxUtils.zipMap(streamOne, streamTwo, (s1, s2) -> Observable.just(Arrays.asList(s1, s2)))
.toBlocking()
.subscribe(testSubscriber);
testSubscriber.assertReceivedOnNext(
Collections.singletonList(Arrays.asList(mockItemOne, mockItemTwo)));
testSubscriber.assertNoErrors();
testSubscriber.assertCompleted();
}
示例5: emitNoValuesIfStartEqualsEnd
import rx.observers.TestSubscriber; //導入方法依賴的package包/類
@Test public void emitNoValuesIfStartEqualsEnd() {
TestSubscriber<Integer> testSubscriber = new TestSubscriber<>();
RxUtils.infRange(Integer.MAX_VALUE)
.take(5)
.toBlocking()
.subscribe(testSubscriber);
testSubscriber.assertReceivedOnNext(Collections.EMPTY_LIST);
}
示例6: syncRibotsEmitsValues
import rx.observers.TestSubscriber; //導入方法依賴的package包/類
@Test
public void syncRibotsEmitsValues() {
List<Ribot> ribots = Arrays.asList(TestDataFactory.makeRibot("r1"),
TestDataFactory.makeRibot("r2"));
stubSyncRibotsHelperCalls(ribots);
TestSubscriber<Ribot> result = new TestSubscriber<>();
mDataManager.syncRibots().subscribe(result);
result.assertNoErrors();
result.assertReceivedOnNext(ribots);
}
示例7: testDeliverLatestCacheToViewViewNotReady
import rx.observers.TestSubscriber; //導入方法依賴的package包/類
@Test
public void testDeliverLatestCacheToViewViewNotReady() throws Exception {
mPresenter.create();
TestSubscriber<Integer> testSubscriber = new TestSubscriber<>();
Observable.just(1, 2, 3)
.compose(RxTiPresenterUtils.<Integer>deliverLatestCacheToView(mPresenter))
.subscribe(testSubscriber);
mPresenter.attachView(mView);
testSubscriber.assertNotCompleted();
testSubscriber.assertNoErrors();
testSubscriber.assertReceivedOnNext(Collections.singletonList(3));
}
示例8: testDeliverLatestCacheToViewViewReady
import rx.observers.TestSubscriber; //導入方法依賴的package包/類
@Test
public void testDeliverLatestCacheToViewViewReady() throws Exception {
mPresenter.create();
mPresenter.attachView(mView);
TestSubscriber<Integer> testSubscriber = new TestSubscriber<>();
Observable.just(1, 2, 3)
.compose(RxTiPresenterUtils.<Integer>deliverLatestCacheToView(mPresenter))
.subscribe(testSubscriber);
testSubscriber.assertNotCompleted();
testSubscriber.assertNoErrors();
testSubscriber.assertReceivedOnNext(Arrays.asList(1, 2, 3));
}
示例9: testDeliverLatestToViewViewNotReady
import rx.observers.TestSubscriber; //導入方法依賴的package包/類
@Test
public void testDeliverLatestToViewViewNotReady() throws Exception {
mPresenter.create();
TestSubscriber<Integer> testSubscriber = new TestSubscriber<>();
Observable.just(1, 2, 3)
.compose(RxTiPresenterUtils.<Integer>deliverLatestToView(mPresenter))
.subscribe(testSubscriber);
mPresenter.attachView(mView);
testSubscriber.assertCompleted();
testSubscriber.assertNoErrors();
testSubscriber.assertReceivedOnNext(Collections.singletonList(3));
}
示例10: testDeliverLatestToViewViewReady
import rx.observers.TestSubscriber; //導入方法依賴的package包/類
@Test
public void testDeliverLatestToViewViewReady() throws Exception {
mPresenter.create();
mPresenter.attachView(mView);
TestSubscriber<Integer> testSubscriber = new TestSubscriber<>();
Observable.just(1, 2, 3)
.compose(RxTiPresenterUtils.<Integer>deliverLatestToView(mPresenter))
.subscribe(testSubscriber);
testSubscriber.assertCompleted();
testSubscriber.assertNoErrors();
testSubscriber.assertReceivedOnNext(Arrays.asList(1, 2, 3));
}
示例11: testDeliverToViewViewNotReady
import rx.observers.TestSubscriber; //導入方法依賴的package包/類
@Test
public void testDeliverToViewViewNotReady() throws Exception {
mPresenter.create();
mPresenter.attachView(mView);
TestSubscriber<Integer> testSubscriber = new TestSubscriber<>();
Observable.just(1, 2, 3)
.compose(RxTiPresenterUtils.<Integer>deliverToView(mPresenter))
.subscribe(testSubscriber);
testSubscriber.assertCompleted();
testSubscriber.assertNoErrors();
testSubscriber.assertReceivedOnNext(Arrays.asList(1, 2, 3));
}
示例12: testDeliverToViewViewReady
import rx.observers.TestSubscriber; //導入方法依賴的package包/類
@Test
public void testDeliverToViewViewReady() throws Exception {
mPresenter.create();
mPresenter.attachView(mView);
TestSubscriber<Integer> testSubscriber = new TestSubscriber<>();
Observable.just(1, 2, 3)
.compose(RxTiPresenterUtils.<Integer>deliverToView(mPresenter))
.subscribe(testSubscriber);
testSubscriber.assertCompleted();
testSubscriber.assertNoErrors();
testSubscriber.assertReceivedOnNext(Arrays.asList(1, 2, 3));
}
示例13: shouldGetAllLocations
import rx.observers.TestSubscriber; //導入方法依賴的package包/類
@Test
public void shouldGetAllLocations() throws Exception {
List<PointOfInterest> pointsOfInterest = MockModelsUtil.createListOfMockPointOfInterests(5);
for (PointOfInterest poi : pointsOfInterest) {
mDatabaseHelper.saveLocation(poi).subscribe();
}
TestSubscriber<List<PointOfInterest>> result = new TestSubscriber<>();
mDatabaseHelper.getLocations().subscribe(result);
result.assertNoErrors();
result.assertReceivedOnNext(Collections.singletonList(pointsOfInterest));
}
示例14: findNoMethodsInEmptySmaliFile
import rx.observers.TestSubscriber; //導入方法依賴的package包/類
@Test
public void findNoMethodsInEmptySmaliFile() {
File locationActivityFolder = getFolder("de/philipphager/disclosure/smali/empty");
LibraryParser libraryParser = new LibraryParser(locationActivityFolder);
TestSubscriber<List<Method>> subscriber = new TestSubscriber<>();
libraryParser.findMethodInvocations()
.toBlocking()
.subscribe(subscriber);
subscriber.assertReceivedOnNext(Collections.singletonList(Collections.emptyList()));
subscriber.assertNoErrors();
subscriber.assertCompleted();
}
示例15: loadNoPackagesIfNoneAreInstalled
import rx.observers.TestSubscriber; //導入方法依賴的package包/類
@Test
public void loadNoPackagesIfNoneAreInstalled() {
when(appProvider.getInstalledPackages()).thenReturn(Observable.just(Collections.emptyList()));
when(appService.allInfos()).thenReturn(Observable.just(Collections.emptyList()));
TestSubscriber<List<String>> subscriber = new TestSubscriber<>();
fetchOutdatedPackages.get().subscribe(subscriber);
List<String> noPackages = Collections.emptyList();
subscriber.assertReceivedOnNext(Collections.singletonList(noPackages));
subscriber.assertCompleted();
}