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

[MINOR] migrate remaining Crypto tests to junit 5 #6280

Merged
merged 3 commits into from
Dec 12, 2023
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
3 changes: 0 additions & 3 deletions crypto/services/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,8 @@ dependencies {
api project(':crypto:algorithms')
api project(':plugin-api')

testImplementation 'junit:junit'
testImplementation 'org.assertj:assertj-core'
testImplementation 'org.junit.jupiter:junit-jupiter'

testRuntimeOnly 'org.junit.vintage:junit-vintage-engine'
}

artifacts { testSupportArtifacts testSupportJar }
Original file line number Diff line number Diff line change
Expand Up @@ -20,26 +20,22 @@
import org.hyperledger.besu.crypto.SECPPublicKey;
import org.hyperledger.besu.crypto.SignatureAlgorithmFactory;

import java.io.File;
import java.io.IOException;
import java.nio.file.Path;
import java.security.spec.ECPoint;

import org.apache.tuweni.bytes.Bytes;
import org.assertj.core.api.Assertions;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TemporaryFolder;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.io.TempDir;

public class KeyPairSecurityModuleTest {

@Rule public final TemporaryFolder temp = new TemporaryFolder();
@TempDir public Path keyFile;

@Test
public void validatePublicKeyFromECPointCanBeConstructed() throws IOException {
final File keyDirectory = temp.newFolder();
final File keyFile = new File(keyDirectory, "key");

final KeyPair keyPair = KeyPairUtil.loadKeyPair(keyFile);
final KeyPair keyPair = KeyPairUtil.loadKeyPair(keyFile.resolve("key"));

final KeyPairSecurityModule keyPairSecurityModule = new KeyPairSecurityModule(keyPair);
final ECPoint ecPoint = keyPairSecurityModule.getPublicKey().getW();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@
import org.apache.tuweni.bytes.Bytes;
import org.apache.tuweni.bytes.Bytes32;
import org.assertj.core.api.Assertions;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

public class NodeKeyTest {

@Before
@BeforeEach
public void resetInstance() {
SignatureAlgorithmFactory.resetInstance();
}
Expand Down
Loading