From: Kai Moritz Date: Tue, 14 Jan 2020 19:04:27 +0000 (+0100) Subject: Verified, that requests to the RestController without "path" are invalid X-Git-Url: http://juplo.de/gitweb/?a=commitdiff_plain;h=a8d8724d2121865c96692a25fd29ecf0d266bf7e;p=demos%2Ftesting Verified, that requests to the RestController without "path" are invalid --- diff --git a/src/test/java/de/juplo/demo/RestControllerIT.java b/src/test/java/de/juplo/demo/RestControllerIT.java index 1e4e0ad..0334b04 100644 --- a/src/test/java/de/juplo/demo/RestControllerIT.java +++ b/src/test/java/de/juplo/demo/RestControllerIT.java @@ -45,4 +45,22 @@ public class RestControllerIT .expectBody(String.class).isEqualTo("bar"); verify(service).getRemoteText("foo"); } + + @DisplayName("Mappings for RestController without a parameter") + @ParameterizedTest(name = "{arguments} ==> uri={0}") + @ValueSource(strings = { "/", "", "?foo=bar", "/?foo=bar"}) + void testUriWithoutParameter(String uri) + { + webClient + .get() + .uri(uri) + .header("Accept", MediaType.TEXT_PLAIN_VALUE) + .exchange() + .expectStatus().isBadRequest() + .expectBody() + .jsonPath("status").isEqualTo(400) + .jsonPath("error").isEqualTo("Bad Request") + .jsonPath("message").isEqualTo("Required String parameter 'path' is not present") + .jsonPath("timestamp").exists(); + } }