Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CALCITE-5356] Update junit4 to 4.13.2 and junit5 to 5.9.1 #2958

Merged
merged 1 commit into from
Nov 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public static void main(String[] args) throws Exception {
}

/** For {@link QuidemTest#test(String)} parameters. */
public static Collection<Object[]> data() {
@Override public Collection<String> getPath() {
// Start with a test file we know exists, then find the directory and list
// its files.
final String first = "sql/select.iq";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public static void main(String[] args) throws Exception {
}

/** For {@link QuidemTest#test(String)} parameters. */
public static Collection<Object[]> data() {
@Override public Collection<String> getPath() {
// Start with a test file we know exists, then find the directory and list
// its files.
final String first = "sql/agg.iq";
Expand Down
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,8 @@ joda-time.version=2.8.1
json-path.version=2.7.0
jsr305.version=3.0.2
jsoup.version=1.11.3
junit4.version=4.12
junit5.version=5.8.1
junit4.version=4.13.2
junit5.version=5.9.1
kafka-clients.version=2.1.1
kerby.version=1.1.1
log4j2.version=2.17.1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public static void main(String[] args) throws Exception {
}

/** For {@link QuidemTest#test(String)} parameters. */
public static Collection<Object[]> data() {
@Override public Collection<String> getPath() {
// Start with a test file we know exists, then find the directory and list
// its files.
final String first = "sql/basic.iq";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public void setup() {
}

/** For {@link QuidemTest#test(String)} parameters. */
public static Collection<Object[]> data() {
@Override protected Collection<String> getPath() {
// Start with a test file we know exists, then find the directory and list
// its files.
final String first = "sql/table.iq";
Expand Down
11 changes: 8 additions & 3 deletions testkit/src/main/java/org/apache/calcite/test/QuidemTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
import net.hydromatic.quidem.CommandHandler;
import net.hydromatic.quidem.Quidem;

import org.junit.jupiter.api.TestInstance;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.MethodSource;

Expand All @@ -63,6 +64,7 @@
/**
* Test that runs every Quidem file as a test.
*/
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
public abstract class QuidemTest {

private static final Pattern PATTERN = Pattern.compile("\\.iq$");
Expand Down Expand Up @@ -112,7 +114,7 @@ private Method findMethod(String path) {
}

@SuppressWarnings("BetaApi")
protected static Collection<Object[]> data(String first) {
protected static Collection<String> data(String first) {
// inUrl = "file:/home/fred/calcite/core/target/test-classes/sql/agg.iq"
final URL inUrl = QuidemTest.class.getResource("/" + n2u(first));
final File firstFile = Sources.of(inUrl).file();
Expand All @@ -123,7 +125,7 @@ protected static Collection<Object[]> data(String first) {
for (File f : Util.first(dir.listFiles(filter), new File[0])) {
paths.add(f.getAbsolutePath().substring(commonPrefixLength));
}
return Util.transform(paths, path -> new Object[] {path});
return paths;
}

protected void checkRun(String path) throws Exception {
Expand Down Expand Up @@ -202,7 +204,7 @@ private static String n2u(String s) {
}

@ParameterizedTest
@MethodSource("data")
@MethodSource("getPath")
public void test(String path) throws Exception {
final Method method = findMethod(path);
if (method != null) {
Expand All @@ -223,6 +225,9 @@ public void test(String path) throws Exception {
}
}

/** Factory method for {@link QuidemTest#test(String)} parameters. */
protected abstract Collection<String> getPath();

/** Quidem connection factory for Calcite's built-in test schemas. */
protected static class QuidemConnectionFactory
implements Quidem.ConnectionFactory {
Expand Down