File tree Expand file tree Collapse file tree 1 file changed +9
-0
lines changed 
complete/src/test/java/com/example/restservice Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Original file line number Diff line number Diff 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!" ));
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments