Skip to content

Commit 4aaf8b9

Browse files
authored
Fix JUnit issue with Python tests (#148)
* update pom with junit engine Signed-off-by: Hugo Queinnec <hugo.queinnec@ibm.com> * update all python tests Signed-off-by: Hugo Queinnec <hugo.queinnec@ibm.com> --------- Signed-off-by: Hugo Queinnec <hugo.queinnec@ibm.com>
1 parent 27059a2 commit 4aaf8b9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+138
-137
lines changed

pom.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,12 @@
120120
<version>5.11.0</version>
121121
<scope>test</scope>
122122
</dependency>
123+
<dependency>
124+
<groupId>org.junit.jupiter</groupId>
125+
<artifactId>junit-jupiter-engine</artifactId>
126+
<version>5.11.0</version>
127+
<scope>test</scope>
128+
</dependency>
123129
<dependency>
124130
<groupId>org.junit.platform</groupId>
125131
<artifactId>junit-platform-launcher</artifactId>

python/src/test/java/com/ibm/plugin/rules/detection/aead/PycaAESGCMTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,17 +40,17 @@
4040
import com.ibm.plugin.TestBase;
4141
import java.util.List;
4242
import javax.annotation.Nonnull;
43-
import org.junit.Test;
43+
import org.junit.jupiter.api.Test;
4444
import org.sonar.plugins.python.api.PythonCheck;
4545
import org.sonar.plugins.python.api.PythonVisitorContext;
4646
import org.sonar.plugins.python.api.symbols.Symbol;
4747
import org.sonar.plugins.python.api.tree.Tree;
4848
import org.sonar.python.checks.utils.PythonCheckVerifier;
4949

50-
public class PycaAESGCMTest extends TestBase {
50+
class PycaAESGCMTest extends TestBase {
5151

5252
@Test
53-
public void test() {
53+
void test() {
5454
PythonCheckVerifier.verify(
5555
"src/test/files/rules/detection/aead/PycaAESGCMTestFile.py", this);
5656
}

python/src/test/java/com/ibm/plugin/rules/detection/aead/PycaChaCha20Poly1305Test.java

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,20 +36,19 @@
3636
import com.ibm.mapper.model.functionality.Encrypt;
3737
import com.ibm.mapper.model.functionality.KeyGeneration;
3838
import com.ibm.plugin.TestBase;
39-
import com.ibm.plugin.utils.GenerateAssertsHelper;
4039
import java.util.List;
4140
import javax.annotation.Nonnull;
42-
import org.junit.Test;
41+
import org.junit.jupiter.api.Test;
4342
import org.sonar.plugins.python.api.PythonCheck;
4443
import org.sonar.plugins.python.api.PythonVisitorContext;
4544
import org.sonar.plugins.python.api.symbols.Symbol;
4645
import org.sonar.plugins.python.api.tree.Tree;
4746
import org.sonar.python.checks.utils.PythonCheckVerifier;
4847

49-
public class PycaChaCha20Poly1305Test extends TestBase {
48+
class PycaChaCha20Poly1305Test extends TestBase {
5049

5150
@Test
52-
public void test() {
51+
void test() {
5352
PythonCheckVerifier.verify(
5453
"src/test/files/rules/detection/aead/PycaChaCha20Poly1305TestFile.py", this);
5554
}
@@ -83,8 +82,6 @@ public void asserts(
8382
assertThat(encryptValue).isInstanceOf(CipherAction.class);
8483
assertThat(encryptValue.asString()).isEqualTo("DECRYPT");
8584

86-
GenerateAssertsHelper.generate(detectionStore, nodes);
87-
8885
/*
8986
* Translation
9087
*/

python/src/test/java/com/ibm/plugin/rules/detection/asymmetric/DSA/PycaDSANumbersTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,17 +35,17 @@
3535
import com.ibm.plugin.TestBase;
3636
import java.util.List;
3737
import javax.annotation.Nonnull;
38-
import org.junit.Test;
38+
import org.junit.jupiter.api.Test;
3939
import org.sonar.plugins.python.api.PythonCheck;
4040
import org.sonar.plugins.python.api.PythonVisitorContext;
4141
import org.sonar.plugins.python.api.symbols.Symbol;
4242
import org.sonar.plugins.python.api.tree.Tree;
4343
import org.sonar.python.checks.utils.PythonCheckVerifier;
4444

45-
public class PycaDSANumbersTest extends TestBase {
45+
class PycaDSANumbersTest extends TestBase {
4646

4747
@Test
48-
public void test() {
48+
void test() {
4949
PythonCheckVerifier.verify(
5050
"src/test/files/rules/detection/asymmetric/DSA/PycaDSANumbersTestFile.py", this);
5151
}

python/src/test/java/com/ibm/plugin/rules/detection/asymmetric/DSA/PycaDSASignTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,17 +42,17 @@
4242
import com.ibm.plugin.TestBase;
4343
import java.util.List;
4444
import javax.annotation.Nonnull;
45-
import org.junit.Test;
45+
import org.junit.jupiter.api.Test;
4646
import org.sonar.plugins.python.api.PythonCheck;
4747
import org.sonar.plugins.python.api.PythonVisitorContext;
4848
import org.sonar.plugins.python.api.symbols.Symbol;
4949
import org.sonar.plugins.python.api.tree.Tree;
5050
import org.sonar.python.checks.utils.PythonCheckVerifier;
5151

52-
public class PycaDSASignTest extends TestBase {
52+
class PycaDSASignTest extends TestBase {
5353

5454
@Test
55-
public void test() {
55+
void test() {
5656
PythonCheckVerifier.verify(
5757
"src/test/files/rules/detection/asymmetric/DSA/PycaDSASignTestFile.py", this);
5858
}

python/src/test/java/com/ibm/plugin/rules/detection/asymmetric/DiffieHellman/PycaDiffieHellmanGenerateTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
import com.ibm.plugin.TestBase;
3434
import java.util.List;
3535
import javax.annotation.Nonnull;
36-
import org.junit.Test;
36+
import org.junit.jupiter.api.Test;
3737
import org.sonar.plugins.python.api.PythonCheck;
3838
import org.sonar.plugins.python.api.PythonVisitorContext;
3939
import org.sonar.plugins.python.api.symbols.Symbol;
@@ -45,7 +45,7 @@ public final class PycaDiffieHellmanGenerateTest extends TestBase {
4545
// The key size does not yet appear because
4646
// of the TraceSymbol problem documented on the Github issue
4747
@Test
48-
public void test() {
48+
void test() {
4949
PythonCheckVerifier.verify(
5050
"src/test/files/rules/detection/asymmetric/DiffieHellman/PycaDiffieHellmanGenerateTestFile.py",
5151
this);

python/src/test/java/com/ibm/plugin/rules/detection/asymmetric/DiffieHellman/PycaDiffieHellmanNumbersTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,17 +33,17 @@
3333
import com.ibm.plugin.TestBase;
3434
import java.util.List;
3535
import javax.annotation.Nonnull;
36-
import org.junit.Test;
36+
import org.junit.jupiter.api.Test;
3737
import org.sonar.plugins.python.api.PythonCheck;
3838
import org.sonar.plugins.python.api.PythonVisitorContext;
3939
import org.sonar.plugins.python.api.symbols.Symbol;
4040
import org.sonar.plugins.python.api.tree.Tree;
4141
import org.sonar.python.checks.utils.PythonCheckVerifier;
4242

43-
public class PycaDiffieHellmanNumbersTest extends TestBase {
43+
class PycaDiffieHellmanNumbersTest extends TestBase {
4444

4545
@Test
46-
public void test() {
46+
void test() {
4747
PythonCheckVerifier.verify(
4848
"src/test/files/rules/detection/asymmetric/DiffieHellman/PycaDiffieHellmanNumbersTestFile.py",
4949
this);

python/src/test/java/com/ibm/plugin/rules/detection/asymmetric/EllipticCurve/PycaEllipticCurveDeriveTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,17 +34,17 @@
3434
import com.ibm.plugin.TestBase;
3535
import java.util.List;
3636
import javax.annotation.Nonnull;
37-
import org.junit.Test;
37+
import org.junit.jupiter.api.Test;
3838
import org.sonar.plugins.python.api.PythonCheck;
3939
import org.sonar.plugins.python.api.PythonVisitorContext;
4040
import org.sonar.plugins.python.api.symbols.Symbol;
4141
import org.sonar.plugins.python.api.tree.Tree;
4242
import org.sonar.python.checks.utils.PythonCheckVerifier;
4343

44-
public class PycaEllipticCurveDeriveTest extends TestBase {
44+
class PycaEllipticCurveDeriveTest extends TestBase {
4545

4646
@Test
47-
public void test() {
47+
void test() {
4848
PythonCheckVerifier.verify(
4949
"src/test/files/rules/detection/asymmetric/EllipticCurve/PycaEllipticCurveDeriveTestFile.py",
5050
this);

python/src/test/java/com/ibm/plugin/rules/detection/asymmetric/EllipticCurve/PycaEllipticCurveKeyExchangeTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,17 +45,17 @@
4545
import com.ibm.plugin.TestBase;
4646
import java.util.List;
4747
import javax.annotation.Nonnull;
48-
import org.junit.Test;
48+
import org.junit.jupiter.api.Test;
4949
import org.sonar.plugins.python.api.PythonCheck;
5050
import org.sonar.plugins.python.api.PythonVisitorContext;
5151
import org.sonar.plugins.python.api.symbols.Symbol;
5252
import org.sonar.plugins.python.api.tree.Tree;
5353
import org.sonar.python.checks.utils.PythonCheckVerifier;
5454

55-
public class PycaEllipticCurveKeyExchangeTest extends TestBase {
55+
class PycaEllipticCurveKeyExchangeTest extends TestBase {
5656

5757
@Test
58-
public void test() {
58+
void test() {
5959
PythonCheckVerifier.verify(
6060
"src/test/files/rules/detection/asymmetric/EllipticCurve/PycaEllipticCurveKeyExchangeTestFile.py",
6161
this);

python/src/test/java/com/ibm/plugin/rules/detection/asymmetric/EllipticCurve/PycaEllipticCurveNumbersTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,18 +25,18 @@
2525
import java.util.List;
2626
import javax.annotation.Nonnull;
2727
import org.junit.Ignore;
28-
import org.junit.Test;
28+
import org.junit.jupiter.api.Test;
2929
import org.sonar.plugins.python.api.PythonCheck;
3030
import org.sonar.plugins.python.api.PythonVisitorContext;
3131
import org.sonar.plugins.python.api.symbols.Symbol;
3232
import org.sonar.plugins.python.api.tree.Tree;
3333
import org.sonar.python.checks.utils.PythonCheckVerifier;
3434

35-
public class PycaEllipticCurveNumbersTest extends TestBase {
35+
class PycaEllipticCurveNumbersTest extends TestBase {
3636

3737
@Ignore("In this testcase the name of a var is resolved, but not teh actual value.")
3838
@Test
39-
public void test() {
39+
void test() {
4040
PythonCheckVerifier.verify(
4141
"src/test/files/rules/detection/asymmetric/EllipticCurve/PycaEllipticCurveNumbersTestFile.py",
4242
this);

0 commit comments

Comments
 (0)