Coverage Summary for Class: GreetingTest (org.example.greeting)
Class |
Method, %
|
Line, %
|
GreetingTest$Get greeting$1 |
GreetingTest$Get greeting$2 |
100%
(1/1)
|
100%
(2/2)
|
GreetingTest$Get greeting$2$1 |
100%
(1/1)
|
100%
(1/1)
|
GreetingTest$Get greeting$2$2 |
100%
(1/1)
|
100%
(3/3)
|
GreetingTest$Get greeting$3 |
100%
(1/1)
|
100%
(1/1)
|
Total |
100%
(4/4)
|
100%
(7/7)
|
1 package org.example.greeting
2
3 import org.example.WebIntegrationTest
4 import org.hamcrest.Matchers.equalTo
5 import org.hamcrest.Matchers.hasSize
6 import org.junit.jupiter.api.Test
7 import org.springframework.http.MediaType.APPLICATION_JSON
8 import org.springframework.test.web.servlet.get
9 import org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath
10
11 class GreetingTest : WebIntegrationTest() {
12 @Test
13 fun `Get greeting`() {
14 mockMvc.get("/greetings") {
15 }.andExpect {
16 status { isOk() }
17 content {
18 contentType(APPLICATION_JSON)
19 jsonPath<List<String>>("$", hasSize(1))
20 jsonPath("$[0]", equalTo("hello"))
21 }
22 }.andDo { print() }
23 }
24 }