java - JSON validation using REST assured -
I am trying to validate the Jason object. I use,
import static com.jayway.restassured.module.jsv.JsonSchemaValidator.matchesJsonSchemaInClasspath; Static org.hamcrest import. MatcherAsertSet; Import org.junit.Test; Public class testclass {@Test public void validates_schema_in_classpath () {// string jasonstring = "{\" status \ ": false}"; // The response of the greeting / again emphasizes that (JsonString, Maxen Sachema Inclasspath ("Gritter Schema. Jason")); }} greeter-schema.json:
I have a good result, even if JsonString is not with the success of "{\": "wrong} ". For example, I get the result correctly when JsonString = "{\" is success \ ": false}, {\" isfalse \ ": true}", or "{\" isccess {": false}, Testetstets
Your JSON schema only checks that the attribute "isSuccess" exists, it should not be either Right or wrong, you can do it with Jason Schema, but I do not know it by heart you probably can check Google for it.
Comments
Post a Comment