Skip to content

Commit e90a7fa

Browse files
authored
[MINOR] migrate remaining Crypto tests to junit 5 (#6280)
* update crypto tests to junit5 * fixed temp file * removed vintage junit dep Signed-off-by: Sally MacFarlane <macfarla.github@gmail.com> --------- Signed-off-by: Sally MacFarlane <macfarla.github@gmail.com>
1 parent 9f8f121 commit e90a7fa

File tree

3 files changed

+8
-15
lines changed

3 files changed

+8
-15
lines changed

crypto/services/build.gradle

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,8 @@ dependencies {
3232
api project(':crypto:algorithms')
3333
api project(':plugin-api')
3434

35-
testImplementation 'junit:junit'
3635
testImplementation 'org.assertj:assertj-core'
3736
testImplementation 'org.junit.jupiter:junit-jupiter'
38-
39-
testRuntimeOnly 'org.junit.vintage:junit-vintage-engine'
4037
}
4138

4239
artifacts { testSupportArtifacts testSupportJar }

crypto/services/src/test/java/org/hyperledger/besu/cryptoservices/KeyPairSecurityModuleTest.java

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,26 +20,22 @@
2020
import org.hyperledger.besu.crypto.SECPPublicKey;
2121
import org.hyperledger.besu.crypto.SignatureAlgorithmFactory;
2222

23-
import java.io.File;
2423
import java.io.IOException;
24+
import java.nio.file.Path;
2525
import java.security.spec.ECPoint;
2626

2727
import org.apache.tuweni.bytes.Bytes;
2828
import org.assertj.core.api.Assertions;
29-
import org.junit.Rule;
30-
import org.junit.Test;
31-
import org.junit.rules.TemporaryFolder;
29+
import org.junit.jupiter.api.Test;
30+
import org.junit.jupiter.api.io.TempDir;
3231

3332
public class KeyPairSecurityModuleTest {
3433

35-
@Rule public final TemporaryFolder temp = new TemporaryFolder();
34+
@TempDir public Path keyFile;
3635

3736
@Test
3837
public void validatePublicKeyFromECPointCanBeConstructed() throws IOException {
39-
final File keyDirectory = temp.newFolder();
40-
final File keyFile = new File(keyDirectory, "key");
41-
42-
final KeyPair keyPair = KeyPairUtil.loadKeyPair(keyFile);
38+
final KeyPair keyPair = KeyPairUtil.loadKeyPair(keyFile.resolve("key"));
4339

4440
final KeyPairSecurityModule keyPairSecurityModule = new KeyPairSecurityModule(keyPair);
4541
final ECPoint ecPoint = keyPairSecurityModule.getPublicKey().getW();

crypto/services/src/test/java/org/hyperledger/besu/cryptoservices/NodeKeyTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,12 @@
2121
import org.apache.tuweni.bytes.Bytes;
2222
import org.apache.tuweni.bytes.Bytes32;
2323
import org.assertj.core.api.Assertions;
24-
import org.junit.Before;
25-
import org.junit.Test;
24+
import org.junit.jupiter.api.BeforeEach;
25+
import org.junit.jupiter.api.Test;
2626

2727
public class NodeKeyTest {
2828

29-
@Before
29+
@BeforeEach
3030
public void resetInstance() {
3131
SignatureAlgorithmFactory.resetInstance();
3232
}

0 commit comments

Comments
 (0)