Skip to content

Commit

Permalink
Fix test to not use fixed array indexes
Browse files Browse the repository at this point in the history
  • Loading branch information
matthijsln committed Oct 11, 2024
1 parent 5f8af1f commit 928a896
Showing 1 changed file with 15 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,8 @@ void should_contain_description() throws Exception {
authorities = {"Admin"})
void should_return_data_for_configured_app() throws Exception {
final String path = apiBasePath + "/app/default/map";
final String appLayerLufoPath =
"$.appLayers[?(@.id == 'lyr:pdok-hwh-luchtfotorgb:Actueel_orthoHR')]";
mockMvc
.perform(get(path).accept(MediaType.APPLICATION_JSON).with(setServletPath(path)))
.andExpect(status().isOk())
Expand All @@ -230,15 +232,19 @@ void should_return_data_for_configured_app() throws Exception {
// Note: if the testdata was created with MAP5_URL set, the appLayers array will have 4 more
// layers
.andExpect(jsonPath("$.appLayers.length()").value(13))
.andExpect(jsonPath("$.appLayers[0].hasAttributes").value(false))
.andExpect(jsonPath("$.appLayers[1].hasAttributes").value(false))
.andExpect(jsonPath("$.appLayers[4].legendImageUrl").isEmpty())
.andExpect(jsonPath("$.appLayers[4].visible").value(false))
.andExpect(jsonPath("$.appLayers[4].minScale").isEmpty())
.andExpect(jsonPath("$.appLayers[4].maxScale").isEmpty())
.andExpect(jsonPath("$.appLayers[4].id").value("lyr:pdok-hwh-luchtfotorgb:Actueel_orthoHR"))
.andExpect(jsonPath("$.appLayers[4].hiDpiMode").isEmpty())
.andExpect(jsonPath("$.appLayers[4].hiDpiSubstituteLayer").isEmpty())
.andExpect(
jsonPath("$.appLayers[?(@.id == 'lyr:openbasiskaart-tms:xyz')].hasAttributes")
.value(false))
.andExpect(
jsonPath("$.appLayers[?(@.id == 'lyr:b3p-mapproxy-luchtfoto:xyz')].hasAttributes")
.value(false))
.andExpect(jsonPath(appLayerLufoPath).exists())
.andExpect(jsonPath(appLayerLufoPath + ".legendImageUrl").isEmpty())
.andExpect(jsonPath(appLayerLufoPath + ".visible").value(false))
.andExpect(jsonPath(appLayerLufoPath + ".minScale").isEmpty())
.andExpect(jsonPath(appLayerLufoPath + ".maxScale").isEmpty())
.andExpect(jsonPath(appLayerLufoPath + ".hiDpiMode").isEmpty())
.andExpect(jsonPath(appLayerLufoPath + ".hiDpiSubstituteLayer").isEmpty())
.andExpect(jsonPath("$.crs.code").value("EPSG:28992"));
}

Expand Down

0 comments on commit 928a896

Please sign in to comment.