Skip to content

Commit

Permalink
Add test for issue #34
Browse files Browse the repository at this point in the history
  • Loading branch information
Piotr Marcinkowski committed Nov 30, 2020
1 parent 25381e0 commit a935c40
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 3 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Project specific
version=1.0.5-SNAPSHOT
version=2.0.0-SNAPSHOT
release.useAutomaticVersion=true

# Performance tuning
Expand Down
4 changes: 2 additions & 2 deletions moco/README.MD
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ stubs.server
.response("Hello! I am sample stub.")
stubs.server
.get(by(uri("/get-json-file")))
.response(jcr(template("/conf/stubs/moco/file-\${req.queries['id']}.json")))
.get(by(uri("/read_query_file")))
.response(jcr(template('/conf/stubs/moco/samples/${req.queries["id"]}.json')))
stubs.server
.get(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,17 @@ public void shouldReturnByMapping() {
.body(containsString("bar"))
.statusCode(200);
}

@Test
public void shouldReturnFileByQueryParam() {
given()
.param("id", "hello-world.stub")
.when()
.get("http://localhost:5555/read_query_file")
.then()
.body(containsString("\"uri\" : \"/foo\""))
.and()
.body(containsString("\"text\" : \"bar\""))
.statusCode(200);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,8 @@ stubs.server
stubs.server
.get(by(uri("/read-itself")))
.response(repository.readText("./hello-world.stub.groovy"))

stubs.server
.get(by(uri("/read_query_file")))
.response(jcr(template('/conf/stubs/moco/samples/${req.queries["id"]}.json')))

0 comments on commit a935c40

Please sign in to comment.