use of io.restassured.response.ExtractableResponse in project riposte by Nike-Inc.
the class VerifyPayloadHandlingComponentTest method verify_SerializedObject_response_payload_is_sent_as_serialized_json.
@Test
public void verify_SerializedObject_response_payload_is_sent_as_serialized_json() throws IOException, InterruptedException {
ExtractableResponse response = given().baseUri("http://127.0.0.1").port(serverConfig.endpointsPort()).basePath(SerializableObjectPayloadReturner.MATCHING_PATH).log().all().when().post().then().log().all().statusCode(200).extract();
String responsePayload = response.asString();
String expectedHash = response.header(RESPONSE_PAYLOAD_HASH_HEADER_KEY);
String actualHash = getHashForPayload(responsePayload.getBytes(CharsetUtil.UTF_8));
assertThat(actualHash).isEqualTo(expectedHash);
}
use of io.restassured.response.ExtractableResponse in project riposte by Nike-Inc.
the class VerifyPayloadHandlingComponentTest method verify_request_payload_received_for_widget_input_type.
@Test
public void verify_request_payload_received_for_widget_input_type() throws JsonProcessingException {
SerializableObject widget = new SerializableObject(UUID.randomUUID().toString(), generateRandomBytes(32));
String requestPayload = objectMapper.writeValueAsString(widget);
String payloadHash = getHashForPayload(requestPayload.getBytes(CharsetUtil.UTF_8));
ExtractableResponse response = given().baseUri("http://127.0.0.1").port(serverConfig.endpointsPort()).basePath(WidgetTypeDeserializer.MATCHING_PATH).header(REQUEST_PAYLOAD_HASH_HEADER_KEY, payloadHash).body(requestPayload).log().all().when().post().then().log().all().statusCode(200).extract();
String responsePayload = response.asString();
assertThat(responsePayload).isEqualTo("success_widget");
}
Aggregations