testcontainers / testcontainers-scala

Docker containers for testing in scala

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to make MySQLContainer and JdbcDatabaseDelegate work together?

yaohuacheng opened this issue · comments

I'm scala beginner.
when I use:
ScriptUtils.runInitScript(new JdbcDatabaseDelegate(mysqlContainer.container, ""), "sql/schema-notification.sql")
I encountered a error:
Type mismatch:
Required: JdbcDatabaseContainer[SELF] forSome {type SELF: JdbcDatabaseContainer[SELF] }
Found: MySQLContainer[_]

I've had to cast container into JdbcDatabaseContainer with wildcard:
container.container.asInstanceOf[org.testcontainers.containers.JdbcDatabaseContainer[_]]

Really weird that JdbcDatabaseDelegate constructor take the raw type.