Skip to content

Commit

Permalink
Migrate many tests from JUnit 4 to JUnit 5
Browse files Browse the repository at this point in the history
Most of these migrations were mechanized using IntelliJ IDEA followed by
some manual cleanups.  A few were migrated entirely manually, such as
the expected-to-fail tests in `FieldBasedComparisonTest`.
  • Loading branch information
liblit committed Jul 24, 2023
1 parent 486c4a2 commit 426423f
Show file tree
Hide file tree
Showing 124 changed files with 719 additions and 734 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
import java.util.Collections;
import java.util.List;
import java.util.Set;
import org.junit.Test;
import org.junit.jupiter.api.Test;

public class ECJJava17IRTest extends IRTests {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
import java.io.IOException;
import java.util.Collection;
import java.util.List;
import org.junit.Test;
import org.junit.jupiter.api.Test;

public class ECJTestComments extends IRTests {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
*/
package com.ibm.wala.cast.java.test;

import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.junit.jupiter.api.Assertions.fail;

import com.ibm.wala.cast.java.client.JavaSourceAnalysisEngine;
import com.ibm.wala.cast.java.ipa.callgraph.JavaSourceAnalysisScope;
Expand Down Expand Up @@ -235,8 +235,8 @@ public void check(CallGraph cg) {

for (CGNode cgNode : cg.getNodes(mref)) {
assertTrue(
"failed for " + this.variableName + " in " + cgNode + "\n" + cgNode.getIR(),
this.check(cgNode.getMethod(), cgNode.getIR()));
this.check(cgNode.getMethod(), cgNode.getIR()),
"failed for " + this.variableName + " in " + cgNode + "\n" + cgNode.getIR());
}
}

Expand Down Expand Up @@ -315,7 +315,7 @@ public void check(CallGraph cg) {
}
}

assertFalse("cannot find " + at + " in " + cls, false);
assertFalse(false, "cannot find " + at + " in " + cls);
}

annot:
Expand All @@ -333,7 +333,7 @@ public void check(CallGraph cg) {
}
}

assertFalse("cannot find " + at, false);
assertFalse(false, "cannot find " + at);
}
}
}
Expand Down Expand Up @@ -445,7 +445,7 @@ protected static void dumpIR(CallGraph cg, Collection<String> sources, boolean a
}

if (assertReachable) {
assertTrue("unreachable methods: " + unreachable, unreachable.isEmpty());
assertTrue(unreachable.isEmpty(), "unreachable methods: " + unreachable);
}
}

Expand Down Expand Up @@ -507,7 +507,7 @@ public static void populateScope(
for (String srcFilePath : sources) {
String srcFileName = srcFilePath.substring(srcFilePath.lastIndexOf(File.separator) + 1);
File f = new File(srcFilePath);
assertTrue("couldn't find " + srcFilePath, f.exists());
assertTrue(f.exists(), "couldn't find " + srcFilePath);
if (f.isDirectory()) {
engine.addSourceModule(new SourceDirectoryTreeModule(f));
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import com.ibm.wala.util.CancelException;
import com.ibm.wala.util.collections.Pair;
import java.io.IOException;
import org.junit.Test;
import org.junit.jupiter.api.Test;

public abstract class Issue666Test extends IRTests {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import com.ibm.wala.util.CancelException;
import com.ibm.wala.util.collections.Pair;
import java.io.IOException;
import org.junit.Test;
import org.junit.jupiter.api.Test;

public abstract class Issue667Test extends IRTests {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

import com.ibm.wala.util.CancelException;
import java.io.IOException;
import org.junit.Test;
import org.junit.jupiter.api.Test;

public abstract class JLexTest extends IRTests {

Expand Down
Loading

0 comments on commit 426423f

Please sign in to comment.