add: more tests

This commit is contained in:
Fabio Pereira 2018-04-02 00:20:18 -03:00
parent 9f21415451
commit 0a1293f553
2 changed files with 16 additions and 4 deletions

View File

@ -19,13 +19,25 @@ public class UserControllerTest {
@Test
public void getUserName() {
EntityExchangeResult<String> result = webTestClient.get().uri("/users/fabio")
EntityExchangeResult<String> 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<String> 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");
}
}

View File

@ -19,13 +19,13 @@ public class PlayerHandlerTest {
@Test
public void getPlayerName() {
EntityExchangeResult<String> result = webTestClient.get().uri("/players/fabio")
EntityExchangeResult<String> 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");
}