I wrote a simple repository to test Kotlin Exposed with TestContainers. The database that I use is mysql.
Here is my code :
class StudentsRepositoryTest: ShouldSpec({
val container = getMysqlContainer()
val mysqlJdbcUrl = container.jdbcUrl
beforeSpec {
Database.connect(mysqlJdbcUrl, "com.mysql.cj.jdbc.Driver")
transaction {
SchemaUtils.create(Students)
}
}
... // some tests
private fun getMysqlContainer():
…
Top comments (0)