citrus icon indicating copy to clipboard operation
citrus copied to clipboard

Only one Validator is called in receive response

Open chokdee opened this issue 4 years ago • 1 comments

Citrus Version 3.1.0

Expected behavior All validator shall be called

Actual behavior Only the first is called

Test case sample

$(http().client(client).send()
	.post("/url")
	.message()            
	.header("Content-Type", "application/json")
	.body(new ClassPathResource("citrus/testcase.json")));
$(http()
	.client(cwsClient)
	.receive()
	.response(HttpStatus.BAD_REQUEST)
	.message()
	.type(MessageType.JSON)
	.validate(jsonPath().expression("$.*" , containsString("items[0].state: Destination state can have between 2 and 20 characters.")))
	.validate(jsonPath().expression("$.*" , containsString("items[0].recipient: size must be between 1 and 30"))));

chokdee avatar Nov 07 '21 12:11 chokdee

This is because the expression key $.* is the same for both validate calls. I suppose to use allOf() and combine the validations into one single validate statement

christophd avatar Dec 12 '21 21:12 christophd