From f7d80ee1a85d2a9a4b10bcc144aed72f18cf5ccf Mon Sep 17 00:00:00 2001 From: Alva Swanson Date: Mon, 18 Nov 2024 22:15:16 +0000 Subject: [PATCH] Add FederatedBtcNodeProviderTest.onlyHardcodedNodes test --- .../nodes/FederatedBtcNodeProviderTest.java | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 core/src/test/java/bisq/core/btc/nodes/FederatedBtcNodeProviderTest.java diff --git a/core/src/test/java/bisq/core/btc/nodes/FederatedBtcNodeProviderTest.java b/core/src/test/java/bisq/core/btc/nodes/FederatedBtcNodeProviderTest.java new file mode 100644 index 0000000000..cb9ed7d1b5 --- /dev/null +++ b/core/src/test/java/bisq/core/btc/nodes/FederatedBtcNodeProviderTest.java @@ -0,0 +1,32 @@ +package bisq.core.btc.nodes; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.assertIterableEquals; + +public class FederatedBtcNodeProviderTest { + @Test + void onlyHardcodedNodes() { + var hardcodedNodes = List.of( + new BtcNodes.BtcNode(null, "alice.onion", null, + BtcNodes.BtcNode.DEFAULT_PORT, "@alice"), + new BtcNodes.BtcNode(null, "bob.onion", null, + BtcNodes.BtcNode.DEFAULT_PORT, "@bob"), + new BtcNodes.BtcNode(null, "charlie.onion", null, + BtcNodes.BtcNode.DEFAULT_PORT, "@charlie") + ); + + List mutableHardcodedList = new ArrayList<>(hardcodedNodes); + List filterProvidedBtcNodes = Collections.emptyList(); + List bannedBtcNodes = Collections.emptyList(); + + List selectedNodes = FederatedBtcNodeProvider + .getNodes(mutableHardcodedList, filterProvidedBtcNodes, bannedBtcNodes); + + assertIterableEquals(hardcodedNodes, selectedNodes); + } +}