Skip to content

Commit 72395c7

Browse files
committed
Improve API Version tests
1 parent 5bf7439 commit 72395c7

File tree

2 files changed

+38
-2
lines changed

2 files changed

+38
-2
lines changed

src/test/java/com/fusiondb/studio/api/VersionIT.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,18 @@
2121

2222
import static com.fusiondb.studio.api.API.getApiBaseUri;
2323
import static io.restassured.RestAssured.when;
24+
import static io.restassured.module.jsv.JsonSchemaValidator.matchesJsonSchemaInClasspath;
25+
import static org.apache.http.HttpStatus.SC_OK;
2426

2527
public class VersionIT {
2628

2729
@Test
2830
public void getServerVersion() {
2931
when().
3032
get(getApiBaseUri() + "/version").
31-
then()
32-
.statusCode(200);
33+
then().
34+
statusCode(SC_OK).
35+
assertThat().
36+
body(matchesJsonSchemaInClasspath("version-schema.json"));
3337
}
3438
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
{
2+
"$schema": "http://json-schema.org/draft-07/schema#",
3+
"title": "Document",
4+
"type": "object",
5+
"required" : [ "version", "server" ],
6+
"properties" : {
7+
"version": {
8+
"type": "string",
9+
"description": "version string",
10+
"example": "1.2.3"
11+
},
12+
"server": {
13+
"type": "object",
14+
"description": "server version",
15+
"properties": {
16+
"product-name": {
17+
"type": "string"
18+
},
19+
"version": {
20+
"type": "string",
21+
"example": "1.2.3"
22+
},
23+
"revision": {
24+
"type": "string"
25+
},
26+
"build": {
27+
"type": "string"
28+
}
29+
}
30+
}
31+
}
32+
}

0 commit comments

Comments
 (0)