Search in sources :

Example 41 with Completable

use of rx.Completable in project feign by OpenFeign.

the class HystrixBuilderTest method rxCompletableFallback.

@Test
public void rxCompletableFallback() {
    server.enqueue(new MockResponse().setResponseCode(500));
    final TestInterface api = target();
    final Completable completable = api.completable();
    assertThat(completable).isNotNull();
    assertThat(server.getRequestCount()).isEqualTo(0);
    final TestSubscriber<String> testSubscriber = new TestSubscriber<String>();
    completable.subscribe(testSubscriber);
    testSubscriber.awaitTerminalEvent();
    testSubscriber.assertCompleted();
}
Also used : MockResponse(okhttp3.mockwebserver.MockResponse) Completable(rx.Completable) TestSubscriber(rx.observers.TestSubscriber) Test(org.junit.Test)

Example 42 with Completable

use of rx.Completable in project feign by OpenFeign.

the class HystrixBuilderTest method rxCompletableEmptyBody.

@Test
public void rxCompletableEmptyBody() {
    server.enqueue(new MockResponse());
    final TestInterface api = target();
    final Completable completable = api.completable();
    assertThat(completable).isNotNull();
    assertThat(server.getRequestCount()).isEqualTo(0);
    final TestSubscriber<String> testSubscriber = new TestSubscriber<String>();
    completable.subscribe(testSubscriber);
    testSubscriber.awaitTerminalEvent();
    testSubscriber.assertCompleted();
    testSubscriber.assertNoErrors();
}
Also used : MockResponse(okhttp3.mockwebserver.MockResponse) Completable(rx.Completable) TestSubscriber(rx.observers.TestSubscriber) Test(org.junit.Test)

Aggregations

Completable (rx.Completable)42 Test (org.junit.Test)32 ArrayList (java.util.ArrayList)6 TestSubscriber (rx.observers.TestSubscriber)6 MockResponse (okhttp3.mockwebserver.MockResponse)4 Func1 (rx.functions.Func1)4 ContentValues (android.content.ContentValues)3 Action0 (rx.functions.Action0)3 CheckResult (android.support.annotation.CheckResult)2 NonNull (android.support.annotation.NonNull)2 BasicHystrixTest (com.netflix.hystrix.contrib.javanica.test.common.BasicHystrixTest)2 User (com.netflix.hystrix.contrib.javanica.test.common.domain.User)2 PreparedWriteOperation (com.pushtorefresh.storio.operations.PreparedWriteOperation)2 OnSubscribeExecuteAsBlockingCompletable (com.pushtorefresh.storio.operations.internal.OnSubscribeExecuteAsBlockingCompletable)2 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)2 InvalidDataAccessApiUsageException (org.springframework.dao.InvalidDataAccessApiUsageException)2 Mono (reactor.core.publisher.Mono)2 CloudException (com.microsoft.azure.CloudException)1 Network (com.microsoft.azure.management.network.Network)1 NetworkInterface (com.microsoft.azure.management.network.NetworkInterface)1