use of io.restassured.response.Response in project rest-assured by rest-assured.
the class ResponseITest method pathThrowsExceptionWhenTryingToUseXmlPathAfterHavingUsedJsonPath.
@Test
public void pathThrowsExceptionWhenTryingToUseXmlPathAfterHavingUsedJsonPath() throws Exception {
exception.expect(XmlPathException.class);
exception.expectMessage("Failed to parse the XML document");
Response response = get("/jsonStore");
response.path("store.book.price.min()");
response.xmlPath().get("store.book.price.min()");
}
use of io.restassured.response.Response in project rest-assured by rest-assured.
the class ResponseITest method canParsePathAfterPrint.
@Test
public void canParsePathAfterPrint() throws Exception {
Response response = get("/videos");
response.print();
String title = response.path("videos.music[0].title.toString().trim()");
String artist = response.path("videos.music[0].artist.toString().trim()");
assertThat(title, equalTo("Video Title 1"));
assertThat(artist, equalTo("Artist 1"));
}
use of io.restassured.response.Response in project rest-assured by rest-assured.
the class ResponseITest method canGetAsByteArrayMultipleTimes.
@Test
public void canGetAsByteArrayMultipleTimes() throws Exception {
// When
Response response = get("/videos");
response.asByteArray();
final byte[] bytes = response.asByteArray();
// Then
assertThat(bytes, not(nullValue()));
}
use of io.restassured.response.Response in project rest-assured by rest-assured.
the class ResponseITest method responseSupportsGettingCookies.
@Test
public void responseSupportsGettingCookies() throws Exception {
final Response response = get("/setCookies");
assertEquals(3, response.getCookies().size());
assertEquals(3, response.cookies().size());
assertEquals("value1", response.getCookie("key1"));
assertEquals("value2", response.cookie("key2"));
}
use of io.restassured.response.Response in project rest-assured by rest-assured.
the class ResponseITest method canParsePathAfterPeek.
@Test
public void canParsePathAfterPeek() throws Exception {
Response response = get("/videos").peek();
String title = response.path("videos.music[0].title.toString().trim()");
String artist = response.path("videos.music[0].artist.toString().trim()");
assertThat(title, equalTo("Video Title 1"));
assertThat(artist, equalTo("Artist 1"));
}
Aggregations