Skip to content

Commit 1b527ca

Browse files
committed
Comentando os métodos de teste com a descrição do objetivo do teste
1 parent f61b68e commit 1b527ca

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

complete/src/test/java/com/example/restservice/GreetingControllerTests.java

+9
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,22 @@ public class GreetingControllerTests {
3737
@Test
3838
public void noParamGreetingShouldReturnDefaultMessage() throws Exception {
3939

40+
// Realiza uma requisição GET para o endpoint "/greeting".
41+
// O objetivo é verificar se a resposta retorna o status HTTP 200 (OK)
42+
// e se o conteúdo da resposta JSON contém a chave "content" com o valor "Hello, World!".
43+
4044
this.mockMvc.perform(get("/greeting")).andDo(print()).andExpect(status().isOk())
4145
.andExpect(jsonPath("$.content").value("Hello, World!"));
4246
}
4347

4448
@Test
4549
public void paramGreetingShouldReturnTailoredMessage() throws Exception {
4650

51+
// Realiza uma requisição GET para o endpoint "/greeting" com um parâmetro "name" enviado.
52+
// O objetivo é verificar se a resposta retorna o status HTTP 200 (OK)
53+
// e se o conteúdo da resposta JSON contém a chave "content" com uma mensagem personalizada
54+
// que inclui o nome fornecido como parâmetro ("Spring Community").
55+
4756
this.mockMvc.perform(get("/greeting").param("name", "Spring Community"))
4857
.andDo(print()).andExpect(status().isOk())
4958
.andExpect(jsonPath("$.content").value("Hello, Spring Community!"));

0 commit comments

Comments
 (0)