[TESTING] remove junit4 assumeThat (#7788)

* use junit5 assumeTrue/false

Signed-off-by: Sally MacFarlane <macfarla.github@gmail.com>

---------

Signed-off-by: Sally MacFarlane <macfarla.github@gmail.com>
pull/7799/head
Sally MacFarlane 1 month ago committed by GitHub
parent 1b0da83f19
commit d8d1237252
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 4
      acceptance-tests/tests/src/test/java/org/hyperledger/besu/tests/acceptance/crypto/SECP256R1AcceptanceTest.java
  2. 7
      besu/src/test/java/org/hyperledger/besu/cli/BesuCommandTest.java
  3. 10
      besu/src/test/java/org/hyperledger/besu/cli/PrivacyOptionsTest.java
  4. 17
      ethereum/referencetests/src/reference-test/java/org/hyperledger/besu/ethereum/vm/BlockchainReferenceTestTools.java
  5. 6
      evm/src/test/java/org/hyperledger/besu/evm/operation/DataCopyOperationTest.java

@ -15,7 +15,7 @@
package org.hyperledger.besu.tests.acceptance.crypto;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assumptions.assumeThat;
import static org.junit.jupiter.api.Assumptions.assumeTrue;
import org.hyperledger.besu.crypto.KeyPair;
import org.hyperledger.besu.crypto.SECP256R1;
@ -80,7 +80,7 @@ public class SECP256R1AcceptanceTest extends AcceptanceTestBase {
// the signature algorithm instance to SECP256R1 as it could influence other tests running at
// the same time. So we only execute the test when ProcessBesuNodeRunner is used, as there is
// not conflict because we use separate processes.
assumeThat(BesuNodeRunner.isProcessBesuNodeRunner()).isTrue();
assumeTrue(BesuNodeRunner.isProcessBesuNodeRunner());
minerNode.verify(net.awaitPeerCount(1));
otherNode.verify(net.awaitPeerCount(1));

@ -16,7 +16,6 @@ package org.hyperledger.besu.cli;
import static java.nio.charset.StandardCharsets.UTF_8;
import static org.assertj.core.api.Assertions.assertThat;
import static org.hamcrest.Matchers.is;
import static org.hyperledger.besu.cli.config.NetworkName.CLASSIC;
import static org.hyperledger.besu.cli.config.NetworkName.DEV;
import static org.hyperledger.besu.cli.config.NetworkName.EPHEMERY;
@ -33,7 +32,7 @@ import static org.hyperledger.besu.ethereum.p2p.config.DefaultDiscoveryConfigura
import static org.hyperledger.besu.ethereum.p2p.config.DefaultDiscoveryConfiguration.SEPOLIA_BOOTSTRAP_NODES;
import static org.hyperledger.besu.ethereum.p2p.config.DefaultDiscoveryConfiguration.SEPOLIA_DISCOVERY_URL;
import static org.hyperledger.besu.plugin.services.storage.DataStorageFormat.BONSAI;
import static org.junit.Assume.assumeThat;
import static org.junit.jupiter.api.Assumptions.assumeTrue;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.contains;
import static org.mockito.ArgumentMatchers.eq;
@ -2392,7 +2391,7 @@ public class BesuCommandTest extends CommandTestAbstract {
@Test
public void logsWarningWhenFailToLoadJemalloc() {
assumeThat(PlatformDetector.getOSType(), is("linux"));
assumeTrue(PlatformDetector.getOSType().equals("linux"));
setEnvironmentVariable("BESU_USING_JEMALLOC", "true");
parseCommand();
verify(mockLogger)
@ -2404,7 +2403,7 @@ public class BesuCommandTest extends CommandTestAbstract {
@Test
public void logsSuggestInstallingJemallocWhenEnvVarNotPresent() {
assumeThat(PlatformDetector.getOSType(), is("linux"));
assumeTrue(PlatformDetector.getOSType().equals("linux"));
parseCommand();
verify(mockLogger)
.info("jemalloc library not found, memory usage may be reduced by installing it");

@ -16,8 +16,7 @@ package org.hyperledger.besu.cli;
import static java.nio.charset.StandardCharsets.UTF_8;
import static org.assertj.core.api.Assertions.assertThat;
import static org.hamcrest.Matchers.startsWith;
import static org.junit.Assume.assumeThat;
import static org.junit.jupiter.api.Assumptions.assumeTrue;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
@ -415,10 +414,9 @@ public class PrivacyOptionsTest extends CommandTestAbstract {
@Test
public void privEnclaveKeyFileDoesNotExist() {
assumeThat(
"Ignored if system language is not English",
System.getProperty("user.language"),
startsWith("en"));
assumeTrue(
System.getProperty("user.language").startsWith("en"),
"Ignored if system language is not English");
parseCommand("--privacy-enabled=true", "--privacy-public-key-file", "/non/existent/file");
assertThat(commandOutput.toString(UTF_8)).isEmpty();

@ -15,7 +15,7 @@
package org.hyperledger.besu.ethereum.vm;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assumptions.assumeThat;
import static org.junit.jupiter.api.Assumptions.assumeFalse;
import org.hyperledger.besu.ethereum.ProtocolContext;
import org.hyperledger.besu.ethereum.chain.MutableBlockchain;
@ -148,18 +148,15 @@ public class BlockchainReferenceTestTools {
}
static void verifyJournaledEVMAccountCompatability(
final MutableWorldState worldState, final ProtocolSpec protocolSpec) {
final MutableWorldState worldState, final ProtocolSpec protocolSpec) {
EVM evm = protocolSpec.getEvm();
if (evm.getEvmConfiguration().worldUpdaterMode() == WorldUpdaterMode.JOURNALED) {
assumeThat(
assumeFalse(
worldState
.streamAccounts(Bytes32.ZERO, Integer.MAX_VALUE)
.anyMatch(AccountState::isEmpty))
.withFailMessage("Journaled account configured and empty account detected")
.isFalse();
assumeThat(EvmSpecVersion.SPURIOUS_DRAGON.compareTo(evm.getEvmVersion()) > 0)
.withFailMessage("Journaled account configured and fork prior to the merge specified")
.isFalse();
.streamAccounts(Bytes32.ZERO, Integer.MAX_VALUE).anyMatch(AccountState::isEmpty),
"Journaled account configured and empty account detected");
assumeFalse(EvmSpecVersion.SPURIOUS_DRAGON.compareTo(evm.getEvmVersion()) > 0,
"Journaled account configured and fork prior to the merge specified");
}
}
}

@ -15,7 +15,7 @@
package org.hyperledger.besu.evm.operation;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assumptions.assumeThat;
import static org.junit.jupiter.api.Assumptions.assumeTrue;
import org.hyperledger.besu.evm.Code;
import org.hyperledger.besu.evm.EVM;
@ -136,7 +136,7 @@ class DataCopyOperationTest {
"0xef0001010004020001001d04%04x000080000367%016x67%016x67%016xd300%s"
.formatted(data.size(), dst, src, len, data.toUnprefixedHexString());
Code code = evm.getCodeUncached(Bytes.fromHexString(eofCode));
assumeThat(code.isValid()).isTrue();
assumeTrue(code.isValid());
MessageFrame frame =
new TestMessageFrameBuilder()
@ -158,7 +158,7 @@ class DataCopyOperationTest {
void legacyCallFails() {
DataCopyOperation subject = new DataCopyOperation(new PragueGasCalculator());
Code code = evm.getCodeUncached(Bytes.fromHexString("0x600460046004d3"));
assumeThat(code.isValid()).isTrue();
assumeTrue(code.isValid());
MessageFrame frame =
new TestMessageFrameBuilder()

Loading…
Cancel
Save