本文整理匯總了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"));
}
示例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"));
}
示例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"));
}
示例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"));
}
示例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));
}
示例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();
}
示例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));
}
示例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));
}
示例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));
}
示例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);
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}