refactoring test names

This commit is contained in:
Fabio Pereira 2018-04-09 21:53:45 -03:00
parent e8ab46e4e4
commit 79ba95812b
2 changed files with 6 additions and 11 deletions

View File

@ -18,7 +18,7 @@ public class UserControllerTest {
private WebTestClient webTestClient; private WebTestClient webTestClient;
@Test @Test
public void getUserName() { public void whenUserNameIsBaeldung_thenWebFilterIsApplied() {
EntityExchangeResult<String> result = webTestClient.get().uri("/users/baeldung") EntityExchangeResult<String> result = webTestClient.get().uri("/users/baeldung")
.exchange() .exchange()
.expectStatus().isOk() .expectStatus().isOk()
@ -30,14 +30,9 @@ public class UserControllerTest {
} }
@Test @Test
public void getUserNameTest() { public void whenUserNameIsTest_thenHandlerFilterFunctionIsNotApplied() {
EntityExchangeResult<String> result = webTestClient.get().uri("/users/test") webTestClient.get().uri("/users/test")
.exchange() .exchange()
.expectStatus().isOk() .expectStatus().isOk();
.expectBody(String.class)
.returnResult();
assertEquals(result.getResponseBody(), "test");
assertEquals(result.getResponseHeaders().getFirst("web-filter"), "web-filter-test");
} }
} }

View File

@ -18,7 +18,7 @@ public class PlayerHandlerTest {
private WebTestClient webTestClient; private WebTestClient webTestClient;
@Test @Test
public void getPlayerName() { public void whenPlayerNameIsBaeldung_thenWebFilterIsApplied() {
EntityExchangeResult<String> result = webTestClient.get().uri("/players/baeldung") EntityExchangeResult<String> result = webTestClient.get().uri("/players/baeldung")
.exchange() .exchange()
.expectStatus().isOk() .expectStatus().isOk()
@ -30,7 +30,7 @@ public class PlayerHandlerTest {
} }
@Test @Test
public void getForbiddenIfPlayerNameIsTest() { public void whenPlayerNameIsTest_thenHandlerFilterFunctionIsApplied() {
webTestClient.get().uri("/players/test") webTestClient.get().uri("/players/test")
.exchange() .exchange()
.expectStatus().isForbidden(); .expectStatus().isForbidden();