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


Java InOrder.verifyNoMoreInteractions方法代碼示例

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


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

示例1: testAmb3

import org.mockito.InOrder; //導入方法依賴的package包/類
@Test
public void testAmb3() {
    Flowable<String> Flowable1 = createFlowable(new String[] {
            "1" }, 2000, null);
    Flowable<String> Flowable2 = createFlowable(new String[] {},
            1000, null);
    Flowable<String> Flowable3 = createFlowable(new String[] {
            "3" }, 3000, null);

    @SuppressWarnings("unchecked")
    Flowable<String> o = Flowable.ambArray(Flowable1,
            Flowable2, Flowable3);

    @SuppressWarnings("unchecked")
    DefaultSubscriber<String> observer = mock(DefaultSubscriber.class);
    o.subscribe(observer);

    scheduler.advanceTimeBy(100000, TimeUnit.MILLISECONDS);
    InOrder inOrder = inOrder(observer);
    inOrder.verify(observer, times(1)).onComplete();
    inOrder.verifyNoMoreInteractions();
}
 
開發者ID:akarnokd,項目名稱:RxJava3-preview,代碼行數:23,代碼來源:FlowableAmbTest.java

示例2: testSingleWithPredicateAndTooManyElements

import org.mockito.InOrder; //導入方法依賴的package包/類
@Test
public void testSingleWithPredicateAndTooManyElements() {
    Maybe<Integer> o = Observable.just(1, 2, 3, 4)
            .filter(
            new Predicate<Integer>() {

                @Override
                public boolean test(Integer t1) {
                    return t1 % 2 == 0;
                }
            })
            .singleElement();

    MaybeObserver<Integer> observer = TestHelper.mockMaybeObserver();
    o.subscribe(observer);

    InOrder inOrder = inOrder(observer);
    inOrder.verify(observer, times(1)).onError(
            isA(IllegalArgumentException.class));
    inOrder.verifyNoMoreInteractions();
}
 
開發者ID:akarnokd,項目名稱:RxJava3-preview,代碼行數:22,代碼來源:ObservableSingleTest.java

示例3: testSingleWithPredicateAndTooManyElements

import org.mockito.InOrder; //導入方法依賴的package包/類
@Test
public void testSingleWithPredicateAndTooManyElements() {
    Maybe<Integer> observable = singleElement(Flowable.just(1, 2, 3, 4)
            .filter(
            new Predicate<Integer>() {

                @Override
                public boolean test(Integer t1) {
                    return t1 % 2 == 0;
                }
            })
            );

    MaybeObserver<Integer> observer = TestHelper.mockMaybeObserver();
    observable.subscribe(observer);

    InOrder inOrder = inOrder(observer);
    inOrder.verify(observer, times(1)).onError(
            isA(IllegalArgumentException.class));
    inOrder.verifyNoMoreInteractions();
}
 
開發者ID:akarnokd,項目名稱:RxJava3-preview,代碼行數:22,代碼來源:FlowableSingleTest.java

示例4: testSingleWithPredicateFlowable

import org.mockito.InOrder; //導入方法依賴的package包/類
@Test
public void testSingleWithPredicateFlowable() {
    Flowable<Integer> observable = Flowable.just(1, 2)
            .filter(
            new Predicate<Integer>() {

                @Override
                public boolean test(Integer t1) {
                    return t1 % 2 == 0;
                }
            })
            .singleElement();

    Subscriber<Integer> observer = TestHelper.mockSubscriber();
    observable.subscribe(observer);

    InOrder inOrder = inOrder(observer);
    inOrder.verify(observer, times(1)).onNext(2);
    inOrder.verify(observer, times(1)).onComplete();
    inOrder.verifyNoMoreInteractions();
}
 
開發者ID:akarnokd,項目名稱:RxJava3-preview,代碼行數:22,代碼來源:FlowableSingleTest.java

示例5: testSingleWithPredicateAndEmptyFlowable

import org.mockito.InOrder; //導入方法依賴的package包/類
@Test
public void testSingleWithPredicateAndEmptyFlowable() {
    Flowable<Integer> observable = Flowable.just(1)
            .filter(
            new Predicate<Integer>() {

                @Override
                public boolean test(Integer t1) {
                    return t1 % 2 == 0;
                }
            })
            .singleElement();
    Subscriber<Integer> observer = TestHelper.mockSubscriber();
    observable.subscribe(observer);

    InOrder inOrder = inOrder(observer);
    inOrder.verify(observer).onComplete();
    inOrder.verify(observer, never()).onError(any(Throwable.class));
    inOrder.verifyNoMoreInteractions();
}
 
開發者ID:akarnokd,項目名稱:RxJava3-preview,代碼行數:21,代碼來源:FlowableSingleTest.java

示例6: testDebounceWithError

import org.mockito.InOrder; //導入方法依賴的package包/類
@Test
public void testDebounceWithError() {
    Observable<String> source = Observable.unsafeCreate(new ObservableSource<String>() {
        @Override
        public void subscribe(Observer<? super String> observer) {
            observer.onSubscribe(Disposables.empty());
            Exception error = new TestException();
            publishNext(observer, 100, "one");    // Should be published since "two" will arrive after the timeout expires.
            publishNext(observer, 600, "two");    // Should be skipped since onError will arrive before the timeout expires.
            publishError(observer, 700, error);   // Should be published as soon as the timeout expires.
        }
    });

    Observable<String> sampled = source.debounce(400, TimeUnit.MILLISECONDS, scheduler);
    sampled.subscribe(observer);

    scheduler.advanceTimeTo(0, TimeUnit.MILLISECONDS);
    InOrder inOrder = inOrder(observer);
    // 100 + 400 means it triggers at 500
    scheduler.advanceTimeTo(500, TimeUnit.MILLISECONDS);
    inOrder.verify(observer).onNext("one");
    scheduler.advanceTimeTo(701, TimeUnit.MILLISECONDS);
    inOrder.verify(observer).onError(any(TestException.class));
    inOrder.verifyNoMoreInteractions();
}
 
開發者ID:akarnokd,項目名稱:RxJava3-preview,代碼行數:26,代碼來源:ObservableDebounceTest.java

示例7: testFirstWithPredicateAndOneElement

import org.mockito.InOrder; //導入方法依賴的package包/類
@Test
public void testFirstWithPredicateAndOneElement() {
    Maybe<Integer> observable = firstElement(Flowable.just(1, 2)
            .filter(new Predicate<Integer>() {
                @Override
                public boolean test(Integer t1) {
                    return t1 % 2 == 0;
                }
            })
            );

    observable.subscribe(wm);

    InOrder inOrder = inOrder(wm);
    inOrder.verify(wm, times(1)).onSuccess(2);
    inOrder.verifyNoMoreInteractions();
}
 
開發者ID:akarnokd,項目名稱:RxJava3-preview,代碼行數:18,代碼來源:FlowableFirstTest.java

示例8: testTimeInterval

import org.mockito.InOrder; //導入方法依賴的package包/類
@Test
public void testTimeInterval() {
    InOrder inOrder = inOrder(observer);
    observable.subscribe(observer);

    testScheduler.advanceTimeBy(1000, TIME_UNIT);
    subject.onNext(1);
    testScheduler.advanceTimeBy(2000, TIME_UNIT);
    subject.onNext(2);
    testScheduler.advanceTimeBy(3000, TIME_UNIT);
    subject.onNext(3);
    subject.onComplete();

    inOrder.verify(observer, times(1)).onNext(
            new Timed<Integer>(1, 1000, TIME_UNIT));
    inOrder.verify(observer, times(1)).onNext(
            new Timed<Integer>(2, 2000, TIME_UNIT));
    inOrder.verify(observer, times(1)).onNext(
            new Timed<Integer>(3, 3000, TIME_UNIT));
    inOrder.verify(observer, times(1)).onComplete();
    inOrder.verifyNoMoreInteractions();
}
 
開發者ID:akarnokd,項目名稱:RxJava3-preview,代碼行數:23,代碼來源:ObservableTimeIntervalTest.java

示例9: shouldNotCreateUserChannel

import org.mockito.InOrder; //導入方法依賴的package包/類
@Test
public void shouldNotCreateUserChannel() {
    // given
    when(alertsChannelsApiMock.list()).thenReturn(ImmutableList.of(savedUserChannel));
    PolicyConfiguration policyConfiguration = buildPolicyConfiguration(USER_CHANNEL);

    AlertsPolicyChannels expected = AlertsPolicyChannels.builder()
            .policyId(POLICY.getId())
            .channelIds(ImmutableSet.of(savedUserChannel.getId()))
            .build();

    // when
    testee.sync(policyConfiguration);

    // then
    InOrder order = inOrder(alertsChannelsApiMock, alertsPoliciesApiMock);
    order.verify(alertsChannelsApiMock).list();
    order.verify(alertsPoliciesApiMock).updateChannels(expected);
    order.verifyNoMoreInteractions();
}
 
開發者ID:ocadotechnology,項目名稱:newrelic-alerts-configurator,代碼行數:21,代碼來源:ChannelConfiguratorTest.java

示例10: testThrottle

import org.mockito.InOrder; //導入方法依賴的package包/類
@Test
public void testThrottle() {
    Subscriber<Integer> observer = TestHelper.mockSubscriber();

    TestScheduler s = new TestScheduler();
    PublishProcessor<Integer> o = PublishProcessor.create();
    o.throttleWithTimeout(500, TimeUnit.MILLISECONDS, s)
    .subscribe(observer);

    // send events with simulated time increments
    s.advanceTimeTo(0, TimeUnit.MILLISECONDS);
    o.onNext(1); // skip
    o.onNext(2); // deliver
    s.advanceTimeTo(501, TimeUnit.MILLISECONDS);
    o.onNext(3); // skip
    s.advanceTimeTo(600, TimeUnit.MILLISECONDS);
    o.onNext(4); // skip
    s.advanceTimeTo(700, TimeUnit.MILLISECONDS);
    o.onNext(5); // skip
    o.onNext(6); // deliver at 1300 after 500ms has passed since onNext(5)
    s.advanceTimeTo(1300, TimeUnit.MILLISECONDS);
    o.onNext(7); // deliver
    s.advanceTimeTo(1800, TimeUnit.MILLISECONDS);
    o.onComplete();

    InOrder inOrder = inOrder(observer);
    inOrder.verify(observer).onNext(2);
    inOrder.verify(observer).onNext(6);
    inOrder.verify(observer).onNext(7);
    inOrder.verify(observer).onComplete();
    inOrder.verifyNoMoreInteractions();
}
 
開發者ID:akarnokd,項目名稱:RxJava3-preview,代碼行數:33,代碼來源:FlowableThrottleWithTimeoutTests.java

示例11: testSingleOrDefaultFlowable

import org.mockito.InOrder; //導入方法依賴的package包/類
@Test
public void testSingleOrDefaultFlowable() {
    Flowable<Integer> observable = Flowable.just(1).single(2);

    Subscriber<Integer> observer = TestHelper.mockSubscriber();
    observable.subscribe(observer);

    InOrder inOrder = inOrder(observer);
    inOrder.verify(observer, times(1)).onNext(1);
    inOrder.verify(observer, times(1)).onComplete();
    inOrder.verifyNoMoreInteractions();
}
 
開發者ID:akarnokd,項目名稱:RxJava3-preview,代碼行數:13,代碼來源:FlowableSingleTest.java

示例12: execution_exception_is_ignored

import org.mockito.InOrder; //導入方法依賴的package包/類
@Test
public void execution_exception_is_ignored() throws ReactorException, ExecutionException, InterruptedException {
    ScheduledFuture mockedFuture = mockedFuture();
    ExecutionException executionException = new ExecutionException(new RuntimeException());
    when(mockedFuture.get()).thenThrow(executionException);
    watcherActor.onMessage(FROM, startSampling(PID, 1, KEY_PREFIX));

    watcherActor.onMessage(FROM, stopSampling(PID));

    InOrder inOrder = inOrder(scheduler, mockedFuture);
    inOrder.verify(scheduler).scheduleAtFixedRate(any(Runnable.class), eq(0L), eq(1L), eq(TimeUnit.SECONDS));
    inOrder.verify(mockedFuture).cancel(true);
    inOrder.verify(mockedFuture).get();
    inOrder.verifyNoMoreInteractions();
}
 
開發者ID:florentw,項目名稱:bench,代碼行數:16,代碼來源:ProcessWatcherActorTest.java

示例13: testFirstWithEmptyFlowable

import org.mockito.InOrder; //導入方法依賴的package包/類
@Test
public void testFirstWithEmptyFlowable() {
    Flowable<Integer> observable = Flowable.<Integer> empty().firstElement();

    Subscriber<Integer> observer = TestHelper.mockSubscriber();
    observable.subscribe(observer);

    InOrder inOrder = inOrder(observer);
    inOrder.verify(observer).onComplete();
    inOrder.verify(observer, never()).onError(any(Throwable.class));
    inOrder.verifyNoMoreInteractions();
}
 
開發者ID:akarnokd,項目名稱:RxJava3-preview,代碼行數:13,代碼來源:FlowableFirstTest.java

示例14: testLastWithOneElement

import org.mockito.InOrder; //導入方法依賴的package包/類
@Test
    public void testLastWithOneElement() {
        Maybe<Integer> observable = lastElement(Flowable.just(1));

        MaybeObserver<Integer> observer = TestHelper.mockMaybeObserver();
        observable.subscribe(observer);

        InOrder inOrder = inOrder(observer);
        inOrder.verify(observer, times(1)).onSuccess(1);
//        inOrder.verify(observer, times(1)).onComplete();
        inOrder.verifyNoMoreInteractions();
    }
 
開發者ID:akarnokd,項目名稱:RxJava3-preview,代碼行數:13,代碼來源:FlowableLastTest.java

示例15: testLast

import org.mockito.InOrder; //導入方法依賴的package包/類
@Test
    public void testLast() {
        Maybe<Integer> observable = lastElement(Flowable.just(1, 2, 3));

        MaybeObserver<Integer> observer = TestHelper.mockMaybeObserver();
        observable.subscribe(observer);

        InOrder inOrder = inOrder(observer);
        inOrder.verify(observer, times(1)).onSuccess(3);
//        inOrder.verify(observer, times(1)).onComplete();
        inOrder.verifyNoMoreInteractions();
    }
 
開發者ID:akarnokd,項目名稱:RxJava3-preview,代碼行數:13,代碼來源:FlowableLastTest.java


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