Skip to content

Commit 73971c4

Browse files
authored
spring-boot-kotlin refactor (eugenp#1979)
1 parent 5b03025 commit 73971c4

2 files changed

Lines changed: 26 additions & 11 deletions

File tree

‎spring-boot-kotlin/pom.xml‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,20 @@
9393
</dependency>
9494
</dependencies>
9595
</plugin>
96+
<plugin>
97+
<groupId>org.apache.maven.plugins</groupId>
98+
<artifactId>maven-surefire-plugin</artifactId>
99+
<version>${maven-surefire-plugin.version}</version>
100+
<configuration>
101+
<excludes>
102+
<exclude>**/*IntegrationTest.java</exclude>
103+
<exclude>**/*LongRunningUnitTest.java</exclude>
104+
<exclude>**/*ManualTest.java</exclude>
105+
<exclude>**/JdbcTest.java</exclude>
106+
<exclude>**/*LiveTest.java</exclude>
107+
</excludes>
108+
</configuration>
109+
</plugin>
96110
</plugins>
97111
</build>
98112

spring-boot-kotlin/src/test/kotlin/springbootkotlin/KotlinDemoApplicationTests.kt renamed to spring-boot-kotlin/src/test/kotlin/springbootkotlin/KotlinDemoApplicationIntegrationTest.kt

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ package springbootkotlin
22

33
import com.baeldung.springbootkotlin.HelloDto
44
import com.baeldung.springbootkotlin.KotlinDemoApplication
5-
import org.junit.Assert
5+
import org.junit.Assert.assertEquals
6+
import org.junit.Assert.assertNotNull
67
import org.junit.Test
78
import org.junit.runner.RunWith
89
import 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

Comments
 (0)