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


Java TestObserver.assertNoValues方法代碼示例

本文整理匯總了Java中io.reactivex.observers.TestObserver.assertNoValues方法的典型用法代碼示例。如果您正苦於以下問題:Java TestObserver.assertNoValues方法的具體用法?Java TestObserver.assertNoValues怎麽用?Java TestObserver.assertNoValues使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在io.reactivex.observers.TestObserver的用法示例。


在下文中一共展示了TestObserver.assertNoValues方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: testGetStreamWithProcessor_notSuccessful

import io.reactivex.observers.TestObserver; //導入方法依賴的package包/類
@Test public void testGetStreamWithProcessor_notSuccessful() {
  mockNotSuccessfulResultForTask(mockStreamDownloadTask, new IllegalStateException());
  when(mockStorageReference.getStream(mockStreamProcessor)).thenReturn(mockStreamDownloadTask);

  TestObserver<StreamDownloadTask.TaskSnapshot> obs = TestObserver.create();

  RxFirebaseStorage.getStream(mockStorageReference, mockStreamProcessor).subscribe(obs);
  verifyAddOnCompleteListenerForTask(mockStreamDownloadTask);

  callOnComplete(mockStreamDownloadTask);
  obs.dispose();

  callOnComplete(mockStreamDownloadTask);

  obs.assertError(IllegalStateException.class);
  obs.assertNoValues();
}
 
開發者ID:b3er,項目名稱:RxFirebase2,代碼行數:18,代碼來源:RxFirebaseStorageTest.java

示例2: testPutFileWithMetadata_notSuccessful

import io.reactivex.observers.TestObserver; //導入方法依賴的package包/類
@Test public void testPutFileWithMetadata_notSuccessful() {
  mockNotSuccessfulResultForTask(mockUploadTask, new IllegalStateException());
  when(mockStorageReference.putFile(mockUri, mockStorageMetadata)).thenReturn(mockUploadTask);

  TestObserver<UploadTask.TaskSnapshot> obs = TestObserver.create();

  RxFirebaseStorage.putFile(mockStorageReference, mockUri, mockStorageMetadata).subscribe(obs);
  verifyAddOnCompleteListenerForTask(mockUploadTask);

  callOnComplete(mockUploadTask);
  obs.dispose();

  callOnComplete(mockUploadTask);

  obs.assertError(IllegalStateException.class);
  obs.assertNoValues();
}
 
開發者ID:b3er,項目名稱:RxFirebase2,代碼行數:18,代碼來源:RxFirebaseStorageTest.java

示例3: testGetStream_notSuccessful

import io.reactivex.observers.TestObserver; //導入方法依賴的package包/類
@Test public void testGetStream_notSuccessful() {
  mockNotSuccessfulResultForTask(mockStreamDownloadTask, new IllegalStateException());
  when(mockStorageReference.getStream()).thenReturn(mockStreamDownloadTask);

  TestObserver<StreamDownloadTask.TaskSnapshot> obs = TestObserver.create();

  RxFirebaseStorage.getStream(mockStorageReference).subscribe(obs);
  verifyAddOnCompleteListenerForTask(mockStreamDownloadTask);

  callOnComplete(mockStreamDownloadTask);
  obs.dispose();

  callOnComplete(mockStreamDownloadTask);

  obs.assertError(IllegalStateException.class);
  obs.assertNoValues();
}
 
開發者ID:b3er,項目名稱:RxFirebase2,代碼行數:18,代碼來源:RxFirebaseStorageTest.java

示例4: testPutStream_notSuccessful

import io.reactivex.observers.TestObserver; //導入方法依賴的package包/類
@Test public void testPutStream_notSuccessful() {
  mockNotSuccessfulResultForTask(mockUploadTask, new IllegalStateException());
  when(mockStorageReference.putStream(mockInputStream)).thenReturn(mockUploadTask);

  TestObserver<UploadTask.TaskSnapshot> obs = TestObserver.create();

  RxFirebaseStorage.putStream(mockStorageReference, mockInputStream).subscribe(obs);
  verifyAddOnCompleteListenerForTask(mockUploadTask);

  callOnComplete(mockUploadTask);
  obs.dispose();

  callOnComplete(mockUploadTask);

  obs.assertError(IllegalStateException.class);
  obs.assertNoValues();
}
 
開發者ID:b3er,項目名稱:RxFirebase2,代碼行數:18,代碼來源:RxFirebaseStorageTest.java

示例5: testGetFile_notSuccessful

import io.reactivex.observers.TestObserver; //導入方法依賴的package包/類
@SuppressWarnings("Duplicates") @Test public void testGetFile_notSuccessful() {
  mockNotSuccessfulResultForTask(mockFileDownloadTask, new IllegalStateException());
  when(mockStorageReference.getFile(mockFile)).thenReturn(mockFileDownloadTask);

  TestObserver<FileDownloadTask.TaskSnapshot> obs = TestObserver.create();

  RxFirebaseStorage.getFile(mockStorageReference, mockFile).subscribe(obs);
  verifyAddOnCompleteListenerForTask(mockFileDownloadTask);

  callOnComplete(mockFileDownloadTask);
  obs.dispose();

  callOnComplete(mockFileDownloadTask);

  obs.assertError(IllegalStateException.class);
  obs.assertNoValues();
}
 
開發者ID:b3er,項目名稱:RxFirebase2,代碼行數:18,代碼來源:RxFirebaseStorageTest.java

示例6: testPutBytes_notSuccessful

import io.reactivex.observers.TestObserver; //導入方法依賴的package包/類
@Test public void testPutBytes_notSuccessful() {
  mockNotSuccessfulResultForTask(mockUploadTask, new IllegalStateException());
  when(mockStorageReference.putBytes(new byte[] { 1, 2, 3 })).thenReturn(mockUploadTask);

  TestObserver<UploadTask.TaskSnapshot> obs = TestObserver.create();

  RxFirebaseStorage.putBytes(mockStorageReference, new byte[] { 1, 2, 3 }).subscribe(obs);
  verifyAddOnCompleteListenerForTask(mockUploadTask);

  callOnComplete(mockUploadTask);
  obs.dispose();

  callOnComplete(mockUploadTask);

  obs.assertError(IllegalStateException.class);
  obs.assertNoValues();
}
 
開發者ID:b3er,項目名稱:RxFirebase2,代碼行數:18,代碼來源:RxFirebaseStorageTest.java

示例7: testGetToken_notSuccessful

import io.reactivex.observers.TestObserver; //導入方法依賴的package包/類
@Test public void testGetToken_notSuccessful() {
  mockNotSuccessfulTokenResult(new IllegalStateException());
  when(mockFirebaseUser.getToken(true)).thenReturn(mockGetTokenTaskResult);

  TestObserver<String> obs = TestObserver.create();

  RxFirebaseUser.getToken(mockFirebaseUser, true).subscribe(obs);

  callOnComplete(mockGetTokenTaskResult);
  obs.dispose();

  // Ensure no more values are emitted after unsubscribe
  callOnComplete(mockGetTokenTaskResult);

  obs.assertError(IllegalStateException.class);
  obs.assertNoValues();
}
 
開發者ID:b3er,項目名稱:RxFirebase2,代碼行數:18,代碼來源:RxFirebaseUserTest.java

示例8: oneEvent

import io.reactivex.observers.TestObserver; //導入方法依賴的package包/類
@Test
public void oneEvent() {
    TestObserver<String> testObserver = Single.just("1")
        .delay(1, TimeUnit.MILLISECONDS, testScheduler)
        .compose(RxLifecycle.<String, String>bind(lifecycle))
        .test();

    testObserver.assertNoValues();
    testObserver.assertNoErrors();

    lifecycle.onNext("stop");
    testScheduler.advanceTimeBy(1, TimeUnit.MILLISECONDS);

    testObserver.assertNoValues();
    testObserver.assertError(CancellationException.class);
}
 
開發者ID:xufreshman,項目名稱:RxLifeCycle,代碼行數:17,代碼來源:UntilLifecycleTransformerSingleTest.java

示例9: testGetFileUri_notSuccessful

import io.reactivex.observers.TestObserver; //導入方法依賴的package包/類
@SuppressWarnings("Duplicates") @Test public void testGetFileUri_notSuccessful() {
  mockNotSuccessfulResultForTask(mockFileDownloadTask, new IllegalStateException());
  when(mockStorageReference.getFile(mockUri)).thenReturn(mockFileDownloadTask);

  TestObserver<FileDownloadTask.TaskSnapshot> obs = TestObserver.create();

  RxFirebaseStorage.getFile(mockStorageReference, mockUri).subscribe(obs);
  verifyAddOnCompleteListenerForTask(mockFileDownloadTask);

  callOnComplete(mockFileDownloadTask);
  obs.dispose();

  callOnComplete(mockFileDownloadTask);

  obs.assertError(IllegalStateException.class);
  obs.assertNoValues();
}
 
開發者ID:b3er,項目名稱:RxFirebase2,代碼行數:18,代碼來源:RxFirebaseStorageTest.java

示例10: testPutFile_notSuccessful

import io.reactivex.observers.TestObserver; //導入方法依賴的package包/類
@Test public void testPutFile_notSuccessful() {
  mockNotSuccessfulResultForTask(mockUploadTask, new IllegalStateException());
  when(mockStorageReference.putFile(mockUri)).thenReturn(mockUploadTask);

  TestObserver<UploadTask.TaskSnapshot> obs = TestObserver.create();

  RxFirebaseStorage.putFile(mockStorageReference, mockUri).subscribe(obs);
  verifyAddOnCompleteListenerForTask(mockUploadTask);

  callOnComplete(mockUploadTask);
  obs.dispose();

  callOnComplete(mockUploadTask);

  obs.assertError(IllegalStateException.class);
  obs.assertNoValues();
}
 
開發者ID:b3er,項目名稱:RxFirebase2,代碼行數:18,代碼來源:RxFirebaseStorageTest.java

示例11: mapToOneIgnoresNullCursor

import io.reactivex.observers.TestObserver; //導入方法依賴的package包/類
@Test public void mapToOneIgnoresNullCursor() {
  Query nully = new Query() {
    @Nullable @Override public Cursor run() {
      return null;
    }
  };

  TestObserver<Employee> observer = new TestObserver<>();
  Observable.just(nully)
      .lift(Query.mapToOne(MAPPER))
      .subscribe(observer);

  observer.assertNoValues();
  observer.assertComplete();
}
 
開發者ID:jiechic,項目名稱:sqlbrite-sqlcipher,代碼行數:16,代碼來源:QueryTest.java

示例12: getRemoteTranslationListObservableIssue

import io.reactivex.observers.TestObserver; //導入方法依賴的package包/類
@Test
public void getRemoteTranslationListObservableIssue() throws Exception {
  MockResponse mockResponse = new MockResponse();
  mockResponse.setResponseCode(500);
  this.mockWebServer.enqueue(mockResponse);

  TestObserver<TranslationList> testObserver = new TestObserver<>();
  this.translationManager.getRemoteTranslationListObservable()
      .subscribe(testObserver);
  testObserver.awaitTerminalEvent();
  testObserver.assertNoValues();
  testObserver.assertError(IOException.class);
}
 
開發者ID:Elias33,項目名稱:Quran,代碼行數:14,代碼來源:TranslationManagerPresenterTest.java

示例13: test_never

import io.reactivex.observers.TestObserver; //導入方法依賴的package包/類
@Test
public void test_never() {
	Observable<String> observable = Observable.never();
	TestObserver<String> testObserver = new TestObserver<>();
	observable.subscribe(testObserver);

	testObserver.assertNoValues();
	testObserver.assertTerminated();
	// testObserver.assertComplete();
}
 
開發者ID:PacktPublishing,項目名稱:Reactive-Programming-With-Java-9,代碼行數:11,代碼來源:Modern_Testing.java

示例14: start_noInteraction_shouldObserveAllTheIntentsAndDoNothingWithView

import io.reactivex.observers.TestObserver; //導入方法依賴的package包/類
@Test
public void start_noInteraction_shouldObserveAllTheIntentsAndDoNothingWithView() {
  // given
  TestObserver<SnackbarMessageEvent> snackbarMessage$ = TestObserver.create();
  given(view.openDrawerIntent$()).willReturn(noTriggers());
  given(view.readAboutIntent$()).willReturn(noTriggers());
  given(view.openProjectOnGitHubIntent$()).willReturn(noTriggers());
  given(view.selectLanguageIntent$()).willReturn(noTriggers());

  DrawerPresenter presenter = new DrawerPresenter(
      "http://foo.com",
      Sink.of(snackbarMessage$),
      urlOpener
  );

  // when
  presenter.start(view);

  // then
  verify(view).openDrawerIntent$();
  verify(view).readAboutIntent$();
  verify(view).openProjectOnGitHubIntent$();
  verify(view).selectLanguageIntent$();
  then(view).shouldHaveNoMoreInteractions();
  then(urlOpener).shouldHaveZeroInteractions();
  snackbarMessage$.assertNoValues();
}
 
開發者ID:xemantic,項目名稱:github-users,代碼行數:28,代碼來源:DrawerPresenterTest.java

示例15: start_openDrawerIntent_shouldOpenTheDrawer

import io.reactivex.observers.TestObserver; //導入方法依賴的package包/類
@Test
public void start_openDrawerIntent_shouldOpenTheDrawer() {
  // given
  TestObserver<SnackbarMessageEvent> snackbarMessage$ = new TestObserver<>();
  PublishSubject<Trigger> openDrawerIntent = PublishSubject.create();
  given(view.openDrawerIntent$()).willReturn(openDrawerIntent);
  given(view.readAboutIntent$()).willReturn(noTriggers());
  given(view.openProjectOnGitHubIntent$()).willReturn(noTriggers());
  given(view.selectLanguageIntent$()).willReturn(noTriggers());
  DrawerPresenter presenter = new DrawerPresenter(
      "http://foo.com", Sink.of(snackbarMessage$), urlOpener
  );
  presenter.start(view);

  // when
  fire(openDrawerIntent);

  // then
  verify(view).openDrawerIntent$();
  verify(view).readAboutIntent$();
  verify(view).openProjectOnGitHubIntent$();
  verify(view).selectLanguageIntent$();
  verify(view).openDrawer(true);
  then(view).shouldHaveNoMoreInteractions();
  then(urlOpener).shouldHaveZeroInteractions();
  snackbarMessage$.assertNoValues();
}
 
開發者ID:xemantic,項目名稱:github-users,代碼行數:28,代碼來源:DrawerPresenterTest.java


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