citrus icon indicating copy to clipboard operation
citrus copied to clipboard

Extract is called before validate in http requests

Open chokdee opened this issue 2 years ago • 2 comments

Citrus Version 3.4.0

Expected behavior Validate should be called first, otherwise the error message is confusing.

Actual behavior extract is failing before validate is failing

Test case sample

First example: is failing because status code is wrong (error message is fine)

testRunner.run(http()
                .client(myClient)
                .send()
                .post("/path"))
                .message()
                .header("Accept", "application/json")
                .header("Content-Type", "application/json")
                .body(new ClassPathResource("whatever.json")));
testRunner.run(http()
                .client(myClient)
                .receive()
                .response(HttpStatus.OK)
                .message()
                .type(MessageType.JSON);

Second example is failing in extract method instead of validate

testRunner.run(http()
                .client(myClient)
                .send()
                .post("/path"))
                .message()
                .header("Accept", "application/json")
                .header("Content-Type", "application/json")
                .body(new ClassPathResource("whatever.json")));
testRunner.run(http()
                .client(myClient)
                .receive()
                .response(HttpStatus.OK)
                .message()
                .type(MessageType.JSON)
               .extract(JsonPathSupport.jsonPath().expression("$.id", ${myId}"));

chokdee avatar Mar 08 '23 08:03 chokdee