3030import static io .restassured .http .ContentType .JSON ;
3131import static io .restassured .module .jsv .JsonSchemaValidator .matchesJsonSchemaInClasspath ;
3232import static java .nio .charset .StandardCharsets .UTF_8 ;
33+ import static net .javacrumbs .jsonunit .JsonMatchers .jsonEquals ;
3334import static org .apache .http .HttpStatus .*;
35+ import static org .hamcrest .CoreMatchers .containsString ;
3436import static org .hamcrest .CoreMatchers .is ;
37+ import static org .hamcrest .CoreMatchers .not ;
3538
3639public class QueryIT {
3740
@@ -276,7 +279,9 @@ public void serializeQueryAsJsonNoIndent() {
276279 then ().
277280 statusCode (SC_OK ).
278281 assertThat ().
279- body ("results" , is ("{\" a\" :\" b\" ,\" x\" :[\" y\" ,\" z\" ],\" t\" :true,\" f\" :false}" ));
282+ body ("results" , jsonEquals ("{\" a\" :\" b\" ,\" x\" :[\" y\" ,\" z\" ],\" t\" :true,\" f\" :false}" )).
283+ and ().
284+ body ("results" , not (containsString ("\n " )));
280285 }
281286
282287 @ Test
@@ -300,11 +305,10 @@ public void serializeQueryAsJsonIndent() {
300305 then ().
301306 statusCode (SC_OK ).
302307 assertThat ().
303- body ("results" , is ("{\n " +
304- " \" a\" : \" b\" ,\n " +
305- " \" x\" : [ \" y\" , \" z\" ],\n " +
306- " \" t\" : true,\n " +
307- " \" f\" : false\n " +
308- "}" ));
308+ body ("results" , jsonEquals ("{\" a\" :\" b\" ,\" x\" :[\" y\" ,\" z\" ],\" t\" :true,\" f\" :false}" )).
309+ and ().
310+ body ("results" , containsString ("{\n " )).
311+ and ().
312+ body ("results" , containsString ("\n }" ));
309313 }
310314}
0 commit comments