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 @Test
public void getUserName() { public void getUserName() {
EntityExchangeResult<String> result = webTestClient.get().uri("/users/fabio") EntityExchangeResult<String> result = webTestClient.get().uri("/users/baeldung")
.exchange() .exchange()
.expectStatus().isOk() .expectStatus().isOk()
.expectBody(String.class) .expectBody(String.class)
.returnResult(); .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"); assertEquals(result.getResponseHeaders().getFirst("web-filter"), "web-filter-test");
} }
} }

View File

@ -19,13 +19,13 @@ public class PlayerHandlerTest {
@Test @Test
public void getPlayerName() { public void getPlayerName() {
EntityExchangeResult<String> result = webTestClient.get().uri("/players/fabio") EntityExchangeResult<String> result = webTestClient.get().uri("/players/baeldung")
.exchange() .exchange()
.expectStatus().isOk() .expectStatus().isOk()
.expectBody(String.class) .expectBody(String.class)
.returnResult(); .returnResult();
assertEquals(result.getResponseBody(), "fabio"); assertEquals(result.getResponseBody(), "baeldung");
assertEquals(result.getResponseHeaders().getFirst("web-filter"), "web-filter-test"); assertEquals(result.getResponseHeaders().getFirst("web-filter"), "web-filter-test");
} }