Skip to content

Commit

Permalink
test(topojson): Add first endpoint test for topojson
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelsJP committed Dec 4, 2024
1 parent cd6194f commit 18274ff
Showing 1 changed file with 14 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,13 @@
import static io.restassured.RestAssured.given;
import static org.hamcrest.Matchers.is;
import static org.heigit.ors.apitests.utils.CommonHeaders.jsonContent;

import org.hamcrest.Matchers;

@EndPointAnnotation(name = "export")
@VersionAnnotation(version = "v2")
public class ParamsTest extends ServiceTest {
public ParamsTest(){
class ParamsTest extends ServiceTest {
public ParamsTest() {
JSONArray coord1 = new JSONArray();
coord1.put(0.001);
coord1.put(0.001);
Expand All @@ -36,8 +37,8 @@ public ParamsTest(){

JSONArray bboxProper = new JSONArray();
bboxProper.put(coord2)
.put(coord3);
.put(coord3);

addParameter("bboxFake", bboxMock);
addParameter("bboxFaulty", bboxFaulty);
addParameter("bboxProper", bboxProper);
Expand Down Expand Up @@ -154,7 +155,15 @@ void expectTopoJsonFormat() {
.then().log().all()
.assertThat()
.body("type", is("Topology"))
.body("objects.layers.containsKey('layer')", is(true))
.body("objects.layer.type", is("GeometryCollection"))
.body("bbox.size()", is(4))
// approximations due to float comparison
.body("bbox[0]", is(8.681522F))
.body("bbox[1]", is(49.41491F))
.body("bbox[2]", is(8.686507F))
.body("bbox[3]", is(49.41943F))
.body("arcs.size()", is(128))
.body("objects.layer.geometries.size()", is(128))
.statusCode(200);
}
}

0 comments on commit 18274ff

Please sign in to comment.