Skip to content

Commit 50a5193

Browse files
adjust example test
1 parent e88376e commit 50a5193

2 files changed

Lines changed: 4 additions & 148 deletions

File tree

distribution/src/test/java/com/predic8/membrane/examples/withoutinternet/validation/JSONSchemaMappingsExampleTest.java

Lines changed: 0 additions & 132 deletions
This file was deleted.

distribution/src/test/java/com/predic8/membrane/examples/withoutinternet/validation/JSONSchemaValidationExampleTest.java

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -65,32 +65,20 @@ void port2000() throws Exception {
6565
@Test
6666
void port2001() throws Exception {
6767
try(Process2 ignored = startServiceProxyScript()) {
68-
6968
// @formatter:off
70-
// Test good JSON
71-
given()
72-
.contentType(JSON)
73-
.body(readFileFromBaseDir("good2001.json"))
74-
.when()
75-
.post("http://localhost:2001")
76-
.then()
77-
.statusCode(200);
78-
79-
// Test bad JSON
8069
given()
8170
.contentType(JSON)
8271
.body(readFileFromBaseDir("bad2001.json"))
8372
.when()
8473
.post("http://localhost:2001")
85-
.then()
74+
.then()
8675
.statusCode(400)
8776
.contentType(APPLICATION_PROBLEM_JSON)
8877
.body("title", equalTo("JSON validation failed"))
8978
.body("type", equalTo("https://membrane-api.io/problems/user/validation"))
90-
.body("errors.find { it.pointer == '/properties/id/type' }.message", containsString("integer expected"))
91-
.body("errors.find { it.pointer == '/properties/price/type' }.message", containsString("number expected"))
92-
.body("errors.find { it.pointer == '/properties/tags/type' }.message", containsString("array expected"))
93-
.body("errors.find { it.pointer == '/properties/weight/minimum' }.message", containsString("700"));
79+
.body("errors.find { it.pointer == '/properties/params/minItems' }.message", containsString("at least 2 items"))
80+
.body("errors.find { it.pointer == '/properties/meta/$ref/properties/source/minLength' }.message", containsString("at least 1"))
81+
.body("errors.find { it.pointer == '/properties/meta/$ref/additionalProperties' }.message", containsString("unexpected"));
9482
// @formatter:on
9583

9684
}

0 commit comments

Comments
 (0)