[MINOR] code cleanup - Lists.emptyList (#3780)

* avoid the edge case of long minimum value which gives a negative value when passed into abs()

* changed some Longs to long where they were statically intialized

* replace Lists.emptyList() with Collections.emptyList()

* removed unnecessary eq() invocation and resulting code smell

Signed-off-by: Sally MacFarlane <sally.macfarlane@consensys.net>
pull/3791/head
Sally MacFarlane 3 years ago committed by GitHub
parent cacb8376ac
commit 47197235a9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 6
      acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/transaction/perm/PermissioningJsonRpcRequestFactory.java
  2. 17
      consensus/clique/src/test/java/org/hyperledger/besu/consensus/clique/blockcreation/CliqueMiningCoordinatorTest.java
  3. 3
      consensus/common/src/test/java/org/hyperledger/besu/consensus/common/bft/blockcreation/BftMiningCoordinatorTest.java
  4. 8
      consensus/common/src/test/java/org/hyperledger/besu/consensus/common/validator/blockbased/VoteTallyCacheTestBase.java
  5. 15
      ethereum/api/src/integration-test/java/org/hyperledger/besu/ethereum/api/jsonrpc/methods/fork/frontier/EthGetFilterChangesIntegrationTest.java
  6. 15
      ethereum/api/src/integration-test/java/org/hyperledger/besu/ethereum/api/jsonrpc/methods/fork/london/EthGetFilterChangesIntegrationTest.java
  7. 1
      ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/authentication/TomlUser.java
  8. 5
      ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/permissioning/PermAddNodesToAllowlistTest.java
  9. 5
      ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/permissioning/PermAddNodesToWhitelistTest.java
  10. 3
      ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/permissioning/PermGetNodesAllowlistTest.java
  11. 3
      ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/permissioning/PermGetNodesWhitelistTest.java
  12. 5
      ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/permissioning/PermRemoveNodesFromAllowlistTest.java
  13. 5
      ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/permissioning/PermRemoveNodesFromWhitelistTest.java
  14. 4
      ethereum/blockcreation/src/test/java/org/hyperledger/besu/ethereum/blockcreation/IncrementingNonceGeneratorTest.java
  15. 6
      ethereum/core/src/test/java/org/hyperledger/besu/ethereum/privacy/FlexiblePrivacyControllerTest.java
  16. 3
      ethereum/trie/src/test/java/org/hyperledger/besu/ethereum/trie/TrieIteratorTest.java

@ -18,7 +18,6 @@ import java.net.URI;
import java.util.Collections;
import java.util.List;
import org.assertj.core.util.Lists;
import org.web3j.protocol.Web3jService;
import org.web3j.protocol.core.Request;
import org.web3j.protocol.core.Response;
@ -61,7 +60,10 @@ public class PermissioningJsonRpcRequestFactory {
Request<?, GetNodesWhitelistResponse> getNodesWhitelist() {
return new Request<>(
"perm_getNodesAllowlist", Lists.emptyList(), web3jService, GetNodesWhitelistResponse.class);
"perm_getNodesAllowlist",
Collections.emptyList(),
web3jService,
GetNodesWhitelistResponse.class);
}
Request<?, GetAccountsWhitelistResponse> getAccountsWhitelist() {

@ -42,6 +42,7 @@ import org.hyperledger.besu.ethereum.core.BlockHeaderTestFixture;
import org.hyperledger.besu.ethereum.core.Util;
import org.hyperledger.besu.ethereum.eth.sync.state.SyncState;
import java.util.Collections;
import java.util.List;
import java.util.Optional;
@ -119,7 +120,7 @@ public class CliqueMiningCoordinatorTest {
final Block importedBlock = createEmptyBlock(1, blockChain.getChainHeadHash(), validatorKeys);
blockChain.appendBlock(importedBlock, Lists.emptyList());
blockChain.appendBlock(importedBlock, Collections.emptyList());
// The minerExecutor should not be invoked as the mining operation was conducted by an in-turn
// validator, and the created block came from an out-turn validator.
@ -147,7 +148,7 @@ public class CliqueMiningCoordinatorTest {
final Block importedBlock = createEmptyBlock(2, blockChain.getChainHeadHash(), validatorKeys);
blockChain.appendBlock(importedBlock, Lists.emptyList());
blockChain.appendBlock(importedBlock, Collections.emptyList());
// The minerExecutor should not be invoked as the mining operation was conducted by an in-turn
// validator, and the created block came from an out-turn validator.
@ -159,7 +160,7 @@ public class CliqueMiningCoordinatorTest {
@Test
public void outOfTurnBlockImportedInterruptsOutOfTurnMiningOperation() {
blockChain.appendBlock(
createEmptyBlock(1, blockChain.getChainHeadHash(), validatorKeys), Lists.emptyList());
createEmptyBlock(1, blockChain.getChainHeadHash(), validatorKeys), Collections.emptyList());
when(blockMiner.getParentHeader()).thenReturn(blockChain.getChainHeadHeader());
@ -178,7 +179,7 @@ public class CliqueMiningCoordinatorTest {
final Block importedBlock = createEmptyBlock(2, blockChain.getChainHeadHash(), validatorKeys);
blockChain.appendBlock(importedBlock, Lists.emptyList());
blockChain.appendBlock(importedBlock, Collections.emptyList());
// The minerExecutor should not be invoked as the mining operation was conducted by an in-turn
// validator, and the created block came from an out-turn validator.
@ -190,7 +191,7 @@ public class CliqueMiningCoordinatorTest {
@Test
public void outOfTurnBlockImportedInterruptsNonRunningMiner() {
blockChain.appendBlock(
createEmptyBlock(1, blockChain.getChainHeadHash(), proposerKeys), Lists.emptyList());
createEmptyBlock(1, blockChain.getChainHeadHash(), proposerKeys), Collections.emptyList());
when(blockMiner.getParentHeader()).thenReturn(blockChain.getChainHeadHeader());
@ -209,7 +210,7 @@ public class CliqueMiningCoordinatorTest {
final Block importedBlock = createEmptyBlock(2, blockChain.getChainHeadHash(), validatorKeys);
blockChain.appendBlock(importedBlock, Lists.emptyList());
blockChain.appendBlock(importedBlock, Collections.emptyList());
// The minerExecutor should not be invoked as the mining operation was conducted by an in-turn
// validator, and the created block came from an out-turn validator.
@ -234,7 +235,7 @@ public class CliqueMiningCoordinatorTest {
when(minerExecutor.startAsyncMining(any(), any(), any())).thenReturn(Optional.of(blockMiner));
final Block importedBlock = createEmptyBlock(1, blockChain.getChainHeadHash(), proposerKeys);
blockChain.appendBlock(importedBlock, Lists.emptyList());
blockChain.appendBlock(importedBlock, Collections.emptyList());
// The minerExecutor should not be invoked as the mining operation was conducted by an in-turn
// validator, and the created block came from an out-turn validator.
@ -248,6 +249,6 @@ public class CliqueMiningCoordinatorTest {
headerTestFixture.number(blockNumber).parentHash(parentHash);
final BlockHeader header =
TestHelpers.createCliqueSignedBlockHeader(headerTestFixture, signer, validators);
return new Block(header, new BlockBody(Lists.emptyList(), Lists.emptyList()));
return new Block(header, new BlockBody(Collections.emptyList(), Collections.emptyList()));
}
}

@ -35,7 +35,6 @@ import java.util.Collections;
import java.util.concurrent.TimeUnit;
import org.apache.tuweni.bytes.Bytes;
import org.assertj.core.util.Lists;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@ -62,7 +61,7 @@ public class BftMiningCoordinatorTest {
bftExecutors, controller, bftProcessor, bftBlockCreatorFactory, blockChain, eventQueue);
when(block.getBody()).thenReturn(blockBody);
when(block.getHeader()).thenReturn(blockHeader);
when(blockBody.getTransactions()).thenReturn(Lists.emptyList());
when(blockBody.getTransactions()).thenReturn(Collections.emptyList());
}
@Test

@ -28,6 +28,7 @@ import org.hyperledger.besu.ethereum.core.Block;
import org.hyperledger.besu.ethereum.core.BlockBody;
import org.hyperledger.besu.ethereum.core.BlockHeaderTestFixture;
import java.util.Collections;
import java.util.List;
import org.apache.tuweni.bytes.Bytes;
@ -41,7 +42,8 @@ public class VoteTallyCacheTestBase {
protected Block createEmptyBlock(final long blockNumber, final Hash parentHash) {
headerBuilder.number(blockNumber).parentHash(parentHash).coinbase(AddressHelpers.ofValue(0));
return new Block(
headerBuilder.buildHeader(), new BlockBody(Lists.emptyList(), Lists.emptyList()));
headerBuilder.buildHeader(),
new BlockBody(Collections.emptyList(), Collections.emptyList()));
}
protected MutableBlockchain blockChain;
@ -67,8 +69,8 @@ public class VoteTallyCacheTestBase {
block_1 = createEmptyBlock(1, genesisBlock.getHeader().getHash());
block_2 = createEmptyBlock(2, block_1.getHeader().getHash());
blockChain.appendBlock(block_1, Lists.emptyList());
blockChain.appendBlock(block_2, Lists.emptyList());
blockChain.appendBlock(block_1, Collections.emptyList());
blockChain.appendBlock(block_2, Collections.emptyList());
when(blockInterface.validatorsInBlock(any())).thenReturn(validators);
}

@ -59,6 +59,7 @@ import org.hyperledger.besu.plugin.services.MetricsSystem;
import org.hyperledger.besu.testutil.TestClock;
import java.math.BigInteger;
import java.util.Collections;
import java.util.List;
import java.util.Optional;
@ -146,7 +147,8 @@ public class EthGetFilterChangesIntegrationTest {
assertThatFilterExists(filterId);
final JsonRpcRequestContext request = requestWithParams(String.valueOf(filterId));
final JsonRpcSuccessResponse expected = new JsonRpcSuccessResponse(null, Lists.emptyList());
final JsonRpcSuccessResponse expected =
new JsonRpcSuccessResponse(null, Collections.emptyList());
final JsonRpcResponse actual = method.response(request);
assertThat(actual).usingRecursiveComparison().isEqualTo(expected);
@ -165,7 +167,8 @@ public class EthGetFilterChangesIntegrationTest {
final JsonRpcRequestContext request = requestWithParams(String.valueOf(filterId));
// We haven't added any transactions, so the list of pending transactions should be empty.
final JsonRpcSuccessResponse expected = new JsonRpcSuccessResponse(null, Lists.emptyList());
final JsonRpcSuccessResponse expected =
new JsonRpcSuccessResponse(null, Collections.emptyList());
final JsonRpcResponse actual = method.response(request);
assertThat(actual).usingRecursiveComparison().isEqualTo(expected);
@ -183,7 +186,7 @@ public class EthGetFilterChangesIntegrationTest {
final JsonRpcRequestContext request = requestWithParams(String.valueOf(filterId));
// We haven't added any blocks, so the list of new blocks should be empty.
JsonRpcSuccessResponse expected = new JsonRpcSuccessResponse(null, Lists.emptyList());
JsonRpcSuccessResponse expected = new JsonRpcSuccessResponse(null, Collections.emptyList());
JsonRpcResponse actual = method.response(request);
assertThat(actual).usingRecursiveComparison().isEqualTo(expected);
@ -195,7 +198,7 @@ public class EthGetFilterChangesIntegrationTest {
assertThat(actual).usingRecursiveComparison().isEqualTo(expected);
// The queue should be flushed and return no results.
expected = new JsonRpcSuccessResponse(null, Lists.emptyList());
expected = new JsonRpcSuccessResponse(null, Collections.emptyList());
actual = method.response(request);
assertThat(actual).usingRecursiveComparison().isEqualTo(expected);
@ -213,7 +216,7 @@ public class EthGetFilterChangesIntegrationTest {
final JsonRpcRequestContext request = requestWithParams(String.valueOf(filterId));
// We haven't added any transactions, so the list of pending transactions should be empty.
JsonRpcSuccessResponse expected = new JsonRpcSuccessResponse(null, Lists.emptyList());
JsonRpcSuccessResponse expected = new JsonRpcSuccessResponse(null, Collections.emptyList());
JsonRpcResponse actual = method.response(request);
assertThat(actual).usingRecursiveComparison().isEqualTo(expected);
@ -226,7 +229,7 @@ public class EthGetFilterChangesIntegrationTest {
assertThat(actual).usingRecursiveComparison().isEqualTo(expected);
// The queue should be flushed and return no results.
expected = new JsonRpcSuccessResponse(null, Lists.emptyList());
expected = new JsonRpcSuccessResponse(null, Collections.emptyList());
actual = method.response(request);
assertThat(actual).usingRecursiveComparison().isEqualTo(expected);

@ -59,6 +59,7 @@ import org.hyperledger.besu.plugin.services.MetricsSystem;
import org.hyperledger.besu.testutil.TestClock;
import java.math.BigInteger;
import java.util.Collections;
import java.util.List;
import java.util.Optional;
@ -146,7 +147,8 @@ public class EthGetFilterChangesIntegrationTest {
assertThatFilterExists(filterId);
final JsonRpcRequestContext request = requestWithParams(String.valueOf(filterId));
final JsonRpcSuccessResponse expected = new JsonRpcSuccessResponse(null, Lists.emptyList());
final JsonRpcSuccessResponse expected =
new JsonRpcSuccessResponse(null, Collections.emptyList());
final JsonRpcResponse actual = method.response(request);
assertThat(actual).usingRecursiveComparison().isEqualTo(expected);
@ -165,7 +167,8 @@ public class EthGetFilterChangesIntegrationTest {
final JsonRpcRequestContext request = requestWithParams(String.valueOf(filterId));
// We haven't added any transactions, so the list of pending transactions should be empty.
final JsonRpcSuccessResponse expected = new JsonRpcSuccessResponse(null, Lists.emptyList());
final JsonRpcSuccessResponse expected =
new JsonRpcSuccessResponse(null, Collections.emptyList());
final JsonRpcResponse actual = method.response(request);
assertThat(actual).usingRecursiveComparison().isEqualTo(expected);
@ -183,7 +186,7 @@ public class EthGetFilterChangesIntegrationTest {
final JsonRpcRequestContext request = requestWithParams(String.valueOf(filterId));
// We haven't added any blocks, so the list of new blocks should be empty.
JsonRpcSuccessResponse expected = new JsonRpcSuccessResponse(null, Lists.emptyList());
JsonRpcSuccessResponse expected = new JsonRpcSuccessResponse(null, Collections.emptyList());
JsonRpcResponse actual = method.response(request);
assertThat(actual).usingRecursiveComparison().isEqualTo(expected);
@ -195,7 +198,7 @@ public class EthGetFilterChangesIntegrationTest {
assertThat(actual).usingRecursiveComparison().isEqualTo(expected);
// The queue should be flushed and return no results.
expected = new JsonRpcSuccessResponse(null, Lists.emptyList());
expected = new JsonRpcSuccessResponse(null, Collections.emptyList());
actual = method.response(request);
assertThat(actual).usingRecursiveComparison().isEqualTo(expected);
@ -213,7 +216,7 @@ public class EthGetFilterChangesIntegrationTest {
final JsonRpcRequestContext request = requestWithParams(String.valueOf(filterId));
// We haven't added any transactions, so the list of pending transactions should be empty.
JsonRpcSuccessResponse expected = new JsonRpcSuccessResponse(null, Lists.emptyList());
JsonRpcSuccessResponse expected = new JsonRpcSuccessResponse(null, Collections.emptyList());
JsonRpcResponse actual = method.response(request);
assertThat(actual).usingRecursiveComparison().isEqualTo(expected);
@ -226,7 +229,7 @@ public class EthGetFilterChangesIntegrationTest {
assertThat(actual).usingRecursiveComparison().isEqualTo(expected);
// The queue should be flushed and return no results.
expected = new JsonRpcSuccessResponse(null, Lists.emptyList());
expected = new JsonRpcSuccessResponse(null, Collections.emptyList());
actual = method.response(request);
assertThat(actual).usingRecursiveComparison().isEqualTo(expected);

@ -93,6 +93,7 @@ public class TomlUser implements User {
return principle;
}
@Override
public void setAuthProvider(final AuthProvider authProvider) {
// we only use Toml for authentication
throw new UnsupportedOperationException("Not implemented");

@ -33,6 +33,7 @@ import org.hyperledger.besu.ethereum.permissioning.AllowlistOperationResult;
import org.hyperledger.besu.ethereum.permissioning.NodeLocalConfigPermissioningController;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Optional;
@ -104,12 +105,12 @@ public class PermAddNodesToAllowlistTest {
@Test
public void shouldThrowInvalidJsonRpcParametersExceptionWhenEmptyEnode() {
final JsonRpcRequestContext request = buildRequest(Lists.emptyList());
final JsonRpcRequestContext request = buildRequest(Collections.emptyList());
final JsonRpcResponse expected =
new JsonRpcErrorResponse(
request.getRequest().getId(), JsonRpcError.NODE_ALLOWLIST_EMPTY_ENTRY);
when(nodeLocalConfigPermissioningController.addNodes(eq(Lists.emptyList())))
when(nodeLocalConfigPermissioningController.addNodes(Collections.emptyList()))
.thenReturn(new NodesAllowlistResult(AllowlistOperationResult.ERROR_EMPTY_ENTRY));
final JsonRpcResponse actual = method.response(request);

@ -33,6 +33,7 @@ import org.hyperledger.besu.ethereum.permissioning.AllowlistOperationResult;
import org.hyperledger.besu.ethereum.permissioning.NodeLocalConfigPermissioningController;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Optional;
@ -105,12 +106,12 @@ public class PermAddNodesToWhitelistTest {
@Test
public void shouldThrowInvalidJsonRpcParametersExceptionWhenEmptyEnode() {
final JsonRpcRequestContext request = buildRequest(Lists.emptyList());
final JsonRpcRequestContext request = buildRequest(Collections.emptyList());
final JsonRpcResponse expected =
new JsonRpcErrorResponse(
request.getRequest().getId(), JsonRpcError.NODE_ALLOWLIST_EMPTY_ENTRY);
when(nodeLocalConfigPermissioningController.addNodes(eq(Lists.emptyList())))
when(nodeLocalConfigPermissioningController.addNodes(Collections.emptyList()))
.thenReturn(new NodesAllowlistResult(AllowlistOperationResult.ERROR_EMPTY_ENTRY));
final JsonRpcResponse actual = method.response(request);

@ -28,6 +28,7 @@ import org.hyperledger.besu.ethereum.api.jsonrpc.internal.response.JsonRpcRespon
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.response.JsonRpcSuccessResponse;
import org.hyperledger.besu.ethereum.permissioning.NodeLocalConfigPermissioningController;
import java.util.Collections;
import java.util.List;
import java.util.Optional;
@ -86,7 +87,7 @@ public class PermGetNodesAllowlistTest {
public void shouldReturnSuccessResponseWhenListSetAndEmpty() {
final JsonRpcRequestContext request = buildRequest();
final JsonRpcResponse expected =
new JsonRpcSuccessResponse(request.getRequest().getId(), Lists.emptyList());
new JsonRpcSuccessResponse(request.getRequest().getId(), Collections.emptyList());
when(nodeLocalConfigPermissioningController.getNodesAllowlist()).thenReturn(buildNodesList());

@ -28,6 +28,7 @@ import org.hyperledger.besu.ethereum.api.jsonrpc.internal.response.JsonRpcRespon
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.response.JsonRpcSuccessResponse;
import org.hyperledger.besu.ethereum.permissioning.NodeLocalConfigPermissioningController;
import java.util.Collections;
import java.util.List;
import java.util.Optional;
@ -87,7 +88,7 @@ public class PermGetNodesWhitelistTest {
public void shouldReturnSuccessResponseWhenListSetAndEmpty() {
final JsonRpcRequestContext request = buildRequest();
final JsonRpcResponse expected =
new JsonRpcSuccessResponse(request.getRequest().getId(), Lists.emptyList());
new JsonRpcSuccessResponse(request.getRequest().getId(), Collections.emptyList());
when(nodeLocalConfigPermissioningController.getNodesAllowlist()).thenReturn(buildNodesList());

@ -33,6 +33,7 @@ import org.hyperledger.besu.ethereum.permissioning.AllowlistOperationResult;
import org.hyperledger.besu.ethereum.permissioning.NodeLocalConfigPermissioningController;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Optional;
@ -87,12 +88,12 @@ public class PermRemoveNodesFromAllowlistTest {
@Test
public void shouldThrowInvalidJsonRpcParametersExceptionWhenEmptyList() {
final JsonRpcRequestContext request = buildRequest(Lists.emptyList());
final JsonRpcRequestContext request = buildRequest(Collections.emptyList());
final JsonRpcResponse expected =
new JsonRpcErrorResponse(
request.getRequest().getId(), JsonRpcError.NODE_ALLOWLIST_EMPTY_ENTRY);
when(nodeLocalConfigPermissioningController.removeNodes(eq(Lists.emptyList())))
when(nodeLocalConfigPermissioningController.removeNodes(Collections.emptyList()))
.thenReturn(new NodesAllowlistResult(AllowlistOperationResult.ERROR_EMPTY_ENTRY));
final JsonRpcResponse actual = method.response(request);

@ -33,6 +33,7 @@ import org.hyperledger.besu.ethereum.permissioning.AllowlistOperationResult;
import org.hyperledger.besu.ethereum.permissioning.NodeLocalConfigPermissioningController;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Optional;
@ -88,12 +89,12 @@ public class PermRemoveNodesFromWhitelistTest {
@Test
public void shouldThrowInvalidJsonRpcParametersExceptionWhenEmptyList() {
final JsonRpcRequestContext request = buildRequest(Lists.emptyList());
final JsonRpcRequestContext request = buildRequest(Collections.emptyList());
final JsonRpcResponse expected =
new JsonRpcErrorResponse(
request.getRequest().getId(), JsonRpcError.NODE_ALLOWLIST_EMPTY_ENTRY);
when(nodeLocalConfigPermissioningController.removeNodes(eq(Lists.emptyList())))
when(nodeLocalConfigPermissioningController.removeNodes(Collections.emptyList()))
.thenReturn(new NodesAllowlistResult(AllowlistOperationResult.ERROR_EMPTY_ENTRY));
final JsonRpcResponse actual = method.response(request);

@ -22,7 +22,7 @@ public class IncrementingNonceGeneratorTest {
@Test
public void firstValueProvidedIsSuppliedAtConstruction() {
final Long initialValue = 0L;
final long initialValue = 0L;
final IncrementingNonceGenerator generator = new IncrementingNonceGenerator(initialValue);
assertThat(generator.iterator().next()).isEqualTo(initialValue);
@ -30,7 +30,7 @@ public class IncrementingNonceGeneratorTest {
@Test
public void rollOverFromMaxResetsToZero() {
final Long initialValue = 0xFFFFFFFFFFFFFFFFL;
final long initialValue = 0xFFFFFFFFFFFFFFFFL;
final IncrementingNonceGenerator generator = new IncrementingNonceGenerator(initialValue);
assertThat(generator.iterator().next()).isEqualTo(initialValue);

@ -57,6 +57,7 @@ import org.hyperledger.enclave.testutil.EnclaveKeyUtils;
import java.math.BigInteger;
import java.nio.charset.StandardCharsets;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@ -68,7 +69,6 @@ import org.apache.tuweni.bytes.Bytes;
import org.apache.tuweni.bytes.Bytes32;
import org.apache.tuweni.io.Base64;
import org.assertj.core.api.Assertions;
import org.assertj.core.util.Lists;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@ -212,7 +212,7 @@ public class FlexiblePrivacyControllerTest {
@Test
public void createsPrivacyGroup() {
Assertions.assertThatThrownBy(
() -> privacyController.createPrivacyGroup(Lists.emptyList(), "", "", ADDRESS1))
() -> privacyController.createPrivacyGroup(Collections.emptyList(), "", "", ADDRESS1))
.isInstanceOf(PrivacyConfigurationNotSupportedException.class)
.hasMessageContaining("Method not supported when using flexible privacy");
}
@ -230,7 +230,7 @@ public class FlexiblePrivacyControllerTest {
final TransactionProcessingResult transactionProcessingResult =
new TransactionProcessingResult(
TransactionProcessingResult.Status.SUCCESSFUL,
Lists.emptyList(),
Collections.emptyList(),
0,
0,
Bytes32.ZERO,

@ -124,7 +124,8 @@ public class TrieIteratorTest {
final int startNodeNumber = random.nextInt(Math.max(1, totalNodes - 1));
final int stopNodeNumber = random.nextInt(Math.max(1, totalNodes - 1));
for (int i = 0; i < totalNodes; i++) {
final Bytes32 keyHash = Hash.keccak256(UInt256.valueOf(Math.abs(random.nextLong())));
final Bytes32 keyHash =
Hash.keccak256(UInt256.valueOf(Math.abs(random.nextInt(Integer.MAX_VALUE))));
root = root.accept(new PutVisitor<>(nodeFactory, "Value"), bytesToPath(keyHash));
expectedKeyHashes.add(keyHash);
if (i == startNodeNumber) {

Loading…
Cancel
Save