org.rnorth.testcontainers.junit.MySQLContainerRule Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of mysql Show documentation
Show all versions of mysql Show documentation
Test Containers :: JDBC :: MySQL
The newest version!
package org.rnorth.testcontainers.junit;
import org.junit.rules.ExternalResource;
import org.rnorth.testcontainers.containers.MySQLContainer;
/**
* @author richardnorth
*/
public class MySQLContainerRule extends ExternalResource {
private final MySQLContainer container;
public MySQLContainerRule() {
container = new MySQLContainer();
}
@Override
protected void before() throws Throwable {
container.start();
}
@Override
protected void after() {
container.stop();
}
public String getJdbcUrl() {
return container.getJdbcUrl();
}
public String getUsername() {
return container.getUsername();
}
public String getPassword() {
return container.getPassword();
}
}