From e591c6488b692e3dfcf2efd1905d399f39c6067f Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Mon, 13 Jul 2015 20:39:38 +0200 Subject: [PATCH] Add test for unknown node identifiers on modify peer command --- .../fcp/quelaton/DefaultFcpClientTest.java | 23 ++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/test/java/net/pterodactylus/fcp/quelaton/DefaultFcpClientTest.java b/src/test/java/net/pterodactylus/fcp/quelaton/DefaultFcpClientTest.java index cf7a4ae..5979284 100644 --- a/src/test/java/net/pterodactylus/fcp/quelaton/DefaultFcpClientTest.java +++ b/src/test/java/net/pterodactylus/fcp/quelaton/DefaultFcpClientTest.java @@ -1338,6 +1338,29 @@ public class DefaultFcpClientTest { } @Test + public void defaultFcpClientCanNotModifyPeerOfUnknownNode() + throws InterruptedException, ExecutionException, IOException { + Future> peer = fcpClient.modifyPeer().enable().byIdentity("id1").execute(); + connectNode(); + List lines = fcpServer.collectUntil(is("EndMessage")); + String identifier = extractIdentifier(lines); + assertThat(lines, matchesFcpMessage( + "ModifyPeer", + "Identifier=" + identifier, + "NodeIdentifier=id1", + "IsDisabled=false", + "EndMessage" + )); + fcpServer.writeLine( + "UnknownNodeIdentifier", + "Identifier=" + identifier, + "NodeIdentifier=id1", + "EndMessage" + ); + assertThat(peer.get().isPresent(), is(false)); + } + + @Test public void defaultFcpClientCanAllowLocalAddressesOfPeer() throws InterruptedException, ExecutionException, IOException { Future> peer = fcpClient.modifyPeer().allowLocalAddresses().byIdentity("id1").execute(); -- 2.7.4