Added test controller
This commit is contained in:
parent
4eea57c5cf
commit
186990a93e
|
|
@ -0,0 +1,41 @@
|
|||
package ru.touchin.server.info.controllers
|
||||
|
||||
import org.junit.jupiter.api.DisplayName
|
||||
import org.junit.jupiter.api.Test
|
||||
import org.springframework.beans.factory.annotation.Autowired
|
||||
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc
|
||||
import org.springframework.boot.test.context.SpringBootTest
|
||||
import org.springframework.test.context.ActiveProfiles
|
||||
import org.springframework.test.web.servlet.MockMvc
|
||||
import org.springframework.test.web.servlet.request.MockMvcRequestBuilders
|
||||
import org.springframework.test.web.servlet.result.MockMvcResultHandlers
|
||||
import org.springframework.test.web.servlet.result.MockMvcResultMatchers
|
||||
|
||||
@ActiveProfiles("test")
|
||||
@SpringBootTest
|
||||
@AutoConfigureMockMvc
|
||||
class ServerInfoControllerMvcTest {
|
||||
|
||||
@Autowired
|
||||
private lateinit var mockMvc: MockMvc
|
||||
|
||||
@Test
|
||||
fun shouldBeWrappedResponse() {
|
||||
mockMvc
|
||||
.perform(MockMvcRequestBuilders.get("/info"))
|
||||
.andDo(MockMvcResultHandlers.print())
|
||||
.andExpect(MockMvcResultMatchers.status().isOk)
|
||||
.andExpect(MockMvcResultMatchers.content().json(
|
||||
"""
|
||||
{
|
||||
"serverInfo": [
|
||||
{
|
||||
"X-App-Build-Version": "11"
|
||||
}
|
||||
]
|
||||
}
|
||||
""".trimIndent()
|
||||
))
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Reference in New Issue