From: David ‘Bombe’ Roden Date: Mon, 13 Jul 2015 19:04:59 +0000 (+0200) Subject: Add test for removing peers with unknown node identifiers X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=0d14eb6f2a26155c15c30f9c2a7a5a8c6a2ed8bd;p=jFCPlib.git Add test for removing peers with unknown node identifiers --- diff --git a/src/test/java/net/pterodactylus/fcp/quelaton/DefaultFcpClientTest.java b/src/test/java/net/pterodactylus/fcp/quelaton/DefaultFcpClientTest.java index d2918a8..2cfce98 100644 --- a/src/test/java/net/pterodactylus/fcp/quelaton/DefaultFcpClientTest.java +++ b/src/test/java/net/pterodactylus/fcp/quelaton/DefaultFcpClientTest.java @@ -1594,6 +1594,27 @@ public class DefaultFcpClientTest { } @Test + public void defaultFcpClientCanNotRemovePeerByInvalidName() + throws InterruptedException, ExecutionException, IOException { + Future peer = fcpClient.removePeer().byName("NotFriend1").execute(); + connectNode(); + List lines = fcpServer.collectUntil(is("EndMessage")); + String identifier = extractIdentifier(lines); + assertThat(lines, matchesFcpMessage( + "RemovePeer", + "Identifier=" + identifier, + "NodeIdentifier=NotFriend1", + "EndMessage" + )); + fcpServer.writeLine( + "UnknownNodeIdentifier", + "Identifier=" + identifier, + "EndMessage" + ); + assertThat(peer.get(), is(false)); + } + + @Test public void defaultFcpClientCanRemovePeerByIdentity() throws InterruptedException, ExecutionException, IOException { Future peer = fcpClient.removePeer().byIdentity("id1").execute(); connectNode();