Search in sources :

Example 1 with BeanQueryMapEncoder

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

the class AsyncFeignTest method beanQueryMapEncoderWithNullValueIgnored.

@Test
public void beanQueryMapEncoderWithNullValueIgnored() throws Exception {
    TestInterfaceAsync api = new TestInterfaceAsyncBuilder().queryMapEndcoder(new BeanQueryMapEncoder()).target("http://localhost:" + server.getPort());
    PropertyPojo.ChildPojoClass propertyPojo = new PropertyPojo.ChildPojoClass();
    propertyPojo.setName(null);
    propertyPojo.setNumber(1);
    server.enqueue(new MockResponse());
    CompletableFuture<?> cf = api.queryMapPropertyPojo(propertyPojo);
    assertThat(server.takeRequest()).hasQueryParams("number=1");
    checkCFCompletedSoon(cf);
}
Also used : BeanQueryMapEncoder(feign.querymap.BeanQueryMapEncoder) MockResponse(okhttp3.mockwebserver.MockResponse) Test(org.junit.Test)

Example 2 with BeanQueryMapEncoder

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

the class AsyncFeignTest method beanQueryMapEncoderWithPrivateGetterIgnored.

@Test
public void beanQueryMapEncoderWithPrivateGetterIgnored() throws Exception {
    TestInterfaceAsync api = new TestInterfaceAsyncBuilder().queryMapEndcoder(new BeanQueryMapEncoder()).target("http://localhost:" + server.getPort());
    PropertyPojo.ChildPojoClass propertyPojo = new PropertyPojo.ChildPojoClass();
    propertyPojo.setPrivateGetterProperty("privateGetterProperty");
    propertyPojo.setName("Name");
    propertyPojo.setNumber(1);
    server.enqueue(new MockResponse());
    CompletableFuture<?> cf = api.queryMapPropertyPojo(propertyPojo);
    assertThat(server.takeRequest()).hasQueryParams(Arrays.asList("name=Name", "number=1"));
    checkCFCompletedSoon(cf);
}
Also used : BeanQueryMapEncoder(feign.querymap.BeanQueryMapEncoder) MockResponse(okhttp3.mockwebserver.MockResponse) Test(org.junit.Test)

Example 3 with BeanQueryMapEncoder

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

the class Http2ClientAsyncTest method beanQueryMapEncoderWithNullValueIgnored.

@Test
public void beanQueryMapEncoderWithNullValueIgnored() throws Exception {
    final TestInterfaceAsync api = newAsyncBuilder().queryMapEndcoder(new BeanQueryMapEncoder()).target("http://localhost:" + server.getPort());
    final PropertyPojo.ChildPojoClass propertyPojo = new PropertyPojo.ChildPojoClass();
    propertyPojo.setName(null);
    propertyPojo.setNumber(1);
    server.enqueue(new MockResponse());
    final CompletableFuture<?> cf = api.queryMapPropertyPojo(propertyPojo);
    assertThat(server.takeRequest()).hasQueryParams("number=1");
    checkCFCompletedSoon(cf);
}
Also used : BeanQueryMapEncoder(feign.querymap.BeanQueryMapEncoder) MockResponse(okhttp3.mockwebserver.MockResponse) PropertyPojo(feign.PropertyPojo) Test(org.junit.Test)

Example 4 with BeanQueryMapEncoder

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

the class AsyncApacheHttp5ClientTest method beanQueryMapEncoderWithNullValueIgnored.

@Test
public void beanQueryMapEncoderWithNullValueIgnored() throws Exception {
    final TestInterfaceAsync api = new TestInterfaceAsyncBuilder().queryMapEndcoder(new BeanQueryMapEncoder()).target("http://localhost:" + server.getPort());
    final PropertyPojo.ChildPojoClass propertyPojo = new PropertyPojo.ChildPojoClass();
    propertyPojo.setName(null);
    propertyPojo.setNumber(1);
    server.enqueue(new MockResponse());
    final CompletableFuture<?> cf = api.queryMapPropertyPojo(propertyPojo);
    assertThat(server.takeRequest()).hasQueryParams("number=1");
    checkCFCompletedSoon(cf);
}
Also used : BeanQueryMapEncoder(feign.querymap.BeanQueryMapEncoder) MockResponse(okhttp3.mockwebserver.MockResponse) Test(org.junit.Test)

Example 5 with BeanQueryMapEncoder

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

the class FeignTest method beanQueryMapEncoderWithNullValueIgnored.

@Test
public void beanQueryMapEncoderWithNullValueIgnored() throws Exception {
    TestInterface api = new TestInterfaceBuilder().queryMapEndcoder(new BeanQueryMapEncoder()).target("http://localhost:" + server.getPort());
    PropertyPojo.ChildPojoClass propertyPojo = new PropertyPojo.ChildPojoClass();
    propertyPojo.setName(null);
    propertyPojo.setNumber(1);
    server.enqueue(new MockResponse());
    api.queryMapPropertyPojo(propertyPojo);
    assertThat(server.takeRequest()).hasQueryParams("number=1");
}
Also used : BeanQueryMapEncoder(feign.querymap.BeanQueryMapEncoder) MockResponse(okhttp3.mockwebserver.MockResponse) Test(org.junit.Test)

Aggregations

BeanQueryMapEncoder (feign.querymap.BeanQueryMapEncoder)15 MockResponse (okhttp3.mockwebserver.MockResponse)15 Test (org.junit.Test)15 PropertyPojo (feign.PropertyPojo)3