當前位置: 首頁>>代碼示例>>Java>>正文


Java TestSubscriber.assertReceivedOnNext方法代碼示例

本文整理匯總了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));
    }
}
 
開發者ID:ebridfighter,項目名稱:GongXianSheng,代碼行數:20,代碼來源:DatabaseHelperTest.java

示例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();
}
 
開發者ID:philipphager,項目名稱:disclosure-android-app,代碼行數:22,代碼來源:LibraryParserShould.java

示例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();
}
 
開發者ID:philipphager,項目名稱:disclosure-android-app,代碼行數:24,代碼來源:SyncLibrariesShould.java

示例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();
}
 
開發者ID:philipphager,項目名稱:disclosure-android-app,代碼行數:19,代碼來源:RxUtilsShould.java

示例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);
}
 
開發者ID:philipphager,項目名稱:disclosure-android-app,代碼行數:11,代碼來源:RxUtilsShould.java

示例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);
}
 
開發者ID:ebridfighter,項目名稱:GongXianSheng,代碼行數:12,代碼來源:DataManagerTest.java

示例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));
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:16,代碼來源:RxTiPresenterUtilsTest.java

示例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));
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:15,代碼來源:RxTiPresenterUtilsTest.java

示例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));
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:16,代碼來源:RxTiPresenterUtilsTest.java

示例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));
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:15,代碼來源:RxTiPresenterUtilsTest.java

示例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));
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:15,代碼來源:RxTiPresenterUtilsTest.java

示例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));
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:15,代碼來源:RxTiPresenterUtilsTest.java

示例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));
}
 
開發者ID:sathishmscict,項目名稱:Pickr,代碼行數:13,代碼來源:DatabaseHelperTest.java

示例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();
}
 
開發者ID:philipphager,項目名稱:disclosure-android-app,代碼行數:16,代碼來源:LibraryParserShould.java

示例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();
}
 
開發者ID:philipphager,項目名稱:disclosure-android-app,代碼行數:14,代碼來源:FetchOutdatedPackagesShould.java


注:本文中的rx.observers.TestSubscriber.assertReceivedOnNext方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。