Skip to content

Commit

Permalink
migrate to junit5 (#6234)
Browse files Browse the repository at this point in the history
Signed-off-by: Sally MacFarlane <macfarla.github@gmail.com>
  • Loading branch information
macfarla authored Dec 6, 2023
1 parent 2513088 commit 8b1972f
Show file tree
Hide file tree
Showing 19 changed files with 36 additions and 37 deletions.
1 change: 0 additions & 1 deletion crypto/algorithms/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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());

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

import java.io.File;

import org.junit.Test;
import org.junit.jupiter.api.Test;

public class KeyPairUtilTest {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand All @@ -39,15 +39,15 @@ public class SECP256K1Test {
protected static String suiteStartTime = null;
protected static String suiteName = null;

@BeforeClass
@BeforeAll
public static void setTestSuiteStartTime() {
suiteStartTime =
LocalDateTime.now(ZoneId.systemDefault())
.format(DateTimeFormatter.ofPattern("yyyyMMdd-HHmmss"));
suiteName(SECP256K1Test.class);
}

@Before
@BeforeEach
public void setUp() {
secp256K1 = new SECP256K1();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down Expand Up @@ -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())
Expand All @@ -113,7 +113,7 @@ public static void setTestSuiteStartTime() {
SignatureAlgorithmFactory.setInstance(SignatureAlgorithmType.create("secp256r1"));
}

@Before
@BeforeEach
public void setUp() {
secp256R1 = new SECP256R1();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,16 @@
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;
public static final String CURVE_NAME = "secp256k1";

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());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 8b1972f

Please sign in to comment.