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;
@Test
public void getUserName() {
public void whenUserNameIsBaeldung_thenWebFilterIsApplied() {
EntityExchangeResult<String> result = webTestClient.get().uri("/users/baeldung")
.exchange()
.expectStatus().isOk()
@ -30,14 +30,9 @@ public class UserControllerTest {
}
@Test
public void getUserNameTest() {
EntityExchangeResult<String> result = webTestClient.get().uri("/users/test")
public void whenUserNameIsTest_thenHandlerFilterFunctionIsNotApplied() {
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");
.expectStatus().isOk();
}
}

View File

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