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


Java TestSubscriber.assertNotComplete方法代碼示例

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


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

示例1: shouldSendNotificationForAdds

import io.reactivex.subscribers.TestSubscriber; //導入方法依賴的package包/類
@SuppressWarnings("unchecked")
@Test
public void shouldSendNotificationForAdds() {
    // given:
    final UUID uuid1 = UUID.randomUUID();
    final UUID uuid2 = UUID.randomUUID();
    final TestSubscriber<CrdtCommand> subscriber = TestSubscriber.create();
    final USet<UUID> set = new USet<>("ID_1");
    set.subscribe(subscriber);

    // when:
    set.add(uuid1);
    set.add(uuid2);

    // then:
    subscriber.assertNotComplete();
    subscriber.assertNoErrors();
    assertThat(subscriber.values(), contains(
            new AddCommandMatcher<>(set.getCrdtId(), uuid1),
            new AddCommandMatcher<>(set.getCrdtId(), uuid2)
    ));
}
 
開發者ID:netopyr,項目名稱:wurmloch-crdt,代碼行數:23,代碼來源:USetTest.java

示例2: shouldSendNotificationForRemoves

import io.reactivex.subscribers.TestSubscriber; //導入方法依賴的package包/類
@SuppressWarnings("unchecked")
@Test
public void shouldSendNotificationForRemoves() {
    // given:
    final UUID uuid1 = UUID.randomUUID();
    final TestSubscriber<CrdtCommand> subscriber = TestSubscriber.create();
    final USet<UUID> set = new USet<>("ID_1");
    set.subscribe(subscriber);

    set.add(uuid1);

    // when:
    final Iterator<UUID> it = set.iterator();
    it.next();
    it.remove();

    // then:
    subscriber.assertNotComplete();
    subscriber.assertNoErrors();
    assertThat(subscriber.values(), contains(
            new AddCommandMatcher<>(set.getCrdtId(), uuid1),
            new RemoveCommandMatcher<>(set.getCrdtId(), uuid1)
    ));
}
 
開發者ID:netopyr,項目名稱:wurmloch-crdt,代碼行數:25,代碼來源:USetTest.java

示例3: shouldHandleAddCommands

import io.reactivex.subscribers.TestSubscriber; //導入方法依賴的package包/類
@Test
public void shouldHandleAddCommands() {
    // given:
    final UUID uuid1 = UUID.randomUUID();
    final UUID uuid2 = UUID.randomUUID();
    final Processor<USet.USetCommand<UUID>, USet.USetCommand<UUID>> inputStream = ReplayProcessor.create();
    final TestSubscriber<CrdtCommand> subscriber = TestSubscriber.create();
    final USet<UUID> set = new USet<>("ID_1");
    set.subscribeTo(inputStream);
    set.subscribe(subscriber);

    final USet.AddCommand<UUID> command1 = new USet.AddCommand<>(set.getCrdtId(), uuid1);
    final USet.AddCommand<UUID> command2 = new USet.AddCommand<>(set.getCrdtId(), uuid2);

    // when:
    inputStream.onNext(command1);
    inputStream.onNext(command2);

    // then:
    assertThat(set, hasSize(2));
    assertThat(subscriber.valueCount(), is(2));
    subscriber.assertNotComplete();
    subscriber.assertNoErrors();
}
 
開發者ID:netopyr,項目名稱:wurmloch-crdt,代碼行數:25,代碼來源:USetTest.java

示例4: shouldHandleRemoveCommands

import io.reactivex.subscribers.TestSubscriber; //導入方法依賴的package包/類
@Test
public void shouldHandleRemoveCommands() {
    // given:
    final UUID uuid1 = UUID.randomUUID();
    final Processor<USet.USetCommand<UUID>, USet.USetCommand<UUID>> inputStream = ReplayProcessor.create();
    final TestSubscriber<CrdtCommand> subscriber = TestSubscriber.create();
    final USet<UUID> set = new USet<>("ID_1");
    set.subscribeTo(inputStream);
    set.subscribe(subscriber);

    final USet.AddCommand<UUID> command1 = new USet.AddCommand<>(set.getCrdtId(), uuid1);
    final USet.RemoveCommand<UUID> command2 = new USet.RemoveCommand<>(set.getCrdtId(), uuid1);

    // when:
    inputStream.onNext(command1);
    inputStream.onNext(command2);

    // then:
    assertThat(set, empty());
    assertThat(subscriber.valueCount(), is(2));
    subscriber.assertNotComplete();
    subscriber.assertNoErrors();
}
 
開發者ID:netopyr,項目名稱:wurmloch-crdt,代碼行數:24,代碼來源:USetTest.java

示例5: testOneGist

import io.reactivex.subscribers.TestSubscriber; //導入方法依賴的package包/類
@Test
public void testOneGist() {
    ServiceLocator.put(OkHttpClient.class, OkHttpClientUtil.getOkHttpClient(null, MockBehavior.MOCK));
    Flowable<Gist> flowable = ServiceInjector.resolve(RxEndpoints.class).getGist("3d7cbc2f66cf5d61b8014d957a270c7c");
    TestSubscriber<Gist> testSubscriber = new TestSubscriber<>();
    flowable.subscribe(testSubscriber);
    testSubscriber.assertComplete();
    List<Gist> gistList = testSubscriber.values();
    Gist gist = gistList.get(0);
    assertEquals("Bootstrap Customizer Config", gist.getDescription());
    GistFile file = gist.getFile(gist.getFilenames().iterator().next());
    assertEquals(file.getContent().length(), file.getSize());
    assertEquals("config.json", file.getFilename());
    flowable = ServiceInjector.resolve(RxEndpoints.class).getGist("not actually an ID");
    testSubscriber = new TestSubscriber<>();
    flowable.subscribe(testSubscriber);
    testSubscriber.assertNotComplete();
    testSubscriber.assertNoValues();
    List<Throwable> errorList = testSubscriber.errors();
    assertEquals(errorList.size(), 1);
    assertEquals("Not Found", errorList.get(0).getMessage());
}
 
開發者ID:politedog,項目名稱:mock-interceptor,代碼行數:23,代碼來源:GistTest.java

示例6: itShouldSendCommandsOnUpdates

import io.reactivex.subscribers.TestSubscriber; //導入方法依賴的package包/類
@Test
public void itShouldSendCommandsOnUpdates() {
    // given
    final TestSubscriber<CrdtCommand> subscriber = TestSubscriber.create();
    final PNCounter counter = new PNCounter(NODE_ID_1, CRDT_ID);
    counter.subscribe(subscriber);

    // when
    counter.increment();
    counter.decrement();
    counter.increment(3L);
    counter.decrement(5L);

    // then
    subscriber.assertNotComplete();
    subscriber.assertNoErrors();
    assertThat(subscriber.values(), contains(
            new UpdateCommandMatcher(CRDT_ID, HashMap.of(NODE_ID_1, 1L), HashMap.empty()),
            new UpdateCommandMatcher(CRDT_ID, HashMap.of(NODE_ID_1, 1L), HashMap.of(NODE_ID_1, 1L)),
            new UpdateCommandMatcher(CRDT_ID, HashMap.of(NODE_ID_1, 4L), HashMap.of(NODE_ID_1, 1L)),
            new UpdateCommandMatcher(CRDT_ID, HashMap.of(NODE_ID_1, 4L), HashMap.of(NODE_ID_1, 6L))
    ));
}
 
開發者ID:netopyr,項目名稱:wurmloch-crdt,代碼行數:24,代碼來源:PNCounterTest.java

示例7: shouldSendNotificationForAdds

import io.reactivex.subscribers.TestSubscriber; //導入方法依賴的package包/類
@SuppressWarnings("unchecked")
@Test
public void shouldSendNotificationForAdds() {
    // given:
    final TestSubscriber<CrdtCommand> subscriber = TestSubscriber.create();
    final ORSet<String> set = new ORSet<>("ID_1");
    set.subscribe(subscriber);

    // when:
    set.add("1");
    set.add("2");
    set.add("1");

    // then:
    subscriber.assertNotComplete();
    subscriber.assertNoErrors();
    assertThat(subscriber.values(), contains(
            new AddCommandMatcher<>(set.getCrdtId(), "1"),
            new AddCommandMatcher<>(set.getCrdtId(), "2"),
            new AddCommandMatcher<>(set.getCrdtId(), "1")
    ));
}
 
開發者ID:netopyr,項目名稱:wurmloch-crdt,代碼行數:23,代碼來源:ORSetTest.java

示例8: shouldSendNotificationForRemoves

import io.reactivex.subscribers.TestSubscriber; //導入方法依賴的package包/類
@SuppressWarnings("unchecked")
@Test
public void shouldSendNotificationForRemoves() {
    // given:
    final TestSubscriber<CrdtCommand> subscriber = TestSubscriber.create();
    final ORSet<String> set = new ORSet<>("ID_1");
    set.subscribe(subscriber);

    set.add("1");
    set.add("1");

    // when:
    final Iterator<String> it = set.iterator();
    it.next();
    it.remove();

    // then:
    subscriber.assertNotComplete();
    subscriber.assertNoErrors();
    assertThat(subscriber.values(), contains(
            new AddCommandMatcher<>(set.getCrdtId(), "1"),
            new AddCommandMatcher<>(set.getCrdtId(), "1"),
            new RemoveCommandMatcher<>(set.getCrdtId(), "1", "1")
    ));
}
 
開發者ID:netopyr,項目名稱:wurmloch-crdt,代碼行數:26,代碼來源:ORSetTest.java

示例9: shouldHandleAddCommands

import io.reactivex.subscribers.TestSubscriber; //導入方法依賴的package包/類
@Test
public void shouldHandleAddCommands() {
    // given:
    final Processor<ORSet.ORSetCommand<String>, ORSet.ORSetCommand<String>> inputStream = ReplayProcessor.create();
    final TestSubscriber<CrdtCommand> subscriber = TestSubscriber.create();
    final ORSet<String> set = new ORSet<>("ID_1");
    set.subscribeTo(inputStream);
    set.subscribe(subscriber);

    final ORSet.AddCommand<String> command1 = new ORSet.AddCommand<>(set.getCrdtId(), new ORSet.Element<>("1", UUID.randomUUID()));
    final ORSet.AddCommand<String> command2 = new ORSet.AddCommand<>(set.getCrdtId(), new ORSet.Element<>("2", UUID.randomUUID()));
    final ORSet.AddCommand<String> command3 = new ORSet.AddCommand<>(set.getCrdtId(), new ORSet.Element<>("1", UUID.randomUUID()));

    // when:
    inputStream.onNext(command1);
    inputStream.onNext(command2);
    inputStream.onNext(command3);

    // then:
    assertThat(set, hasSize(2));
    assertThat(subscriber.valueCount(), is(3));
    subscriber.assertNotComplete();
    subscriber.assertNoErrors();
}
 
開發者ID:netopyr,項目名稱:wurmloch-crdt,代碼行數:25,代碼來源:ORSetTest.java

示例10: shouldHandleDuplicateCommands

import io.reactivex.subscribers.TestSubscriber; //導入方法依賴的package包/類
@Test
public void shouldHandleDuplicateCommands() {
    // given:
    final Processor<ORSet.ORSetCommand<String>, ORSet.ORSetCommand<String>> inputStream = ReplayProcessor.create();
    final TestSubscriber<CrdtCommand> subscriber = TestSubscriber.create();
    final ORSet<String> set = new ORSet<>("ID_1");
    set.subscribeTo(inputStream);
    set.subscribe(subscriber);

    final ORSet.AddCommand<String> command = new ORSet.AddCommand<>(set.getCrdtId(), new ORSet.Element<>("1", UUID.randomUUID()));

    // when:
    inputStream.onNext(command);
    inputStream.onNext(command);

    // then:
    assertThat(set, hasSize(1));
    assertThat(subscriber.valueCount(), is(1));
    subscriber.assertNotComplete();
    subscriber.assertNoErrors();
}
 
開發者ID:netopyr,項目名稱:wurmloch-crdt,代碼行數:22,代碼來源:ORSetTest.java

示例11: shouldSendNotificationForAdds

import io.reactivex.subscribers.TestSubscriber; //導入方法依賴的package包/類
@SuppressWarnings("unchecked")
@Test
public void shouldSendNotificationForAdds() {
    // given:
    final TestSubscriber<CrdtCommand> subscriber = TestSubscriber.create();
    final GSet<String> set = new GSet<>("ID_1");
    set.subscribe(subscriber);

    // when:
    set.add("1");
    set.add("2");
    set.add("1");

    // then:
    subscriber.assertNotComplete();
    subscriber.assertNoErrors();
    assertThat(subscriber.values(), contains(
            new AddCommandMatcher<>(set.getCrdtId(), "1"),
            new AddCommandMatcher<>(set.getCrdtId(), "2"),
            new AddCommandMatcher<>(set.getCrdtId(), "1")
    ));
}
 
開發者ID:netopyr,項目名稱:wurmloch-crdt,代碼行數:23,代碼來源:GSetTest.java

示例12: shouldHandleAddCommands

import io.reactivex.subscribers.TestSubscriber; //導入方法依賴的package包/類
@Test
public void shouldHandleAddCommands() {
    // given:
    final Processor<GSet.AddCommand<String>, GSet.AddCommand<String>> inputStream = ReplayProcessor.create();
    final TestSubscriber<CrdtCommand> subscriber = TestSubscriber.create();
    final GSet<String> set = new GSet<>("ID_1");
    set.subscribeTo(inputStream);
    set.subscribe(subscriber);

    final GSet.AddCommand<String> command1 = new GSet.AddCommand<>(set.getCrdtId(), "1");
    final GSet.AddCommand<String> command2 = new GSet.AddCommand<>(set.getCrdtId(), "2");
    final GSet.AddCommand<String> command3 = new GSet.AddCommand<>(set.getCrdtId(), "1");

    // when:
    inputStream.onNext(command1);
    inputStream.onNext(command2);
    inputStream.onNext(command3);

    // then:
    assertThat(set, hasSize(2));
    assertThat(subscriber.valueCount(), is(2));
    subscriber.assertNotComplete();
    subscriber.assertNoErrors();
}
 
開發者ID:netopyr,項目名稱:wurmloch-crdt,代碼行數:25,代碼來源:GSetTest.java

示例13: shouldHandleRemoveCommands

import io.reactivex.subscribers.TestSubscriber; //導入方法依賴的package包/類
@Test
public void shouldHandleRemoveCommands() {
    // given:
    final Processor<TwoPSet.TwoPSetCommand<String>, TwoPSet.TwoPSetCommand<String>> inputStream = ReplayProcessor.create();
    final TestSubscriber<CrdtCommand> subscriber = TestSubscriber.create();
    final TwoPSet<String> set = new TwoPSet<>("ID_1");
    set.subscribeTo(inputStream);
    set.subscribe(subscriber);

    final TwoPSet.AddCommand<String> command1 = new TwoPSet.AddCommand<>(set.getCrdtId(), "1");
    final TwoPSet.AddCommand<String> command2 = new TwoPSet.AddCommand<>(set.getCrdtId(), "1");
    final TwoPSet.RemoveCommand<String> command3 = new TwoPSet.RemoveCommand<>(set.getCrdtId(), "1");

    // when:
    inputStream.onNext(command1);
    inputStream.onNext(command2);
    inputStream.onNext(command3);

    // then:
    assertThat(set, empty());
    assertThat(subscriber.valueCount(), is(2));
    subscriber.assertNotComplete();
    subscriber.assertNoErrors();
}
 
開發者ID:netopyr,項目名稱:wurmloch-crdt,代碼行數:25,代碼來源:TwoPSetTest.java

示例14: shouldSendNotificationForRemoves

import io.reactivex.subscribers.TestSubscriber; //導入方法依賴的package包/類
@SuppressWarnings("unchecked")
@Test
public void shouldSendNotificationForRemoves() {
    // given:
    final TestSubscriber<CrdtCommand> subscriber = TestSubscriber.create();
    final TwoPSet<String> set = new TwoPSet<>("ID_1");
    set.subscribe(subscriber);

    set.add("1");
    set.add("1");

    // when:
    final Iterator<String> it = set.iterator();
    it.next();
    it.remove();

    // then:
    subscriber.assertNotComplete();
    subscriber.assertNoErrors();
    assertThat(subscriber.values(), contains(
            new AddCommandMatcher<>(set.getCrdtId(), "1"),
            new RemoveCommandMatcher<>(set.getCrdtId(), "1")
    ));
}
 
開發者ID:netopyr,項目名稱:wurmloch-crdt,代碼行數:25,代碼來源:TwoPSetTest.java

示例15: itShouldSendCommandsOnUpdates

import io.reactivex.subscribers.TestSubscriber; //導入方法依賴的package包/類
@SuppressWarnings("unchecked")
@Test
public void itShouldSendCommandsOnUpdates() {
    // given
    final TestSubscriber<CrdtCommand> subscriber = TestSubscriber.create();
    final MVRegister<String> register = new MVRegister<>(NODE_ID_1, CRDT_ID);
    register.subscribe(subscriber);

    // when
    register.set("Hello World");

    // then
    subscriber.assertNotComplete();
    subscriber.assertNoErrors();
    assertThat(subscriber.values(), contains(
            new SetCommandMatcher<>(CRDT_ID, "Hello World")
    ));

    // when
    register.set("Hello World");

    // then
    subscriber.assertNotComplete();
    subscriber.assertNoErrors();
    assertThat(subscriber.values(), contains(
            new SetCommandMatcher<>(CRDT_ID, "Hello World")
    ));

    // when
    register.set("Goodbye World");

    // then
    subscriber.assertNotComplete();
    subscriber.assertNoErrors();
    assertThat(subscriber.values(), contains(
            new SetCommandMatcher<>(CRDT_ID, "Hello World"),
            new SetCommandMatcher<>(CRDT_ID, "Goodbye World")
    ));
}
 
開發者ID:netopyr,項目名稱:wurmloch-crdt,代碼行數:40,代碼來源:MVRegisterTest.java


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