Skip to content

Commit df48901

Browse files
authored
Idiomatize testcontainer object creation in kotlin example (#1964)
Co-authored-by: Kevin Wittek <[email protected]>
1 parent b262a20 commit df48901

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

examples/spring-boot-kotlin-redis/src/test/kotlin/com/example/redis/AbstractIntegrationTest.kt

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,8 @@ import org.testcontainers.containers.GenericContainer
1717
abstract class AbstractIntegrationTest {
1818

1919
companion object {
20-
val redisContainer = object : GenericContainer<Nothing>("redis:3-alpine") {
21-
init {
22-
withExposedPorts(6379)
23-
}
24-
}
20+
val redisContainer = GenericContainer<Nothing>("redis:3-alpine")
21+
.apply { withExposedPorts(6379) }
2522
}
2623

2724
internal class Initializer : ApplicationContextInitializer<ConfigurableApplicationContext> {

0 commit comments

Comments
 (0)