Search in sources :

Example 11 with Arguments

use of com.github.ljtfreitas.julian.Arguments in project julian-http-client by ljtfreitas.

the class FutureResponseTTest method bind.

@Test
void bind(@Mock Promise<Response<String>> promise, @Mock ResponseFn<String, Object> fn) {
    Arguments arguments = Arguments.empty();
    String content = "hello";
    when(fn.run(promise, arguments)).thenReturn(Promise.done(content));
    Future<Object> future = responseT.bind(endpoint, fn).join(promise, arguments);
    assertThat(future.get(), equalTo(content));
}
Also used : Arguments(com.github.ljtfreitas.julian.Arguments) Test(org.junit.jupiter.api.Test)

Example 12 with Arguments

use of com.github.ljtfreitas.julian.Arguments in project julian-http-client by ljtfreitas.

the class OptionResponseTTest method bindNullValue.

@Test
void bindNullValue(@Mock Promise<Response<String>> promise, @Mock ResponseFn<String, Object> fn) {
    Arguments arguments = Arguments.empty();
    when(fn.run(promise, arguments)).thenReturn(Promise.done(null));
    Option<Object> option = responseT.bind(endpoint, fn).join(promise, arguments);
    assertTrue(option.isEmpty());
}
Also used : Arguments(com.github.ljtfreitas.julian.Arguments) Test(org.junit.jupiter.api.Test)

Aggregations

Arguments (com.github.ljtfreitas.julian.Arguments)12 Test (org.junit.jupiter.api.Test)12 Either (io.vavr.control.Either)2 Response (com.github.ljtfreitas.julian.Response)1