diff --git a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/transaction/perm/PermissioningJsonRpcRequestFactory.java b/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/transaction/perm/PermissioningJsonRpcRequestFactory.java index b99b2dba61..d99915abe3 100644 --- a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/transaction/perm/PermissioningJsonRpcRequestFactory.java +++ b/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/transaction/perm/PermissioningJsonRpcRequestFactory.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 getNodesWhitelist() { return new Request<>( - "perm_getNodesAllowlist", Lists.emptyList(), web3jService, GetNodesWhitelistResponse.class); + "perm_getNodesAllowlist", + Collections.emptyList(), + web3jService, + GetNodesWhitelistResponse.class); } Request getAccountsWhitelist() { diff --git a/consensus/clique/src/test/java/org/hyperledger/besu/consensus/clique/blockcreation/CliqueMiningCoordinatorTest.java b/consensus/clique/src/test/java/org/hyperledger/besu/consensus/clique/blockcreation/CliqueMiningCoordinatorTest.java index 4aaa5e12d7..7cec20cf7c 100644 --- a/consensus/clique/src/test/java/org/hyperledger/besu/consensus/clique/blockcreation/CliqueMiningCoordinatorTest.java +++ b/consensus/clique/src/test/java/org/hyperledger/besu/consensus/clique/blockcreation/CliqueMiningCoordinatorTest.java @@ -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())); } } diff --git a/consensus/common/src/test/java/org/hyperledger/besu/consensus/common/bft/blockcreation/BftMiningCoordinatorTest.java b/consensus/common/src/test/java/org/hyperledger/besu/consensus/common/bft/blockcreation/BftMiningCoordinatorTest.java index 04b0a6621b..5af2054694 100644 --- a/consensus/common/src/test/java/org/hyperledger/besu/consensus/common/bft/blockcreation/BftMiningCoordinatorTest.java +++ b/consensus/common/src/test/java/org/hyperledger/besu/consensus/common/bft/blockcreation/BftMiningCoordinatorTest.java @@ -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 diff --git a/consensus/common/src/test/java/org/hyperledger/besu/consensus/common/validator/blockbased/VoteTallyCacheTestBase.java b/consensus/common/src/test/java/org/hyperledger/besu/consensus/common/validator/blockbased/VoteTallyCacheTestBase.java index ea5e308ab7..1a3dba12b1 100644 --- a/consensus/common/src/test/java/org/hyperledger/besu/consensus/common/validator/blockbased/VoteTallyCacheTestBase.java +++ b/consensus/common/src/test/java/org/hyperledger/besu/consensus/common/validator/blockbased/VoteTallyCacheTestBase.java @@ -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); } diff --git a/ethereum/api/src/integration-test/java/org/hyperledger/besu/ethereum/api/jsonrpc/methods/fork/frontier/EthGetFilterChangesIntegrationTest.java b/ethereum/api/src/integration-test/java/org/hyperledger/besu/ethereum/api/jsonrpc/methods/fork/frontier/EthGetFilterChangesIntegrationTest.java index b4091dcbb5..2205b1fa08 100644 --- a/ethereum/api/src/integration-test/java/org/hyperledger/besu/ethereum/api/jsonrpc/methods/fork/frontier/EthGetFilterChangesIntegrationTest.java +++ b/ethereum/api/src/integration-test/java/org/hyperledger/besu/ethereum/api/jsonrpc/methods/fork/frontier/EthGetFilterChangesIntegrationTest.java @@ -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); diff --git a/ethereum/api/src/integration-test/java/org/hyperledger/besu/ethereum/api/jsonrpc/methods/fork/london/EthGetFilterChangesIntegrationTest.java b/ethereum/api/src/integration-test/java/org/hyperledger/besu/ethereum/api/jsonrpc/methods/fork/london/EthGetFilterChangesIntegrationTest.java index 5d6149a293..3624dc5add 100644 --- a/ethereum/api/src/integration-test/java/org/hyperledger/besu/ethereum/api/jsonrpc/methods/fork/london/EthGetFilterChangesIntegrationTest.java +++ b/ethereum/api/src/integration-test/java/org/hyperledger/besu/ethereum/api/jsonrpc/methods/fork/london/EthGetFilterChangesIntegrationTest.java @@ -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); diff --git a/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/authentication/TomlUser.java b/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/authentication/TomlUser.java index 06ac45bc4d..899548da39 100644 --- a/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/authentication/TomlUser.java +++ b/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/authentication/TomlUser.java @@ -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"); diff --git a/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/permissioning/PermAddNodesToAllowlistTest.java b/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/permissioning/PermAddNodesToAllowlistTest.java index adc97eed3f..500b709033 100644 --- a/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/permissioning/PermAddNodesToAllowlistTest.java +++ b/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/permissioning/PermAddNodesToAllowlistTest.java @@ -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); diff --git a/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/permissioning/PermAddNodesToWhitelistTest.java b/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/permissioning/PermAddNodesToWhitelistTest.java index f2b8cbc12d..09eacb8220 100644 --- a/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/permissioning/PermAddNodesToWhitelistTest.java +++ b/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/permissioning/PermAddNodesToWhitelistTest.java @@ -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); diff --git a/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/permissioning/PermGetNodesAllowlistTest.java b/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/permissioning/PermGetNodesAllowlistTest.java index a9aaead288..38b6c12cfb 100644 --- a/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/permissioning/PermGetNodesAllowlistTest.java +++ b/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/permissioning/PermGetNodesAllowlistTest.java @@ -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()); diff --git a/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/permissioning/PermGetNodesWhitelistTest.java b/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/permissioning/PermGetNodesWhitelistTest.java index 435c5b51c8..914caedbc0 100644 --- a/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/permissioning/PermGetNodesWhitelistTest.java +++ b/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/permissioning/PermGetNodesWhitelistTest.java @@ -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()); diff --git a/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/permissioning/PermRemoveNodesFromAllowlistTest.java b/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/permissioning/PermRemoveNodesFromAllowlistTest.java index 650c8c8e3b..5fdd9b86cf 100644 --- a/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/permissioning/PermRemoveNodesFromAllowlistTest.java +++ b/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/permissioning/PermRemoveNodesFromAllowlistTest.java @@ -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); diff --git a/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/permissioning/PermRemoveNodesFromWhitelistTest.java b/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/permissioning/PermRemoveNodesFromWhitelistTest.java index 2b1cb7d4da..79c4a7271a 100644 --- a/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/permissioning/PermRemoveNodesFromWhitelistTest.java +++ b/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/permissioning/PermRemoveNodesFromWhitelistTest.java @@ -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); diff --git a/ethereum/blockcreation/src/test/java/org/hyperledger/besu/ethereum/blockcreation/IncrementingNonceGeneratorTest.java b/ethereum/blockcreation/src/test/java/org/hyperledger/besu/ethereum/blockcreation/IncrementingNonceGeneratorTest.java index d0a09edf86..04b4ae0262 100644 --- a/ethereum/blockcreation/src/test/java/org/hyperledger/besu/ethereum/blockcreation/IncrementingNonceGeneratorTest.java +++ b/ethereum/blockcreation/src/test/java/org/hyperledger/besu/ethereum/blockcreation/IncrementingNonceGeneratorTest.java @@ -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); diff --git a/ethereum/core/src/test/java/org/hyperledger/besu/ethereum/privacy/FlexiblePrivacyControllerTest.java b/ethereum/core/src/test/java/org/hyperledger/besu/ethereum/privacy/FlexiblePrivacyControllerTest.java index 033553075a..32f7763737 100644 --- a/ethereum/core/src/test/java/org/hyperledger/besu/ethereum/privacy/FlexiblePrivacyControllerTest.java +++ b/ethereum/core/src/test/java/org/hyperledger/besu/ethereum/privacy/FlexiblePrivacyControllerTest.java @@ -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, diff --git a/ethereum/trie/src/test/java/org/hyperledger/besu/ethereum/trie/TrieIteratorTest.java b/ethereum/trie/src/test/java/org/hyperledger/besu/ethereum/trie/TrieIteratorTest.java index 4f1f688cb6..5211945731 100644 --- a/ethereum/trie/src/test/java/org/hyperledger/besu/ethereum/trie/TrieIteratorTest.java +++ b/ethereum/trie/src/test/java/org/hyperledger/besu/ethereum/trie/TrieIteratorTest.java @@ -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) {