Get rid of all remaining JUnit 4 usages except in prober & proxy (#731)

* Get rid of all remaining JUnit 4 usages except in prober & proxy subprojects

Caveat: Test suites aren't yet implemented in JUnit 5 so we still use the ones
from JUnit 5 in the core subproject.

* Fix some build errors
This commit is contained in:
Ben McIlwain 2020-07-30 20:29:00 -04:00 committed by GitHub
parent a02b67caf5
commit 16a31e460c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
347 changed files with 3785 additions and 1536 deletions

View file

@ -25,17 +25,16 @@ import java.net.URL;
import java.nio.charset.StandardCharsets;
import java.nio.file.Paths;
import org.flywaydb.core.Flyway;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
import org.junit.jupiter.api.Test;
import org.testcontainers.containers.BindMode;
import org.testcontainers.containers.Container;
import org.testcontainers.containers.Container.ExecResult;
import org.testcontainers.containers.PostgreSQLContainer;
import org.testcontainers.junit.jupiter.Container;
import org.testcontainers.junit.jupiter.Testcontainers;
/** Unit tests about Cloud SQL schema. */
@RunWith(JUnit4.class)
public class SchemaTest {
@Testcontainers
class SchemaTest {
// Resource path that is mapped to the testcontainer instance.
private static final String MOUNTED_RESOURCE_PATH = "testcontainer/mount";
@ -51,14 +50,14 @@ public class SchemaTest {
* schema generated by the 'pg_dump' command. Compared with communicating over stdout, it is
* easier to update the golden schema this way.
*/
@Rule
public PostgreSQLContainer sqlContainer =
@Container
private PostgreSQLContainer sqlContainer =
new PostgreSQLContainer<>(NomulusPostgreSql.getDockerTag())
.withClasspathResourceMapping(
MOUNTED_RESOURCE_PATH, CONTAINER_MOUNT_POINT, BindMode.READ_WRITE);
@Test
public void deploySchema_success() throws Exception {
void deploySchema_success() throws Exception {
Flyway flyway =
Flyway.configure()
.locations("sql/flyway")
@ -71,7 +70,7 @@ public class SchemaTest {
assertThat(flyway.migrate()).isGreaterThan(0);
flyway.validate();
Container.ExecResult execResult =
ExecResult execResult =
sqlContainer.execInContainer(
StandardCharsets.UTF_8,
getSchemaDumpCommand(sqlContainer.getUsername(), sqlContainer.getDatabaseName()));