Search in sources :

Example 1 with FieldQueryMapEncoder

use of feign.querymap.FieldQueryMapEncoder in project feign by OpenFeign.

the class FeignUnderAsyncTest method queryMap_with_child_pojo.

@Test
public void queryMap_with_child_pojo() throws Exception {
    TestInterface api = new TestInterfaceBuilder().queryMapEndcoder(new FieldQueryMapEncoder()).target("http://localhost:" + server.getPort());
    ChildPojo childPojo = new ChildPojo();
    childPojo.setChildPrivateProperty("first");
    childPojo.setParentProtectedProperty("second");
    childPojo.setParentPublicProperty("third");
    server.enqueue(new MockResponse());
    api.queryMapPropertyInheritence(childPojo);
    assertThat(server.takeRequest()).hasQueryParams("parentPublicProperty=third", "parentProtectedProperty=second", "childPrivateProperty=first");
}
Also used : MockResponse(okhttp3.mockwebserver.MockResponse) FieldQueryMapEncoder(feign.querymap.FieldQueryMapEncoder) Test(org.junit.Test)

Example 2 with FieldQueryMapEncoder

use of feign.querymap.FieldQueryMapEncoder in project feign by OpenFeign.

the class AsyncFeignTest method queryMap_with_child_pojo.

@Test
public void queryMap_with_child_pojo() throws Exception {
    TestInterfaceAsync api = new TestInterfaceAsyncBuilder().queryMapEndcoder(new FieldQueryMapEncoder()).target("http://localhost:" + server.getPort());
    ChildPojo childPojo = new ChildPojo();
    childPojo.setChildPrivateProperty("first");
    childPojo.setParentProtectedProperty("second");
    childPojo.setParentPublicProperty("third");
    server.enqueue(new MockResponse());
    CompletableFuture<?> cf = api.queryMapPropertyInheritence(childPojo);
    assertThat(server.takeRequest()).hasQueryParams("parentPublicProperty=third", "parentProtectedProperty=second", "childPrivateProperty=first");
    checkCFCompletedSoon(cf);
}
Also used : MockResponse(okhttp3.mockwebserver.MockResponse) FieldQueryMapEncoder(feign.querymap.FieldQueryMapEncoder) Test(org.junit.Test)

Example 3 with FieldQueryMapEncoder

use of feign.querymap.FieldQueryMapEncoder in project feign by OpenFeign.

the class Http2ClientAsyncTest method queryMap_with_child_pojo.

@Test
public void queryMap_with_child_pojo() throws Exception {
    final TestInterfaceAsync api = newAsyncBuilder().queryMapEndcoder(new FieldQueryMapEncoder()).target("http://localhost:" + server.getPort());
    final ChildPojo childPojo = new ChildPojo();
    childPojo.setChildPrivateProperty("first");
    childPojo.setParentProtectedProperty("second");
    childPojo.setParentPublicProperty("third");
    server.enqueue(new MockResponse());
    final CompletableFuture<?> cf = api.queryMapPropertyInheritence(childPojo);
    assertThat(server.takeRequest()).hasQueryParams("parentPublicProperty=third", "parentProtectedProperty=second", "childPrivateProperty=first");
    checkCFCompletedSoon(cf);
}
Also used : MockResponse(okhttp3.mockwebserver.MockResponse) ChildPojo(feign.ChildPojo) FieldQueryMapEncoder(feign.querymap.FieldQueryMapEncoder) Test(org.junit.Test)

Example 4 with FieldQueryMapEncoder

use of feign.querymap.FieldQueryMapEncoder in project feign by OpenFeign.

the class AsyncApacheHttp5ClientTest method queryMap_with_child_pojo.

@Test
public void queryMap_with_child_pojo() throws Exception {
    final TestInterfaceAsync api = new TestInterfaceAsyncBuilder().queryMapEndcoder(new FieldQueryMapEncoder()).target("http://localhost:" + server.getPort());
    final ChildPojo childPojo = new ChildPojo();
    childPojo.setChildPrivateProperty("first");
    childPojo.setParentProtectedProperty("second");
    childPojo.setParentPublicProperty("third");
    server.enqueue(new MockResponse());
    final CompletableFuture<?> cf = api.queryMapPropertyInheritence(childPojo);
    assertThat(server.takeRequest()).hasQueryParams("parentPublicProperty=third", "parentProtectedProperty=second", "childPrivateProperty=first");
    checkCFCompletedSoon(cf);
}
Also used : MockResponse(okhttp3.mockwebserver.MockResponse) FieldQueryMapEncoder(feign.querymap.FieldQueryMapEncoder) Test(org.junit.Test)

Example 5 with FieldQueryMapEncoder

use of feign.querymap.FieldQueryMapEncoder in project feign by OpenFeign.

the class FeignTest method queryMap_with_child_pojo.

@Test
public void queryMap_with_child_pojo() throws Exception {
    TestInterface api = new TestInterfaceBuilder().queryMapEndcoder(new FieldQueryMapEncoder()).target("http://localhost:" + server.getPort());
    ChildPojo childPojo = new ChildPojo();
    childPojo.setChildPrivateProperty("first");
    childPojo.setParentProtectedProperty("second");
    childPojo.setParentPublicProperty("third");
    server.enqueue(new MockResponse());
    api.queryMapPropertyInheritence(childPojo);
    assertThat(server.takeRequest()).hasQueryParams("parentPublicProperty=third", "parentProtectedProperty=second", "childPrivateProperty=first");
}
Also used : MockResponse(okhttp3.mockwebserver.MockResponse) FieldQueryMapEncoder(feign.querymap.FieldQueryMapEncoder) Test(org.junit.Test)

Aggregations

FieldQueryMapEncoder (feign.querymap.FieldQueryMapEncoder)5 MockResponse (okhttp3.mockwebserver.MockResponse)5 Test (org.junit.Test)5 ChildPojo (feign.ChildPojo)1