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


Java TestSubscriber.assertNotTerminated方法代碼示例

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


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

示例1: testBuffers_output

import io.reactivex.subscribers.TestSubscriber; //導入方法依賴的package包/類
@Test
public void testBuffers_output() {
    String uuid = UUID.randomUUID().toString();
    when(cmd.getMarker()).thenReturn(uuid);
    when(cmd.isOutputBufferEnabled()).thenReturn(true);

    TestSubscriber<OutputHarvester.Crop> testSubscriber = publisher.compose(harvesterFactory.forOutput(publisher, cmd)).test();
    testSubscriber.assertNotTerminated();

    publisher.onNext("some-output");
    publisher.onNext(uuid + " 255");

    testSubscriber.assertValueCount(1).assertComplete();

    Harvester.Crop crop = testSubscriber.values().get(0);
    assertThat(crop.buffer.size(), is(1));
    assertThat(crop.buffer, Matchers.contains("some-output"));
}
 
開發者ID:d4rken,項目名稱:RxShell,代碼行數:19,代碼來源:HarvesterTest.java

示例2: testBuffers_error

import io.reactivex.subscribers.TestSubscriber; //導入方法依賴的package包/類
@Test
public void testBuffers_error() {
    String uuid = UUID.randomUUID().toString();
    when(cmd.getMarker()).thenReturn(uuid);
    when(cmd.isErrorBufferEnabled()).thenReturn(true);

    TestSubscriber<Harvester.Crop> testSubscriber = publisher.compose(harvesterFactory.forError(publisher, cmd)).test();
    testSubscriber.assertNotTerminated();

    publisher.onNext("some-errors");
    publisher.onNext(uuid + " 255");

    testSubscriber.assertValueCount(1).assertComplete();

    Harvester.Crop crop = testSubscriber.values().get(0);
    assertThat(crop.buffer.size(), is(1));
    assertThat(crop.buffer, Matchers.contains("some-errors"));
}
 
開發者ID:d4rken,項目名稱:RxShell,代碼行數:19,代碼來源:HarvesterTest.java

示例3: testUpstreamPrematureCompletion_output

import io.reactivex.subscribers.TestSubscriber; //導入方法依賴的package包/類
@Test
public void testUpstreamPrematureCompletion_output() {
    String uuid = UUID.randomUUID().toString();
    when(cmd.getMarker()).thenReturn(uuid);
    when(cmd.isOutputBufferEnabled()).thenReturn(true);

    TestSubscriber<OutputHarvester.Crop> testSubscriber = publisher.compose(harvesterFactory.forOutput(publisher, cmd)).test();
    testSubscriber.assertNotTerminated();

    publisher.onNext("some-output");
    publisher.onComplete();

    OutputHarvester.Crop crop = testSubscriber.assertValueCount(1).assertComplete().values().get(0);
    assertThat(crop.isComplete, is(false));
    assertThat(crop.exitCode, is(Cmd.ExitCode.INITIAL));
    assertThat(crop.buffer.size(), is(1));
    assertThat(crop.buffer, contains("some-output"));
}
 
開發者ID:d4rken,項目名稱:RxShell,代碼行數:19,代碼來源:HarvesterTest.java

示例4: testUpstreamPrematureCompletion_errors

import io.reactivex.subscribers.TestSubscriber; //導入方法依賴的package包/類
@Test
public void testUpstreamPrematureCompletion_errors() {
    String uuid = UUID.randomUUID().toString();
    when(cmd.getMarker()).thenReturn(uuid);
    when(cmd.isErrorBufferEnabled()).thenReturn(true);

    TestSubscriber<Harvester.Crop> testSubscriber = publisher.compose(harvesterFactory.forError(publisher, cmd)).test();
    testSubscriber.assertNotTerminated();

    publisher.onNext("some-errors");
    publisher.onComplete();

    ErrorHarvester.Crop crop = testSubscriber.assertValueCount(1).assertComplete().values().get(0);
    assertThat(crop.isComplete, is(false));
    assertThat(crop.buffer.size(), is(1));
    assertThat(crop.buffer, contains("some-errors"));
}
 
開發者ID:d4rken,項目名稱:RxShell,代碼行數:18,代碼來源:HarvesterTest.java

示例5: testCommandCompletion_output

import io.reactivex.subscribers.TestSubscriber; //導入方法依賴的package包/類
@Test
public void testCommandCompletion_output() {
    String uuid = UUID.randomUUID().toString();
    when(cmd.getMarker()).thenReturn(uuid);

    TestSubscriber<OutputHarvester.Crop> testSubscriber = publisher.compose(harvesterFactory.forOutput(publisher, cmd)).test();
    testSubscriber.assertNotTerminated();

    publisher.onNext(uuid + " 255");

    testSubscriber.assertValueCount(1).assertComplete();

    OutputHarvester.Crop crop = testSubscriber.values().get(0);
    assertThat(crop.exitCode, is(255));
}
 
開發者ID:d4rken,項目名稱:RxShell,代碼行數:16,代碼來源:HarvesterTest.java

示例6: testCommandCompletion_errors

import io.reactivex.subscribers.TestSubscriber; //導入方法依賴的package包/類
@Test
public void testCommandCompletion_errors() {
    String uuid = UUID.randomUUID().toString();
    when(cmd.getMarker()).thenReturn(uuid);

    TestSubscriber<Harvester.Crop> testSubscriber = publisher.compose(harvesterFactory.forError(publisher, cmd)).test();
    testSubscriber.assertNotTerminated();

    publisher.onNext(uuid);

    testSubscriber.assertValueCount(1).assertComplete();
}
 
開發者ID:d4rken,項目名稱:RxShell,代碼行數:13,代碼來源:HarvesterTest.java

示例7: testDownstreamCancel_output

import io.reactivex.subscribers.TestSubscriber; //導入方法依賴的package包/類
@Test
public void testDownstreamCancel_output() throws InterruptedException {
    CountDownLatch latch = new CountDownLatch(1);
    TestSubscriber<OutputHarvester.Crop> testSubscriber = publisher.doOnCancel(latch::countDown).compose(harvesterFactory.forOutput(publisher, cmd)).test();
    testSubscriber.assertNotTerminated();

    testSubscriber.dispose();

    assertThat(latch.await(1, TimeUnit.SECONDS), is(true));
}
 
開發者ID:d4rken,項目名稱:RxShell,代碼行數:11,代碼來源:HarvesterTest.java

示例8: testDownstreamCancel_errors

import io.reactivex.subscribers.TestSubscriber; //導入方法依賴的package包/類
@Test
public void testDownstreamCancel_errors() throws InterruptedException {
    CountDownLatch latch = new CountDownLatch(1);
    TestSubscriber<OutputHarvester.Crop> testSubscriber = publisher.doOnCancel(latch::countDown).compose(harvesterFactory.forOutput(publisher, cmd)).test();
    testSubscriber.assertNotTerminated();

    testSubscriber.dispose();

    assertThat(latch.await(1, TimeUnit.SECONDS), is(true));
}
 
開發者ID:d4rken,項目名稱:RxShell,代碼行數:11,代碼來源:HarvesterTest.java

示例9: testBadMarker_output

import io.reactivex.subscribers.TestSubscriber; //導入方法依賴的package包/類
@Test
public void testBadMarker_output() {
    String uuid = UUID.randomUUID().toString();
    when(cmd.getMarker()).thenReturn(uuid);

    TestSubscriber<OutputHarvester.Crop> testSubscriber = publisher.compose(harvesterFactory.forOutput(publisher, cmd)).test();
    testSubscriber.assertNotTerminated();

    publisher.onNext(uuid + " &/()");

    testSubscriber.awaitDone(1, TimeUnit.SECONDS).assertNoTimeout();
    OutputHarvester.Crop crop = testSubscriber.values().get(0);
    assertThat(crop.exitCode, is(Cmd.ExitCode.EXCEPTION));
}
 
開發者ID:d4rken,項目名稱:RxShell,代碼行數:15,代碼來源:HarvesterTest.java

示例10: testBadMarker_errors

import io.reactivex.subscribers.TestSubscriber; //導入方法依賴的package包/類
@Test
public void testBadMarker_errors() {
    String uuid = UUID.randomUUID().toString();
    when(cmd.getMarker()).thenReturn(uuid);

    TestSubscriber<Harvester.Crop> testSubscriber = publisher.compose(harvesterFactory.forError(publisher, cmd)).test();
    testSubscriber.assertNotTerminated();

    publisher.onNext(uuid + " §$%&");

    testSubscriber.awaitDone(1, TimeUnit.SECONDS).assertNoTimeout().assertValueCount(1);
}
 
開發者ID:d4rken,項目名稱:RxShell,代碼行數:13,代碼來源:HarvesterTest.java

示例11: noEvents

import io.reactivex.subscribers.TestSubscriber; //導入方法依賴的package包/類
@Test
public void noEvents() {
    TestSubscriber<String> testSubscriber = stream
        .compose(RxLifecycle.<String, String>bind(lifecycle, CORRESPONDING_EVENTS))
        .test();

    stream.onNext("1");
    stream.onNext("2");
    testSubscriber.assertValues("1", "2");
    testSubscriber.assertNotTerminated();
}
 
開發者ID:xufreshman,項目名稱:RxLifeCycle,代碼行數:12,代碼來源:UntilCorrespondingEventTransformerFlowableTest.java

示例12: oneStartEvent

import io.reactivex.subscribers.TestSubscriber; //導入方法依賴的package包/類
@Test
public void oneStartEvent() {
    TestSubscriber<String> testSubscriber = stream
        .compose(RxLifecycle.<String, String>bind(lifecycle, CORRESPONDING_EVENTS))
        .test();

    lifecycle.onNext("create");
    stream.onNext("1");
    stream.onNext("2");

    testSubscriber.assertValues("1", "2");
    testSubscriber.assertNotTerminated();
}
 
開發者ID:xufreshman,項目名稱:RxLifeCycle,代碼行數:14,代碼來源:UntilCorrespondingEventTransformerFlowableTest.java

示例13: twoOpenEvents

import io.reactivex.subscribers.TestSubscriber; //導入方法依賴的package包/類
@Test
public void twoOpenEvents() {
    TestSubscriber<String> testSubscriber = stream
        .compose(RxLifecycle.<String, String>bind(lifecycle, CORRESPONDING_EVENTS))
        .test();

    lifecycle.onNext("create");
    stream.onNext("1");
    lifecycle.onNext("start");
    stream.onNext("2");

    testSubscriber.assertValues("1", "2");
    testSubscriber.assertNotTerminated();
}
 
開發者ID:xufreshman,項目名稱:RxLifeCycle,代碼行數:15,代碼來源:UntilCorrespondingEventTransformerFlowableTest.java

示例14: noEvent

import io.reactivex.subscribers.TestSubscriber; //導入方法依賴的package包/類
@Test
public void noEvent() {
    TestSubscriber<String> testSubscriber = stream
        .compose(RxLifecycle.<String, String>bind(lifecycle))
        .test();

    stream.onNext("1");
    stream.onNext("2");
    testSubscriber.assertValues("1", "2");
    testSubscriber.assertNotTerminated();
}
 
開發者ID:xufreshman,項目名稱:RxLifeCycle,代碼行數:12,代碼來源:UntilLifecycleTransformerFlowableTest.java

示例15: noEvents

import io.reactivex.subscribers.TestSubscriber; //導入方法依賴的package包/類
@Test
public void noEvents() {
    TestSubscriber<String> testSubscriber = stream
        .compose(RxLifecycle.<String, String>bindUntilEvent(lifecycle, "stop"))
        .test();

    stream.onNext("1");
    stream.onNext("2");
    testSubscriber.assertValues("1", "2");
    testSubscriber.assertNotTerminated();
}
 
開發者ID:xufreshman,項目名稱:RxLifeCycle,代碼行數:12,代碼來源:UntilEventTransformerFlowableTest.java


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