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

@ -12,8 +12,6 @@
// See the License for the specific language governing permissions and
// limitations under the License.
import org.gradle.api.internal.tasks.userinput.UserInputHandler
plugins {
id "org.flywaydb.flyway" version "6.0.1"
id 'maven-publish'
@ -159,12 +157,12 @@ dependencies {
testCompile deps['com.google.guava:guava']
testCompile deps['com.google.truth:truth']
testRuntime deps['io.github.java-diff-utils:java-diff-utils']
testCompile deps['junit:junit']
testCompile deps['org.junit.jupiter:junit-jupiter-api']
testCompile deps['org.junit.jupiter:junit-jupiter-engine']
testCompile deps['org.junit.vintage:junit-vintage-engine']
testCompile deps['org.testcontainers:postgresql']
testCompile deps['org.testcontainers:testcontainers']
testCompile deps['org.testcontainers:junit-jupiter']
testCompile deps['org.testcontainers:postgresql']
testCompile project(path: ':common', configuration: 'testing')
}

View file

@ -13,7 +13,7 @@ com.google.truth:truth:1.0
com.googlecode.java-diff-utils:diffutils:1.3.0
com.kohlschutter.junixsocket:junixsocket-common:2.0.4
com.kohlschutter.junixsocket:junixsocket-native-common:2.0.4
junit:junit:4.13
junit:junit:4.12
net.java.dev.jna:jna-platform:5.5.0
net.java.dev.jna:jna:5.5.0
org.apache.commons:commons-compress:1.20
@ -27,7 +27,6 @@ org.junit.jupiter:junit-jupiter-api:5.6.2
org.junit.jupiter:junit-jupiter-engine:5.6.2
org.junit.platform:junit-platform-commons:1.6.2
org.junit.platform:junit-platform-engine:1.6.2
org.junit.vintage:junit-vintage-engine:5.6.2
org.junit:junit-bom:5.6.2
org.opentest4j:opentest4j:1.2.0
org.rnorth.duct-tape:duct-tape:1.0.8
@ -37,5 +36,6 @@ org.scijava:native-lib-loader:2.0.2
org.slf4j:slf4j-api:1.7.30
org.testcontainers:database-commons:1.14.3
org.testcontainers:jdbc:1.14.3
org.testcontainers:junit-jupiter:1.14.3
org.testcontainers:postgresql:1.14.3
org.testcontainers:testcontainers:1.14.3

View file

@ -13,7 +13,7 @@ com.google.truth:truth:1.0
com.googlecode.java-diff-utils:diffutils:1.3.0
com.kohlschutter.junixsocket:junixsocket-common:2.0.4
com.kohlschutter.junixsocket:junixsocket-native-common:2.0.4
junit:junit:4.13
junit:junit:4.12
net.java.dev.jna:jna-platform:5.5.0
net.java.dev.jna:jna:5.5.0
org.apache.commons:commons-compress:1.20
@ -27,7 +27,6 @@ org.junit.jupiter:junit-jupiter-api:5.6.2
org.junit.jupiter:junit-jupiter-engine:5.6.2
org.junit.platform:junit-platform-commons:1.6.2
org.junit.platform:junit-platform-engine:1.6.2
org.junit.vintage:junit-vintage-engine:5.6.2
org.junit:junit-bom:5.6.2
org.opentest4j:opentest4j:1.2.0
org.rnorth.duct-tape:duct-tape:1.0.8
@ -37,5 +36,6 @@ org.scijava:native-lib-loader:2.0.2
org.slf4j:slf4j-api:1.7.30
org.testcontainers:database-commons:1.14.3
org.testcontainers:jdbc:1.14.3
org.testcontainers:junit-jupiter:1.14.3
org.testcontainers:postgresql:1.14.3
org.testcontainers:testcontainers:1.14.3

View file

@ -15,7 +15,7 @@ com.googlecode.java-diff-utils:diffutils:1.3.0
com.kohlschutter.junixsocket:junixsocket-common:2.0.4
com.kohlschutter.junixsocket:junixsocket-native-common:2.0.4
io.github.java-diff-utils:java-diff-utils:4.0
junit:junit:4.13
junit:junit:4.12
net.java.dev.jna:jna-platform:5.5.0
net.java.dev.jna:jna:5.5.0
org.apache.commons:commons-compress:1.20
@ -30,7 +30,6 @@ org.junit.jupiter:junit-jupiter-api:5.6.2
org.junit.jupiter:junit-jupiter-engine:5.6.2
org.junit.platform:junit-platform-commons:1.6.2
org.junit.platform:junit-platform-engine:1.6.2
org.junit.vintage:junit-vintage-engine:5.6.2
org.junit:junit-bom:5.6.2
org.opentest4j:opentest4j:1.2.0
org.rnorth.duct-tape:duct-tape:1.0.8
@ -40,5 +39,6 @@ org.scijava:native-lib-loader:2.0.2
org.slf4j:slf4j-api:1.7.30
org.testcontainers:database-commons:1.14.3
org.testcontainers:jdbc:1.14.3
org.testcontainers:junit-jupiter:1.14.3
org.testcontainers:postgresql:1.14.3
org.testcontainers:testcontainers:1.14.3

View file

@ -38,7 +38,7 @@ io.github.java-diff-utils:java-diff-utils:4.0
io.grpc:grpc-context:1.22.1
io.opencensus:opencensus-api:0.24.0
io.opencensus:opencensus-contrib-http-util:0.24.0
junit:junit:4.13
junit:junit:4.12
net.java.dev.jna:jna-platform:5.5.0
net.java.dev.jna:jna:5.5.0
org.apache.commons:commons-compress:1.20
@ -55,7 +55,6 @@ org.junit.jupiter:junit-jupiter-api:5.6.2
org.junit.jupiter:junit-jupiter-engine:5.6.2
org.junit.platform:junit-platform-commons:1.6.2
org.junit.platform:junit-platform-engine:1.6.2
org.junit.vintage:junit-vintage-engine:5.6.2
org.junit:junit-bom:5.6.2
org.opentest4j:opentest4j:1.2.0
org.ow2.asm:asm-analysis:8.0.1
@ -71,5 +70,6 @@ org.scijava:native-lib-loader:2.0.2
org.slf4j:slf4j-api:1.7.30
org.testcontainers:database-commons:1.14.3
org.testcontainers:jdbc:1.14.3
org.testcontainers:junit-jupiter:1.14.3
org.testcontainers:postgresql:1.14.3
org.testcontainers:testcontainers:1.14.3

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()));