use of com.tvd12.ezyhttp.core.codec.DataConverters in project ezyhttp by youngmonkeys.
the class DataConvertersTest method addBodyConvertersTest.
@Test
public void addBodyConvertersTest() {
// given
DataConverters sut = new DataConverters(new ObjectMapper());
List<?> bodyConverters = Lists.newArrayList(new JsonConverter(), new Object());
// when
sut.addBodyConverters(bodyConverters);
// then
Asserts.assertEquals(sut.getBodyDeserializer(ContentTypes.APPLICATION_JSON), bodyConverters.get(0));
Asserts.assertEquals(sut.getBodySerializer(ContentTypes.APPLICATION_JSON), bodyConverters.get(0));
}
use of com.tvd12.ezyhttp.core.codec.DataConverters in project ezyhttp by youngmonkeys.
the class DataConvertersTest method getBodySerializerDefaultTest.
@Test
public void getBodySerializerDefaultTest() {
// given
DataConverters sut = new DataConverters(new ObjectMapper());
String contentType = "unknown";
// when
BodySerializer actual = sut.getBodySerializer(contentType);
// then
Asserts.assertEquals(TextBodyConverter.class, actual.getClass());
}
use of com.tvd12.ezyhttp.core.codec.DataConverters in project ezyhttp by youngmonkeys.
the class DataConvertersTest method getBodyDeserializerDefaultTest.
@Test
public void getBodyDeserializerDefaultTest() {
// given
DataConverters sut = new DataConverters(new ObjectMapper());
String contentType = "unknown";
// when
BodyDeserializer actual = sut.getBodyDeserializer(contentType);
// then
Asserts.assertEquals(TextBodyConverter.class, actual.getClass());
}
use of com.tvd12.ezyhttp.core.codec.DataConverters in project ezyhttp by youngmonkeys.
the class DataConvertersTest method getBodyDeserializerNormalTest.
@Test
public void getBodyDeserializerNormalTest() {
// given
DataConverters sut = new DataConverters(new ObjectMapper());
String contentType = ContentTypes.APPLICATION_JSON;
// when
BodyDeserializer actual = sut.getBodyDeserializer(contentType);
// then
Asserts.assertEquals(JsonBodyConverter.class, actual.getClass());
}
use of com.tvd12.ezyhttp.core.codec.DataConverters in project ezyhttp by youngmonkeys.
the class DataConvertersTest method getBodySerializerWithUTF8Test.
@Test
public void getBodySerializerWithUTF8Test() {
// given
DataConverters sut = new DataConverters(new ObjectMapper());
String contentType = ContentTypes.TEXT_HTML_UTF8;
// when
BodySerializer actual = sut.getBodySerializer(contentType);
// then
Asserts.assertEquals(TextBodyConverter.class, actual.getClass());
}
Aggregations