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

Popular posts from this blog

Verilog Error: output or inout port "Q" must be connected to a structural net expression -

jasper reports - How to center align barcode using jasperreports and barcode4j -

c# - ASP.NET MVC - Attaching an entity of type 'MODELNAME' failed because another entity of the same type already has the same primary key value -