Search in sources :

Example 86 with InOrder

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

the class FlowableFirstTest method testFirstOrDefaultWithPredicateAndOneElement.

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

        @Override
        public boolean test(Integer t1) {
            return t1 % 2 == 0;
        }
    }).first(4);
    observable.subscribe(wo);
    InOrder inOrder = inOrder(wo);
    inOrder.verify(wo, times(1)).onSuccess(2);
    inOrder.verifyNoMoreInteractions();
}
Also used : InOrder(org.mockito.InOrder) Predicate(io.reactivex.functions.Predicate)

Example 87 with InOrder

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

the class FlowableFirstTest method testFirstWithPredicateFlowable.

@Test
public void testFirstWithPredicateFlowable() {
    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;
        }
    }).firstElement().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 88 with InOrder

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

the class FlowableFirstTest method testFirstOrDefaultWithOneElementFlowable.

@Test
public void testFirstOrDefaultWithOneElementFlowable() {
    Flowable<Integer> observable = Flowable.just(1).first(2).toFlowable();
    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();
}
Also used : InOrder(org.mockito.InOrder)

Example 89 with InOrder

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

the class FlowableFirstTest method testFirstOrDefaultWithPredicate.

@Test
public void testFirstOrDefaultWithPredicate() {
    Single<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);
    observable.subscribe(wo);
    InOrder inOrder = inOrder(wo);
    inOrder.verify(wo, times(1)).onSuccess(2);
    inOrder.verifyNoMoreInteractions();
}
Also used : InOrder(org.mockito.InOrder) Predicate(io.reactivex.functions.Predicate)

Example 90 with InOrder

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

the class FlowableFirstTest method testFirstWithOneElementFlowable.

@Test
public void testFirstWithOneElementFlowable() {
    Flowable<Integer> observable = Flowable.just(1).firstElement().toFlowable();
    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();
}
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