JSON Schema validation not working

1,903 views
Skip to first unread message

Mosley

unread,
Oct 30, 2015, 12:52:19 AM10/30/15
to REST assured
I'm using springboot with rest assured, I was trying some examples, first ones works fine, only I'm having problems when testing with JSON Schema Validation, it thrown me this error:

java.lang.IllegalArgumentException: Schema to use cannot be null

In documentation says that schema file should be located in the classpath, I think there but not working anyway, someone would help me please? thanks in advance :)

Here is where is located currently my schema example.



and here is my code:
given().
contentType("application/json").
when().
get("http://myExample/users").
then().
assertThat().body(matchesJsonSchemaInClasspath("example_schema.json"));

Johan Haleby

unread,
Oct 30, 2015, 3:07:22 AM10/30/15
to rest-a...@googlegroups.com
It looks like there's something wrong with your project setup. Intellij doesn't seem to recognize that it's a java project.

--
You received this message because you are subscribed to the Google Groups "REST assured" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rest-assured...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Andrei Stoica

unread,
Oct 30, 2015, 5:50:38 AM10/30/15
to REST assured
In fact, that's a maven project. Are you sure you imported the project correctly?

Johan Haleby

unread,
Oct 30, 2015, 5:59:19 AM10/30/15
to rest-a...@googlegroups.com
On Fri, Oct 30, 2015 at 10:50 AM, Andrei Stoica <andrei.io...@gmail.com> wrote:
In fact, that's a maven project. Are you sure you imported the project correctly?

Yeah it seems like there's both a build.gradle (for gradle builds) and a pom.xml file (for Maven).
Reply all
Reply to author
Forward
0 new messages