[MINOR] testing: changed more classes to MockitoJunitRunner (#3311)

* changed runner and removed unnecessary mockito stubbings

Signed-off-by: Sally MacFarlane <sally.macfarlane@consensys.net>
pull/3317/head
Sally MacFarlane 3 years ago committed by GitHub
parent f55d018b71
commit a718ec2dcc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      besu/src/test/java/org/hyperledger/besu/cli/BesuCommandTest.java
  2. 3
      besu/src/test/java/org/hyperledger/besu/cli/subcommands/blocks/BlocksSubCommandTest.java
  3. 3
      ethereum/core/src/test/java/org/hyperledger/besu/ethereum/bonsai/LogRollingTests.java
  4. 3
      ethereum/core/src/test/java/org/hyperledger/besu/ethereum/mainnet/MainnetBlockHeaderValidatorTest.java
  5. 3
      ethereum/core/src/test/java/org/hyperledger/besu/ethereum/mainnet/MainnetBlockProcessorTest.java
  6. 3
      ethereum/core/src/test/java/org/hyperledger/besu/ethereum/mainnet/MainnetPrecompiledContractRegistriesTest.java
  7. 3
      ethereum/core/src/test/java/org/hyperledger/besu/ethereum/mainnet/PoWSolverTest.java
  8. 3
      ethereum/core/src/test/java/org/hyperledger/besu/ethereum/mainnet/PrivacyBlockProcessorTest.java
  9. 3
      ethereum/core/src/test/java/org/hyperledger/besu/ethereum/mainnet/ProtocolScheduleTest.java
  10. 4
      ethereum/core/src/test/java/org/hyperledger/besu/ethereum/privacy/ChainHeadPrivateNonceProviderTest.java
  11. 3
      ethereum/core/src/test/java/org/hyperledger/besu/ethereum/privacy/PrivateMetadataUpdaterTest.java
  12. 3
      ethereum/core/src/test/java/org/hyperledger/besu/ethereum/privacy/PrivateTransactionValidatorTest.java
  13. 3
      ethereum/core/src/test/java/org/hyperledger/besu/ethereum/privacy/markertransaction/FixedKeySigningPrivateMarkerTransactionFactoryTest.java
  14. 3
      ethereum/core/src/test/java/org/hyperledger/besu/ethereum/privacy/markertransaction/RandomSigningPrivateMarkerTransactionFactoryTest.java
  15. 3
      ethereum/core/src/test/java/org/hyperledger/besu/ethereum/vm/BlockHashLookupTest.java
  16. 3
      ethereum/core/src/test/java/org/hyperledger/besu/ethereum/vm/EstimateGasOperationTracerTest.java
  17. 3
      ethereum/core/src/test/java/org/hyperledger/besu/ethereum/vm/operations/JumpOperationTest.java
  18. 3
      ethereum/core/src/test/java/org/hyperledger/besu/ethereum/worldstate/MarkSweepPrunerTest.java
  19. 3
      nat/src/test/java/org/hyperledger/besu/nat/docker/DockerNatManagerTest.java

@ -113,10 +113,13 @@ import org.junit.Ignore;
import org.junit.Rule; import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.junit.rules.TemporaryFolder; import org.junit.rules.TemporaryFolder;
import org.junit.runner.RunWith;
import org.mockito.ArgumentCaptor; import org.mockito.ArgumentCaptor;
import org.mockito.Mockito; import org.mockito.Mockito;
import org.mockito.junit.MockitoJUnitRunner;
import picocli.CommandLine; import picocli.CommandLine;
@RunWith(MockitoJUnitRunner.class)
public class BesuCommandTest extends CommandTestAbstract { public class BesuCommandTest extends CommandTestAbstract {
private static final String ENCLAVE_URI = "http://1.2.3.4:5555"; private static final String ENCLAVE_URI = "http://1.2.3.4:5555";

@ -37,8 +37,11 @@ import java.util.Optional;
import org.junit.Rule; import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.junit.rules.TemporaryFolder; import org.junit.rules.TemporaryFolder;
import org.junit.runner.RunWith;
import org.mockito.junit.MockitoJUnitRunner;
import picocli.CommandLine.Model.CommandSpec; import picocli.CommandLine.Model.CommandSpec;
@RunWith(MockitoJUnitRunner.class)
public class BlocksSubCommandTest extends CommandTestAbstract { public class BlocksSubCommandTest extends CommandTestAbstract {
@Rule public final TemporaryFolder folder = new TemporaryFolder(); @Rule public final TemporaryFolder folder = new TemporaryFolder();

@ -43,7 +43,10 @@ import org.apache.tuweni.bytes.Bytes;
import org.apache.tuweni.units.bigints.UInt256; import org.apache.tuweni.units.bigints.UInt256;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.junit.MockitoJUnitRunner;
@RunWith(MockitoJUnitRunner.class)
public class LogRollingTests { public class LogRollingTests {
private BonsaiWorldStateArchive archive; private BonsaiWorldStateArchive archive;

@ -20,8 +20,11 @@ import static org.mockito.Mockito.mock;
import org.hyperledger.besu.ethereum.ProtocolContext; import org.hyperledger.besu.ethereum.ProtocolContext;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.junit.MockitoJUnitRunner;
/** Tests for {@link MainnetBlockHeaderValidator}. */ /** Tests for {@link MainnetBlockHeaderValidator}. */
@RunWith(MockitoJUnitRunner.class)
public final class MainnetBlockHeaderValidatorTest { public final class MainnetBlockHeaderValidatorTest {
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")

@ -31,7 +31,10 @@ import org.hyperledger.besu.ethereum.referencetests.ReferenceTestWorldState;
import java.util.Optional; import java.util.Optional;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.junit.MockitoJUnitRunner;
@RunWith(MockitoJUnitRunner.class)
public class MainnetBlockProcessorTest { public class MainnetBlockProcessorTest {
private final MainnetTransactionProcessor transactionProcessor = private final MainnetTransactionProcessor transactionProcessor =

@ -31,7 +31,10 @@ import org.hyperledger.besu.evm.gascalculator.GasCalculator;
import org.hyperledger.besu.evm.precompile.PrecompileContractRegistry; import org.hyperledger.besu.evm.precompile.PrecompileContractRegistry;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.junit.MockitoJUnitRunner;
@RunWith(MockitoJUnitRunner.class)
public class MainnetPrecompiledContractRegistriesTest { public class MainnetPrecompiledContractRegistriesTest {
private final PrivacyParameters privacyParameters = mock(PrivacyParameters.class); private final PrivacyParameters privacyParameters = mock(PrivacyParameters.class);
private final GasCalculator gasCalculator = mock(GasCalculator.class); private final GasCalculator gasCalculator = mock(GasCalculator.class);

@ -37,7 +37,10 @@ import org.apache.tuweni.bytes.Bytes;
import org.apache.tuweni.bytes.Bytes32; import org.apache.tuweni.bytes.Bytes32;
import org.apache.tuweni.units.bigints.UInt256; import org.apache.tuweni.units.bigints.UInt256;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.junit.MockitoJUnitRunner;
@RunWith(MockitoJUnitRunner.class)
public class PoWSolverTest { public class PoWSolverTest {
@Test @Test

@ -55,7 +55,10 @@ import org.apache.tuweni.bytes.Bytes;
import org.apache.tuweni.bytes.Bytes32; import org.apache.tuweni.bytes.Bytes32;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.junit.MockitoJUnitRunner;
@RunWith(MockitoJUnitRunner.class)
public class PrivacyBlockProcessorTest { public class PrivacyBlockProcessorTest {
private PrivacyBlockProcessor privacyBlockProcessor; private PrivacyBlockProcessor privacyBlockProcessor;

@ -22,7 +22,10 @@ import java.util.Optional;
import org.assertj.core.api.Assertions; import org.assertj.core.api.Assertions;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.junit.MockitoJUnitRunner;
@RunWith(MockitoJUnitRunner.class)
public class ProtocolScheduleTest { public class ProtocolScheduleTest {
private static final Optional<BigInteger> CHAIN_ID = Optional.of(BigInteger.ONE); private static final Optional<BigInteger> CHAIN_ID = Optional.of(BigInteger.ONE);

@ -34,7 +34,10 @@ import org.apache.tuweni.bytes.Bytes;
import org.apache.tuweni.bytes.Bytes32; import org.apache.tuweni.bytes.Bytes32;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.junit.MockitoJUnitRunner;
@RunWith(MockitoJUnitRunner.class)
public class ChainHeadPrivateNonceProviderTest { public class ChainHeadPrivateNonceProviderTest {
private static final Bytes32 PRIVACY_GROUP_ID = private static final Bytes32 PRIVACY_GROUP_ID =
Bytes32.wrap(Bytes.fromBase64String("DyAOiF/ynpc+JXa2YAGB0bCitSlOMNm+ShmB/7M6C4w=")); Bytes32.wrap(Bytes.fromBase64String("DyAOiF/ynpc+JXa2YAGB0bCitSlOMNm+ShmB/7M6C4w="));
@ -95,7 +98,6 @@ public class ChainHeadPrivateNonceProviderTest {
.thenReturn(Hash.ZERO); .thenReturn(Hash.ZERO);
when(privateWorldStateArchive.get(any(Hash.class), any(Hash.class))) when(privateWorldStateArchive.get(any(Hash.class), any(Hash.class)))
.thenReturn(Optional.of(worldState)); .thenReturn(Optional.of(worldState));
when(account.getNonce()).thenReturn(4L);
final long nonce = privateNonceProvider.getNonce(ADDRESS, PRIVACY_GROUP_ID); final long nonce = privateNonceProvider.getNonce(ADDRESS, PRIVACY_GROUP_ID);

@ -32,7 +32,10 @@ import java.util.Optional;
import org.apache.tuweni.bytes.Bytes32; import org.apache.tuweni.bytes.Bytes32;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.junit.MockitoJUnitRunner;
@RunWith(MockitoJUnitRunner.class)
public class PrivateMetadataUpdaterTest { public class PrivateMetadataUpdaterTest {
private PrivateMetadataUpdater updater; private PrivateMetadataUpdater updater;

@ -35,8 +35,11 @@ import java.util.Optional;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mockito; import org.mockito.Mockito;
import org.mockito.junit.MockitoJUnitRunner;
@RunWith(MockitoJUnitRunner.class)
public class PrivateTransactionValidatorTest { public class PrivateTransactionValidatorTest {
private static final KeyPair senderKeys = private static final KeyPair senderKeys =

@ -30,7 +30,10 @@ import java.util.Optional;
import org.apache.tuweni.bytes.Bytes; import org.apache.tuweni.bytes.Bytes;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.junit.MockitoJUnitRunner;
@RunWith(MockitoJUnitRunner.class)
public class FixedKeySigningPrivateMarkerTransactionFactoryTest { public class FixedKeySigningPrivateMarkerTransactionFactoryTest {
@Test @Test

@ -27,7 +27,10 @@ import java.util.Optional;
import org.apache.tuweni.bytes.Bytes; import org.apache.tuweni.bytes.Bytes;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.junit.MockitoJUnitRunner;
@RunWith(MockitoJUnitRunner.class)
public class RandomSigningPrivateMarkerTransactionFactoryTest { public class RandomSigningPrivateMarkerTransactionFactoryTest {
@Test @Test

@ -33,7 +33,10 @@ import org.assertj.core.api.Assertions;
import org.junit.After; import org.junit.After;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.junit.MockitoJUnitRunner;
@RunWith(MockitoJUnitRunner.class)
public class BlockHashLookupTest { public class BlockHashLookupTest {
private static final int CURRENT_BLOCK_NUMBER = 256; private static final int CURRENT_BLOCK_NUMBER = 256;

@ -28,7 +28,10 @@ import org.hyperledger.besu.evm.tracing.OperationTracer.ExecuteOperation;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.junit.MockitoJUnitRunner;
@RunWith(MockitoJUnitRunner.class)
public class EstimateGasOperationTracerTest { public class EstimateGasOperationTracerTest {
private EstimateGasOperationTracer operationTracer; private EstimateGasOperationTracer operationTracer;

@ -45,8 +45,11 @@ import org.apache.tuweni.bytes.Bytes;
import org.apache.tuweni.units.bigints.UInt256; import org.apache.tuweni.units.bigints.UInt256;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mockito; import org.mockito.Mockito;
import org.mockito.junit.MockitoJUnitRunner;
@RunWith(MockitoJUnitRunner.class)
public class JumpOperationTest { public class JumpOperationTest {
private static final IstanbulGasCalculator gasCalculator = new IstanbulGasCalculator(); private static final IstanbulGasCalculator gasCalculator = new IstanbulGasCalculator();

@ -49,8 +49,11 @@ import java.util.stream.Collectors;
import org.apache.tuweni.bytes.Bytes; import org.apache.tuweni.bytes.Bytes;
import org.apache.tuweni.bytes.Bytes32; import org.apache.tuweni.bytes.Bytes32;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.InOrder; import org.mockito.InOrder;
import org.mockito.junit.MockitoJUnitRunner;
@RunWith(MockitoJUnitRunner.class)
public class MarkSweepPrunerTest { public class MarkSweepPrunerTest {
private final BlockDataGenerator gen = new BlockDataGenerator(); private final BlockDataGenerator gen = new BlockDataGenerator();

@ -32,8 +32,11 @@ import java.util.concurrent.ExecutionException;
import org.assertj.core.api.Assertions; import org.assertj.core.api.Assertions;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock; import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner;
@RunWith(MockitoJUnitRunner.class)
public final class DockerNatManagerTest { public final class DockerNatManagerTest {
private final String advertisedHost = "99.45.69.12"; private final String advertisedHost = "99.45.69.12";

Loading…
Cancel
Save