From b37998d3eda0fc3e86fc45a22c2aea2305a5edfb Mon Sep 17 00:00:00 2001 From: Sally MacFarlane Date: Tue, 5 Dec 2023 15:29:44 +1000 Subject: [PATCH] migrate to junit5 Signed-off-by: Sally MacFarlane --- crypto/algorithms/build.gradle | 1 - .../org/hyperledger/besu/crypto/ECPointUtilTest.java | 2 +- .../java/org/hyperledger/besu/crypto/HashTest.java | 2 +- .../java/org/hyperledger/besu/crypto/KeyPairTest.java | 6 +++--- .../org/hyperledger/besu/crypto/KeyPairUtilTest.java | 2 +- .../org/hyperledger/besu/crypto/SECP256K1Test.java | 10 +++++----- .../org/hyperledger/besu/crypto/SECP256R1Test.java | 10 +++++----- .../hyperledger/besu/crypto/SECPPrivateKeyTest.java | 6 +++--- .../org/hyperledger/besu/crypto/SECPPublicKeyTest.java | 6 +++--- .../org/hyperledger/besu/crypto/SECPSignatureTest.java | 6 +++--- .../besu/crypto/SignatureAlgorithmFactoryTest.java | 6 +++--- .../besu/crypto/SignatureAlgorithmTypeTest.java | 2 +- .../besu/crypto/altbn128/AltBn128Fq12PairerTest.java | 2 +- .../besu/crypto/altbn128/AltBn128Fq12PointTest.java | 2 +- .../besu/crypto/altbn128/AltBn128Fq2PointTest.java | 2 +- .../besu/crypto/altbn128/AltBn128PointTest.java | 2 +- .../org/hyperledger/besu/crypto/altbn128/Fq12Test.java | 2 +- .../org/hyperledger/besu/crypto/altbn128/Fq2Test.java | 2 +- .../org/hyperledger/besu/crypto/altbn128/FqTest.java | 2 +- 19 files changed, 36 insertions(+), 37 deletions(-) diff --git a/crypto/algorithms/build.gradle b/crypto/algorithms/build.gradle index dcddb83be34..190ecae4a21 100644 --- a/crypto/algorithms/build.gradle +++ b/crypto/algorithms/build.gradle @@ -40,7 +40,6 @@ dependencies { implementation 'org.hyperledger.besu:blake2bf' implementation 'com.google.guava:guava' - testImplementation 'junit:junit' testImplementation 'org.assertj:assertj-core' testImplementation 'org.junit.jupiter:junit-jupiter' diff --git a/crypto/algorithms/src/test/java/org/hyperledger/besu/crypto/ECPointUtilTest.java b/crypto/algorithms/src/test/java/org/hyperledger/besu/crypto/ECPointUtilTest.java index ac95635ef1e..ff802516575 100644 --- a/crypto/algorithms/src/test/java/org/hyperledger/besu/crypto/ECPointUtilTest.java +++ b/crypto/algorithms/src/test/java/org/hyperledger/besu/crypto/ECPointUtilTest.java @@ -20,7 +20,7 @@ import java.security.spec.ECPoint; import org.apache.tuweni.bytes.Bytes; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class ECPointUtilTest { diff --git a/crypto/algorithms/src/test/java/org/hyperledger/besu/crypto/HashTest.java b/crypto/algorithms/src/test/java/org/hyperledger/besu/crypto/HashTest.java index a2d8318e120..bc71c0c1530 100644 --- a/crypto/algorithms/src/test/java/org/hyperledger/besu/crypto/HashTest.java +++ b/crypto/algorithms/src/test/java/org/hyperledger/besu/crypto/HashTest.java @@ -19,7 +19,7 @@ import org.apache.tuweni.bytes.Bytes; import org.bouncycastle.util.encoders.Hex; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class HashTest { diff --git a/crypto/algorithms/src/test/java/org/hyperledger/besu/crypto/KeyPairTest.java b/crypto/algorithms/src/test/java/org/hyperledger/besu/crypto/KeyPairTest.java index a8c1ac7e8f0..4155d2c5a4d 100644 --- a/crypto/algorithms/src/test/java/org/hyperledger/besu/crypto/KeyPairTest.java +++ b/crypto/algorithms/src/test/java/org/hyperledger/besu/crypto/KeyPairTest.java @@ -28,8 +28,8 @@ import org.bouncycastle.asn1.x9.X9ECParameters; import org.bouncycastle.crypto.params.ECDomainParameters; import org.bouncycastle.jce.provider.BouncyCastleProvider; -import org.junit.BeforeClass; -import org.junit.Test; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; public class KeyPairTest { public static final String ALGORITHM = SignatureAlgorithm.ALGORITHM; @@ -39,7 +39,7 @@ public class KeyPairTest { public static KeyPairGenerator keyPairGenerator; public static ECDomainParameters curve; - @BeforeClass + @BeforeAll public static void setUp() { Security.addProvider(new BouncyCastleProvider()); diff --git a/crypto/algorithms/src/test/java/org/hyperledger/besu/crypto/KeyPairUtilTest.java b/crypto/algorithms/src/test/java/org/hyperledger/besu/crypto/KeyPairUtilTest.java index 13c78d52bdc..cc2bcb0f460 100644 --- a/crypto/algorithms/src/test/java/org/hyperledger/besu/crypto/KeyPairUtilTest.java +++ b/crypto/algorithms/src/test/java/org/hyperledger/besu/crypto/KeyPairUtilTest.java @@ -19,7 +19,7 @@ import java.io.File; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class KeyPairUtilTest { diff --git a/crypto/algorithms/src/test/java/org/hyperledger/besu/crypto/SECP256K1Test.java b/crypto/algorithms/src/test/java/org/hyperledger/besu/crypto/SECP256K1Test.java index 060bdad844b..28fb0fb4f1c 100644 --- a/crypto/algorithms/src/test/java/org/hyperledger/besu/crypto/SECP256K1Test.java +++ b/crypto/algorithms/src/test/java/org/hyperledger/besu/crypto/SECP256K1Test.java @@ -28,9 +28,9 @@ import org.apache.tuweni.bytes.Bytes; import org.apache.tuweni.bytes.Bytes32; -import org.junit.Before; -import org.junit.BeforeClass; -import org.junit.Test; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class SECP256K1Test { @@ -39,7 +39,7 @@ public class SECP256K1Test { protected static String suiteStartTime = null; protected static String suiteName = null; - @BeforeClass + @BeforeAll public static void setTestSuiteStartTime() { suiteStartTime = LocalDateTime.now(ZoneId.systemDefault()) @@ -47,7 +47,7 @@ public static void setTestSuiteStartTime() { suiteName(SECP256K1Test.class); } - @Before + @BeforeEach public void setUp() { secp256K1 = new SECP256K1(); } diff --git a/crypto/algorithms/src/test/java/org/hyperledger/besu/crypto/SECP256R1Test.java b/crypto/algorithms/src/test/java/org/hyperledger/besu/crypto/SECP256R1Test.java index bd791ef9be3..26e03e5bd3c 100644 --- a/crypto/algorithms/src/test/java/org/hyperledger/besu/crypto/SECP256R1Test.java +++ b/crypto/algorithms/src/test/java/org/hyperledger/besu/crypto/SECP256R1Test.java @@ -29,9 +29,9 @@ import org.apache.tuweni.bytes.Bytes; import org.apache.tuweni.bytes.Bytes32; -import org.junit.Before; -import org.junit.BeforeClass; -import org.junit.Test; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class SECP256R1Test { @@ -103,7 +103,7 @@ public class SECP256R1Test { protected static String suiteStartTime = null; protected static String suiteName = null; - @BeforeClass + @BeforeAll public static void setTestSuiteStartTime() { suiteStartTime = LocalDateTime.now(ZoneId.systemDefault()) @@ -113,7 +113,7 @@ public static void setTestSuiteStartTime() { SignatureAlgorithmFactory.setInstance(SignatureAlgorithmType.create("secp256r1")); } - @Before + @BeforeEach public void setUp() { secp256R1 = new SECP256R1(); } diff --git a/crypto/algorithms/src/test/java/org/hyperledger/besu/crypto/SECPPrivateKeyTest.java b/crypto/algorithms/src/test/java/org/hyperledger/besu/crypto/SECPPrivateKeyTest.java index d99d4940915..24fbdb05288 100644 --- a/crypto/algorithms/src/test/java/org/hyperledger/besu/crypto/SECPPrivateKeyTest.java +++ b/crypto/algorithms/src/test/java/org/hyperledger/besu/crypto/SECPPrivateKeyTest.java @@ -29,8 +29,8 @@ import org.bouncycastle.asn1.sec.SECNamedCurves; import org.bouncycastle.asn1.x9.X9ECParameters; import org.bouncycastle.crypto.params.ECDomainParameters; -import org.junit.BeforeClass; -import org.junit.Test; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; public class SECPPrivateKeyTest { public static final String ALGORITHM = SignatureAlgorithm.ALGORITHM; @@ -40,7 +40,7 @@ public class SECPPrivateKeyTest { protected static String suiteName = null; public static ECDomainParameters curve; - @BeforeClass + @BeforeAll public static void setUp() { suiteStartTime = LocalDateTime.now(ZoneId.systemDefault()) diff --git a/crypto/algorithms/src/test/java/org/hyperledger/besu/crypto/SECPPublicKeyTest.java b/crypto/algorithms/src/test/java/org/hyperledger/besu/crypto/SECPPublicKeyTest.java index e5e9e6bb3a0..fe6e08404d5 100644 --- a/crypto/algorithms/src/test/java/org/hyperledger/besu/crypto/SECPPublicKeyTest.java +++ b/crypto/algorithms/src/test/java/org/hyperledger/besu/crypto/SECPPublicKeyTest.java @@ -24,8 +24,8 @@ import org.bouncycastle.asn1.sec.SECNamedCurves; import org.bouncycastle.asn1.x9.X9ECParameters; import org.bouncycastle.crypto.params.ECDomainParameters; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class SECPPublicKeyTest { public static final String ALGORITHM = SignatureAlgorithm.ALGORITHM; @@ -33,7 +33,7 @@ public class SECPPublicKeyTest { public ECDomainParameters curve; - @Before + @BeforeEach public void setUp() { final X9ECParameters params = SECNamedCurves.getByName(CURVE_NAME); curve = new ECDomainParameters(params.getCurve(), params.getG(), params.getN(), params.getH()); diff --git a/crypto/algorithms/src/test/java/org/hyperledger/besu/crypto/SECPSignatureTest.java b/crypto/algorithms/src/test/java/org/hyperledger/besu/crypto/SECPSignatureTest.java index a737a93f0b1..4298f662067 100644 --- a/crypto/algorithms/src/test/java/org/hyperledger/besu/crypto/SECPSignatureTest.java +++ b/crypto/algorithms/src/test/java/org/hyperledger/besu/crypto/SECPSignatureTest.java @@ -22,15 +22,15 @@ import org.bouncycastle.asn1.sec.SECNamedCurves; import org.bouncycastle.asn1.x9.X9ECParameters; import org.bouncycastle.crypto.params.ECDomainParameters; -import org.junit.BeforeClass; -import org.junit.Test; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; public class SECPSignatureTest { public static final String CURVE_NAME = "secp256k1"; public static BigInteger curveOrder; - @BeforeClass + @BeforeAll public static void setUp() { final X9ECParameters params = SECNamedCurves.getByName(CURVE_NAME); final ECDomainParameters curve = diff --git a/crypto/algorithms/src/test/java/org/hyperledger/besu/crypto/SignatureAlgorithmFactoryTest.java b/crypto/algorithms/src/test/java/org/hyperledger/besu/crypto/SignatureAlgorithmFactoryTest.java index 38c71c99db8..cabdaa7668a 100644 --- a/crypto/algorithms/src/test/java/org/hyperledger/besu/crypto/SignatureAlgorithmFactoryTest.java +++ b/crypto/algorithms/src/test/java/org/hyperledger/besu/crypto/SignatureAlgorithmFactoryTest.java @@ -17,12 +17,12 @@ import static org.assertj.core.api.AssertionsForClassTypes.assertThat; import static org.assertj.core.api.AssertionsForClassTypes.assertThatThrownBy; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class SignatureAlgorithmFactoryTest { - @Before + @BeforeEach public void setUp() { SignatureAlgorithmFactory.resetInstance(); } diff --git a/crypto/algorithms/src/test/java/org/hyperledger/besu/crypto/SignatureAlgorithmTypeTest.java b/crypto/algorithms/src/test/java/org/hyperledger/besu/crypto/SignatureAlgorithmTypeTest.java index faa0b5eeda7..13b37a05612 100644 --- a/crypto/algorithms/src/test/java/org/hyperledger/besu/crypto/SignatureAlgorithmTypeTest.java +++ b/crypto/algorithms/src/test/java/org/hyperledger/besu/crypto/SignatureAlgorithmTypeTest.java @@ -17,7 +17,7 @@ import static org.assertj.core.api.Assertions.assertThatThrownBy; import static org.assertj.core.api.AssertionsForClassTypes.assertThat; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class SignatureAlgorithmTypeTest { @Test diff --git a/crypto/algorithms/src/test/java/org/hyperledger/besu/crypto/altbn128/AltBn128Fq12PairerTest.java b/crypto/algorithms/src/test/java/org/hyperledger/besu/crypto/altbn128/AltBn128Fq12PairerTest.java index 18da8a44fcb..d88c54269fe 100644 --- a/crypto/algorithms/src/test/java/org/hyperledger/besu/crypto/altbn128/AltBn128Fq12PairerTest.java +++ b/crypto/algorithms/src/test/java/org/hyperledger/besu/crypto/altbn128/AltBn128Fq12PairerTest.java @@ -18,7 +18,7 @@ import java.math.BigInteger; -import org.junit.Test; +import org.junit.jupiter.api.Test; /** * Adapted from the pc_ecc (Apache 2 License) implementation: diff --git a/crypto/algorithms/src/test/java/org/hyperledger/besu/crypto/altbn128/AltBn128Fq12PointTest.java b/crypto/algorithms/src/test/java/org/hyperledger/besu/crypto/altbn128/AltBn128Fq12PointTest.java index 75f153e814a..0a57b76ff0f 100644 --- a/crypto/algorithms/src/test/java/org/hyperledger/besu/crypto/altbn128/AltBn128Fq12PointTest.java +++ b/crypto/algorithms/src/test/java/org/hyperledger/besu/crypto/altbn128/AltBn128Fq12PointTest.java @@ -18,7 +18,7 @@ import java.math.BigInteger; -import org.junit.Test; +import org.junit.jupiter.api.Test; /** * Adapted from the pc_ecc (Apache 2 License) implementation: diff --git a/crypto/algorithms/src/test/java/org/hyperledger/besu/crypto/altbn128/AltBn128Fq2PointTest.java b/crypto/algorithms/src/test/java/org/hyperledger/besu/crypto/altbn128/AltBn128Fq2PointTest.java index 56c925a5647..5d0871505f4 100644 --- a/crypto/algorithms/src/test/java/org/hyperledger/besu/crypto/altbn128/AltBn128Fq2PointTest.java +++ b/crypto/algorithms/src/test/java/org/hyperledger/besu/crypto/altbn128/AltBn128Fq2PointTest.java @@ -18,7 +18,7 @@ import java.math.BigInteger; -import org.junit.Test; +import org.junit.jupiter.api.Test; /** * Adapted from the pc_ecc (Apache 2 License) implementation: diff --git a/crypto/algorithms/src/test/java/org/hyperledger/besu/crypto/altbn128/AltBn128PointTest.java b/crypto/algorithms/src/test/java/org/hyperledger/besu/crypto/altbn128/AltBn128PointTest.java index 5794753c4a7..9f0a783a583 100644 --- a/crypto/algorithms/src/test/java/org/hyperledger/besu/crypto/altbn128/AltBn128PointTest.java +++ b/crypto/algorithms/src/test/java/org/hyperledger/besu/crypto/altbn128/AltBn128PointTest.java @@ -18,7 +18,7 @@ import java.math.BigInteger; -import org.junit.Test; +import org.junit.jupiter.api.Test; /** * Adapted from the pc_ecc (Apache 2 License) implementation: diff --git a/crypto/algorithms/src/test/java/org/hyperledger/besu/crypto/altbn128/Fq12Test.java b/crypto/algorithms/src/test/java/org/hyperledger/besu/crypto/altbn128/Fq12Test.java index fb806866afe..081bcadf207 100644 --- a/crypto/algorithms/src/test/java/org/hyperledger/besu/crypto/altbn128/Fq12Test.java +++ b/crypto/algorithms/src/test/java/org/hyperledger/besu/crypto/altbn128/Fq12Test.java @@ -16,7 +16,7 @@ import static org.assertj.core.api.Assertions.assertThat; -import org.junit.Test; +import org.junit.jupiter.api.Test; /** * Adapted from the pc_ecc (Apache 2 License) implementation: diff --git a/crypto/algorithms/src/test/java/org/hyperledger/besu/crypto/altbn128/Fq2Test.java b/crypto/algorithms/src/test/java/org/hyperledger/besu/crypto/altbn128/Fq2Test.java index 6f3bc862ba9..9164657387e 100644 --- a/crypto/algorithms/src/test/java/org/hyperledger/besu/crypto/altbn128/Fq2Test.java +++ b/crypto/algorithms/src/test/java/org/hyperledger/besu/crypto/altbn128/Fq2Test.java @@ -18,7 +18,7 @@ import java.math.BigInteger; -import org.junit.Test; +import org.junit.jupiter.api.Test; /** * Adapted from the pc_ecc (Apache 2 License) implementation: diff --git a/crypto/algorithms/src/test/java/org/hyperledger/besu/crypto/altbn128/FqTest.java b/crypto/algorithms/src/test/java/org/hyperledger/besu/crypto/altbn128/FqTest.java index 8eab290be31..8752cb14d1a 100644 --- a/crypto/algorithms/src/test/java/org/hyperledger/besu/crypto/altbn128/FqTest.java +++ b/crypto/algorithms/src/test/java/org/hyperledger/besu/crypto/altbn128/FqTest.java @@ -18,7 +18,7 @@ import java.math.BigInteger; -import org.junit.Test; +import org.junit.jupiter.api.Test; /** * Adapted from the pc_ecc (Apache 2 License) implementation: