use of com.consol.citrus.message.Message in project citrus-samples by christophd.
the class TodoListIT method testMessageStoreValidationCallback.
@Test
@CitrusTest
public void testMessageStoreValidationCallback() {
http().client(todoClient).send().post("/api/todolist").name("todoRequest").messageType(MessageType.JSON).contentType(ContentType.APPLICATION_JSON.getMimeType()).payload("{\"id\":\"citrus:randomUUID()\",\"title\":\"citrus:concat('todo_',citrus:randomNumber(4))\",\"description\":\"ToDo Description\",\"done\":false}");
echo("citrus:message(todoRequest)");
http().client(todoClient).receive().response(HttpStatus.OK).messageType(MessageType.PLAINTEXT).payload("citrus:jsonPath(citrus:message(todoRequest.payload()), '$.id')");
http().client(todoClient).send().get("/api/todo/citrus:jsonPath(citrus:message(todoRequest.payload()), '$.id')").accept(ContentType.APPLICATION_JSON.getMimeType());
http().client(todoClient).receive().response(HttpStatus.OK).name("todoResponse").messageType(MessageType.JSON).validationCallback((message, context) -> {
Message todoRequest = context.getMessageStore().getMessage("todoRequest");
Assert.assertEquals(message.getPayload(), todoRequest.getPayload());
});
}
Aggregations