Я использую restAssured для проверки моей схемы json. Ниже мой сценарий утверждения: String JsonString = response.asString (); Assert.assertEquals (JsonString, matchJsonSchemaInClasspath ("quotesschema.json"));
И я поместил свой файл quotesschema.json в папку project / bin.
Когда я запускаю свой тестовый скрипт, утверждение не выполняется с сообщением ниже java.lang.AssertionError: ожидаемый [], но обнаружен [фактический ответ api]
Кроме того, я проверил свою схему по ответу api через http://json-schema-validator.herokuapp.com/ валидатор схемы.
Не уверен, читает ли он мою схему внутри файла .son. Ниже моя схема.
{
"type": "object",
"$schema": "http://json-schema.org/draft-03/schema",
"title": "quotes-schema",
"description": "JSON Schema for Quotes",
"properties": {
"result": {
"type": "object",
"properties": {
"Quotes": {
"type": "array",
"properties": {
"DisplaySymbol": {
"type": "string"
},
"Identifier": {
"type": "string"
},
"Exchange": {
"type": "string"
},
"Trade": {
"type": "string"
},
"Date": {
"type": "string"
},
"Change": {
"type": "string"
},
"Bid": {
"type": "string"
},
"BidSize": {
"type": "string"
},
"Ask": {
"type": "string"
},
"AskSize": {
"type": "string"
},
"High": {
"type": "string"
},
"Low": {
"type": "string"
},
"Volume": {
"type": "string"
},
"Open": {
"type": "string"
},
"PreviousClose": {
"type": "string"
},
"High52Week": {
"type": "string"
},
"High52WeekDate": {
"type": "string"
},
"Low52Week": {
"type": "string"
},
"Low52WeekDate": {
"type": "string"
},
"PERatio": {
"type": "string"
},
"MarketCap": {
"type": "string"
},
"SharesOutstanding": {
"type": "string"
},
"RollingEPS": {
"type": "string"
},
"IsDefault": {
"type": "string"
},
"IsIndex": {
"type": "string"
},
"Class": {
"type": "string"
}
}
}
}
}
}
}