Facing an error while executing the code in Training video 15 Part 1 | Rest Assured Forum
A
Amit Haldar Posted on 25/02/2019

Hello All,

I am on Training Video 15 (Assertions in Rest Assured) , I have added a new dependency in my Pom.xml [json-schema-validator, version 3.1.0]. While running the code I am getting below Error. Please help

Error:

FAILED: test001
java.lang.NoClassDefFoundError: org/hamcrest/xml/HasXPath
at io.restassured.assertion.BodyMatcher.isXPathMatche

-------------------------------------------------------------------------

My code:

package Assertion;

import java.io.File;

import org.testng.annotations.Test;
import static io.restassured.module.jsv.JsonSchemaValidator.matchesJsonSchema;
import io.restassured.RestAssured;
import io.restassured.http.ContentType;

public class JSONscemaValidation {

@Test
public void test001(){
RestAssured.baseURI = "http://localhost:8080";
//RestAssured.port = 8080;
RestAssured.basePath = "/student";

File schema= new File(System.getProperty("user.dir")+"/schema.json");
RestAssured.given().contentType(ContentType.JSON)
.log().all().get("/1").then().body(matchesJsonSchema(schema));

}

}

 

 


A
Abhinav Replied on 29/03/2019

Please share your project zip, if Still not resolved. Or alternatively download the code from download section and compare.