PeerTest, PeerGroupTest: replace usage of Guava Lists

This commit is contained in:
Sean Gilligan 2023-10-01 10:57:01 -07:00 committed by Andreas Schildbach
parent 647c7ecbd7
commit cb740d2eaa
2 changed files with 4 additions and 6 deletions

View File

@ -17,7 +17,6 @@
package org.bitcoinj.core;
import com.google.common.collect.Lists;
import org.bitcoinj.base.Address;
import org.bitcoinj.base.Coin;
import org.bitcoinj.base.ScriptType;
@ -547,11 +546,11 @@ public class PeerGroupTest extends TestWithPeerGroup {
@Test
@Ignore("disabled for now as this test is too flaky")
public void peerPriority() throws Exception {
final List<InetSocketAddress> addresses = Lists.newArrayList(
final List<InetSocketAddress> addresses = new ArrayList<>(List.of(
new InetSocketAddress("localhost", 2000),
new InetSocketAddress("localhost", 2001),
new InetSocketAddress("localhost", 2002)
);
));
peerGroup.addConnectedEventListener(connectedListener);
peerGroup.addDisconnectedEventListener(disconnectedListener);
peerGroup.addPreMessageReceivedEventListener(preMessageReceivedListener);
@ -580,7 +579,7 @@ public class PeerGroupTest extends TestWithPeerGroup {
connectedPeers.take();
connectedPeers.take();
addresses.clear();
addresses.addAll(Lists.newArrayList(new InetSocketAddress("localhost", 2003)));
addresses.add(new InetSocketAddress("localhost", 2003));
stopPeerServer(2);
assertEquals(2002, disconnectedPeers.take().getAddress().getPort()); // peer died

View File

@ -16,7 +16,6 @@
package org.bitcoinj.core;
import com.google.common.collect.Lists;
import org.bitcoinj.base.BitcoinNetwork;
import org.bitcoinj.base.Coin;
import org.bitcoinj.base.ScriptType;
@ -812,7 +811,7 @@ public class PeerTest extends TestWithNetworkConnections {
t2.addOutput(COIN, wallet.currentChangeAddress());
inbound(writeTarget, t2);
final InventoryItem inventoryItem = new InventoryItem(InventoryItem.Type.TRANSACTION, t2.getInput(0).getOutpoint().hash());
final NotFoundMessage nfm = new NotFoundMessage(Lists.newArrayList(inventoryItem));
final NotFoundMessage nfm = new NotFoundMessage(List.of(inventoryItem));
inbound(writeTarget, nfm);
pingAndWait(writeTarget);
Threading.waitForUserCode();