本文整理汇总了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();
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}