use of com.axway.ats.examples.basic.http.testbeans.PersonXmlBean in project ats-framework by Axway.
the class RestOperationTests method get_xmlToJavaObject.
/**
* A GET which returns some XML body.
*
* We serialize the response body to a java instance and use its particular class methods to retrieve the needed data
*/
@Test
public void get_xmlToJavaObject() {
createPersonToManipulateInTheTest();
RestClient client = new RestClient(BASE_URI + "peoplepage/get_xmlBean");
client.addResourcePath("Chuck");
client.addResourcePath("Norris");
client.setResponseMediaType(RestMediaType.APPLICATION_XML);
RestResponse response = client.get();
// get the body as a java object
PersonXmlBean person = response.getBodyAsObject(PersonXmlBean.class);
// now call the different java methods to retrieve the needed data
assertEquals(person.getFirstName(), "Chuck");
assertEquals(person.getLastName(), "Norris");
assertEquals(person.getAge(), 70);
log.info("Got back a java object which is: " + person.toString());
}
Aggregations