add: more tests
This commit is contained in:
parent
9f21415451
commit
0a1293f553
|
@ -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");
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -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");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue