Search in sources :

Example 61 with InOrder

use of org.mockito.InOrder in project RxJava by ReactiveX.

the class FlowableObserveOnTest method observeSameOnMultipleSchedulers.

@Test
public void observeSameOnMultipleSchedulers() {
    TestScheduler scheduler1 = new TestScheduler();
    TestScheduler scheduler2 = new TestScheduler();
    Flowable<Integer> o = Flowable.just(1, 2, 3);
    Flowable<Integer> o1 = o.observeOn(scheduler1);
    Flowable<Integer> o2 = o.observeOn(scheduler2);
    Subscriber<Object> observer1 = TestHelper.mockSubscriber();
    Subscriber<Object> observer2 = TestHelper.mockSubscriber();
    InOrder inOrder1 = inOrder(observer1);
    InOrder inOrder2 = inOrder(observer2);
    o1.subscribe(observer1);
    o2.subscribe(observer2);
    scheduler1.advanceTimeBy(1, TimeUnit.SECONDS);
    scheduler2.advanceTimeBy(1, TimeUnit.SECONDS);
    inOrder1.verify(observer1, times(1)).onNext(1);
    inOrder1.verify(observer1, times(1)).onNext(2);
    inOrder1.verify(observer1, times(1)).onNext(3);
    inOrder1.verify(observer1, times(1)).onComplete();
    verify(observer1, never()).onError(any(Throwable.class));
    inOrder1.verifyNoMoreInteractions();
    inOrder2.verify(observer2, times(1)).onNext(1);
    inOrder2.verify(observer2, times(1)).onNext(2);
    inOrder2.verify(observer2, times(1)).onNext(3);
    inOrder2.verify(observer2, times(1)).onComplete();
    verify(observer2, never()).onError(any(Throwable.class));
    inOrder2.verifyNoMoreInteractions();
}
Also used : InOrder(org.mockito.InOrder) Test(org.junit.Test)

Example 62 with InOrder

use of org.mockito.InOrder in project RxJava by ReactiveX.

the class FlowableFirstTest method testFirstOrDefaultWithPredicateFlowable.

@Test
public void testFirstOrDefaultWithPredicateFlowable() {
    Flowable<Integer> observable = Flowable.just(1, 2, 3, 4, 5, 6).filter(new Predicate<Integer>() {

        @Override
        public boolean test(Integer t1) {
            return t1 % 2 == 0;
        }
    }).first(8).toFlowable();
    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();
}
Also used : InOrder(org.mockito.InOrder)

Example 63 with InOrder

use of org.mockito.InOrder in project RxJava by ReactiveX.

the class FlowableFirstTest method testFirstWithOneElement.

@Test
public void testFirstWithOneElement() {
    Maybe<Integer> observable = Flowable.just(1).firstElement();
    observable.subscribe(wm);
    InOrder inOrder = inOrder(wm);
    inOrder.verify(wm, times(1)).onSuccess(1);
    inOrder.verifyNoMoreInteractions();
}
Also used : InOrder(org.mockito.InOrder)

Example 64 with InOrder

use of org.mockito.InOrder in project RxJava by ReactiveX.

the class FlowableFirstTest method testFirstWithEmpty.

@Test
public void testFirstWithEmpty() {
    Maybe<Integer> observable = Flowable.<Integer>empty().firstElement();
    observable.subscribe(wm);
    InOrder inOrder = inOrder(wm);
    inOrder.verify(wm).onComplete();
    inOrder.verify(wm, never()).onError(any(Throwable.class));
    inOrder.verifyNoMoreInteractions();
}
Also used : InOrder(org.mockito.InOrder)

Example 65 with InOrder

use of org.mockito.InOrder in project RxJava by ReactiveX.

the class FlowableFirstTest method testFirstOrDefaultWithPredicateAndOneElementFlowable.

@Test
public void testFirstOrDefaultWithPredicateAndOneElementFlowable() {
    Flowable<Integer> observable = Flowable.just(1, 2).filter(new Predicate<Integer>() {

        @Override
        public boolean test(Integer t1) {
            return t1 % 2 == 0;
        }
    }).first(4).toFlowable();
    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();
}
Also used : InOrder(org.mockito.InOrder)

Aggregations

InOrder (org.mockito.InOrder)3292 Test (org.junit.Test)2308 Test (org.junit.jupiter.api.Test)377 AbstractRestServiceTest (org.camunda.bpm.engine.rest.AbstractRestServiceTest)108 HashMap (java.util.HashMap)104 ArrayList (java.util.ArrayList)98 Response (com.jayway.restassured.response.Response)79 Matchers.containsString (org.hamcrest.Matchers.containsString)69 IOException (java.io.IOException)64 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)63 SmallTest (org.mule.tck.size.SmallTest)62 List (java.util.List)57 CompletableFuture (java.util.concurrent.CompletableFuture)52 Cleanup (lombok.Cleanup)46 InvocationOnMock (org.mockito.invocation.InvocationOnMock)46 WireCommands (io.pravega.shared.protocol.netty.WireCommands)45 ProcessorInterceptor (org.mule.runtime.api.interception.ProcessorInterceptor)44 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)44 Metadata (io.grpc.Metadata)43 ComponentLocation (org.mule.runtime.api.component.location.ComponentLocation)41