Search in sources :

Example 1 with HttpRequestBodyConverter

use of org.apache.tapestry5.http.services.HttpRequestBodyConverter in project tapestry-5 by apache.

the class RestSupportImplTest method get_request_body_as_null_result.

@Test
public void get_request_body_as_null_result() {
    HttpRequestBodyConverter converter = new TestHttpRequestBodyConverter(null);
    RestSupport restSupport = new RestSupportImpl(null, converter);
    Optional<String> result = restSupport.getRequestBodyAs(String.class);
    assertFalse(result.isPresent());
}
Also used : HttpRequestBodyConverter(org.apache.tapestry5.http.services.HttpRequestBodyConverter) RestSupportImpl(org.apache.tapestry5.http.internal.services.RestSupportImpl) RestSupport(org.apache.tapestry5.http.services.RestSupport) Test(org.testng.annotations.Test)

Example 2 with HttpRequestBodyConverter

use of org.apache.tapestry5.http.services.HttpRequestBodyConverter in project tapestry-5 by apache.

the class RestSupportImplTest method get_request_body_as_result_provided.

@Test
public void get_request_body_as_result_provided() {
    final String TEXT_CONTENT = "asdfadfasdfs";
    HttpRequestBodyConverter converter = new TestHttpRequestBodyConverter(TEXT_CONTENT);
    RestSupport restSupport = new RestSupportImpl(null, converter);
    Optional<String> result = restSupport.getRequestBodyAs(String.class);
    assertTrue(result.isPresent());
    assertEquals(result.get(), TEXT_CONTENT);
}
Also used : HttpRequestBodyConverter(org.apache.tapestry5.http.services.HttpRequestBodyConverter) RestSupportImpl(org.apache.tapestry5.http.internal.services.RestSupportImpl) RestSupport(org.apache.tapestry5.http.services.RestSupport) Test(org.testng.annotations.Test)

Aggregations

RestSupportImpl (org.apache.tapestry5.http.internal.services.RestSupportImpl)2 HttpRequestBodyConverter (org.apache.tapestry5.http.services.HttpRequestBodyConverter)2 RestSupport (org.apache.tapestry5.http.services.RestSupport)2 Test (org.testng.annotations.Test)2