add test for health controller
This commit is contained in:
		
					parent
					
						
							
								cf569386ad
							
						
					
				
			
			
				commit
				
					
						834cb559ef
					
				
			
		
					 1 changed files with 26 additions and 0 deletions
				
			
		|  | @ -0,0 +1,26 @@ | |||
| package de.szut.casino.health; | ||||
| 
 | ||||
| import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; | ||||
| import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; | ||||
| import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath; | ||||
| 
 | ||||
| import org.junit.jupiter.api.Test; | ||||
| import org.springframework.beans.factory.annotation.Autowired; | ||||
| import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; | ||||
| import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc; | ||||
| import org.springframework.test.web.servlet.MockMvc; | ||||
| 
 | ||||
| @WebMvcTest(HealthController.class) | ||||
| @AutoConfigureMockMvc(addFilters = false) | ||||
| public class HealthControllerTest { | ||||
| 
 | ||||
|     @Autowired | ||||
|     private MockMvc mockMvc; | ||||
| 
 | ||||
|     @Test | ||||
|     void healthCheckReturnsUpStatus() throws Exception { | ||||
|         mockMvc.perform(get("/health")) | ||||
|                 .andExpect(status().isOk()) | ||||
|                 .andExpect(jsonPath("$.status").value("UP")); | ||||
|     } | ||||
| } | ||||
		Reference in a new issue