From 0a1293f55336d823c3d7ad22a32227d83a553b4f Mon Sep 17 00:00:00 2001 From: Fabio Pereira Date: Mon, 2 Apr 2018 00:20:18 -0300 Subject: [PATCH] add: more tests --- .../controller/UserControllerTest.java | 16 ++++++++++++++-- .../springwebflux/handler/PlayerHandlerTest.java | 4 ++-- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/spring-webflux/src/test/java/com/baeldung/springwebflux/controller/UserControllerTest.java b/spring-webflux/src/test/java/com/baeldung/springwebflux/controller/UserControllerTest.java index e8d8a5ec7f..471a2f112d 100644 --- a/spring-webflux/src/test/java/com/baeldung/springwebflux/controller/UserControllerTest.java +++ b/spring-webflux/src/test/java/com/baeldung/springwebflux/controller/UserControllerTest.java @@ -19,13 +19,25 @@ public class UserControllerTest { @Test public void getUserName() { - EntityExchangeResult result = webTestClient.get().uri("/users/fabio") + EntityExchangeResult result = webTestClient.get().uri("/users/baeldung") .exchange() .expectStatus().isOk() .expectBody(String.class) .returnResult(); - assertEquals(result.getResponseBody(), "fabio"); + assertEquals(result.getResponseBody(), "baeldung"); + assertEquals(result.getResponseHeaders().getFirst("web-filter"), "web-filter-test"); + } + + @Test + public void getUserNameTest() { + EntityExchangeResult result = webTestClient.get().uri("/users/test") + .exchange() + .expectStatus().isOk() + .expectBody(String.class) + .returnResult(); + + assertEquals(result.getResponseBody(), "test"); assertEquals(result.getResponseHeaders().getFirst("web-filter"), "web-filter-test"); } } \ No newline at end of file diff --git a/spring-webflux/src/test/java/com/baeldung/springwebflux/handler/PlayerHandlerTest.java b/spring-webflux/src/test/java/com/baeldung/springwebflux/handler/PlayerHandlerTest.java index 3a7d4d0493..14d9043102 100644 --- a/spring-webflux/src/test/java/com/baeldung/springwebflux/handler/PlayerHandlerTest.java +++ b/spring-webflux/src/test/java/com/baeldung/springwebflux/handler/PlayerHandlerTest.java @@ -19,13 +19,13 @@ public class PlayerHandlerTest { @Test public void getPlayerName() { - EntityExchangeResult result = webTestClient.get().uri("/players/fabio") + EntityExchangeResult result = webTestClient.get().uri("/players/baeldung") .exchange() .expectStatus().isOk() .expectBody(String.class) .returnResult(); - assertEquals(result.getResponseBody(), "fabio"); + assertEquals(result.getResponseBody(), "baeldung"); assertEquals(result.getResponseHeaders().getFirst("web-filter"), "web-filter-test"); }