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());
}
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);
}
Aggregations