use of io.restassured.itest.java.objects.Greeting in project rest-assured by rest-assured.
the class MultiPartUploadITest method multiPartUploadingUsesEncoderConfigToKnowHowToSerializeCustomMimeTypesToXml.
@Test
public void multiPartUploadingUsesEncoderConfigToKnowHowToSerializeCustomMimeTypesToXml() throws Exception {
// Given
final Greeting greeting = new Greeting();
greeting.setFirstName("John");
greeting.setLastName("Doe");
// When
given().config(config().encoderConfig(EncoderConfig.encoderConfig().encodeContentTypeAs("application/vnd.ms-excel", ContentType.XML))).multiPart(new MultiPartSpecBuilder(greeting).fileName("RoleBasedAccessFeaturePlan.csv").controlName("text").mimeType("application/vnd.ms-excel").build()).when().post("/multipart/text").then().statusCode(200).body(containsString("John"), containsString("Doe"), containsString("<"));
}
use of io.restassured.itest.java.objects.Greeting in project rest-assured by rest-assured.
the class ObjectMappingITest method serializesUsingJAXBWhenJAXBObjectMapperIsSpecifiedForPatchVerb.
@Test
public void serializesUsingJAXBWhenJAXBObjectMapperIsSpecifiedForPatchVerb() throws Exception {
final Greeting object = new Greeting();
object.setFirstName("John");
object.setLastName("Doe");
final Greeting actual = given().body(object, ObjectMapperType.JAXB).when().patch("/reflect").as(Greeting.class, ObjectMapperType.JAXB);
assertThat(object, equalTo(actual));
}
use of io.restassured.itest.java.objects.Greeting in project rest-assured by rest-assured.
the class ObjectMappingITest method mapResponseToObjectUsingJaxbWithJaxObjectMapperDefined.
@Test
public void mapResponseToObjectUsingJaxbWithJaxObjectMapperDefined() throws Exception {
final Greeting object = given().parameters("firstName", "John", "lastName", "Doe").when().get("/greetXML").as(Greeting.class, ObjectMapperType.JAXB);
assertThat(object.getFirstName(), equalTo("John"));
assertThat(object.getLastName(), equalTo("Doe"));
}
use of io.restassured.itest.java.objects.Greeting in project rest-assured by rest-assured.
the class ObjectMappingITest method whenRequestContentTypeIsXmlAndCharsetIsUtf16ThenRestAssuredSerializesToJSON.
@Test
public void whenRequestContentTypeIsXmlAndCharsetIsUtf16ThenRestAssuredSerializesToJSON() throws Exception {
final Greeting object = new Greeting();
object.setFirstName("John");
object.setLastName("Doe");
final Greeting actual = given().contentType("application/xml; charset=UTF-16").and().body(object).when().post("/reflect").as(Greeting.class);
assertThat(object, equalTo(actual));
}
use of io.restassured.itest.java.objects.Greeting in project rest-assured by rest-assured.
the class ObjectMappingITest method serializesUsingGsonWhenGsonObjectMapperIsSpecified.
@Test
public void serializesUsingGsonWhenGsonObjectMapperIsSpecified() throws Exception {
final Greeting object = new Greeting();
object.setFirstName("John");
object.setLastName("Doe");
final Greeting actual = given().body(object, ObjectMapperType.GSON).when().post("/reflect").as(Greeting.class, ObjectMapperType.GSON);
assertThat(object, equalTo(actual));
}
Aggregations