@@ -2,7 +2,8 @@ package springbootkotlin
22
33import com.baeldung.springbootkotlin.HelloDto
44import com.baeldung.springbootkotlin.KotlinDemoApplication
5- import org.junit.Assert
5+ import org.junit.Assert.assertEquals
6+ import org.junit.Assert.assertNotNull
67import org.junit.Test
78import org.junit.runner.RunWith
89import org.springframework.beans.factory.annotation.Autowired
@@ -13,7 +14,7 @@ import org.springframework.test.context.junit4.SpringRunner
1314
1415@RunWith(SpringRunner ::class )
1516@SpringBootTest(classes = arrayOf(KotlinDemoApplication ::class ), webEnvironment = SpringBootTest .WebEnvironment .RANDOM_PORT )
16- class KotlinDemoApplicationTests {
17+ class KotlinDemoApplicationIntegrationTest {
1718
1819 @Autowired
1920 val testRestTemplate: TestRestTemplate ? = null
@@ -26,27 +27,27 @@ class KotlinDemoApplicationTests {
2627 fun testHelloController () {
2728 val result = testRestTemplate?.getForEntity(" /hello" , String ::class .java)
2829
29- Assert . assertNotNull(result)
30- Assert . assertEquals(result?.statusCode, HttpStatus .OK )
31- Assert . assertEquals(result?.body, " hello world" )
30+ assertNotNull(result)
31+ assertEquals(result?.statusCode, HttpStatus .OK )
32+ assertEquals(result?.body, " hello world" )
3233 }
3334
3435 @Test
3536 fun testHelloService () {
3637 val result = testRestTemplate?.getForEntity(" /hello-service" , String ::class .java)
3738
38- Assert . assertNotNull(result)
39- Assert . assertEquals(result?.statusCode, HttpStatus .OK )
40- Assert . assertEquals(result?.body, " hello service" )
39+ assertNotNull(result)
40+ assertEquals(result?.statusCode, HttpStatus .OK )
41+ assertEquals(result?.body, " hello service" )
4142 }
4243
4344 @Test
4445 fun testHelloDto () {
4546 val result = testRestTemplate?.getForEntity(" /hello-dto" , HelloDto ::class .java)
4647
47- Assert . assertNotNull(result)
48- Assert . assertEquals(result?.statusCode, HttpStatus .OK )
49- Assert . assertEquals(result?.body, HelloDto (" Hello from the dto" ))
48+ assertNotNull(result)
49+ assertEquals(result?.statusCode, HttpStatus .OK )
50+ assertEquals(result?.body, HelloDto (" Hello from the dto" ))
5051 }
5152
5253}
0 commit comments