From 0d14eb6f2a26155c15c30f9c2a7a5a8c6a2ed8bd Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Mon, 13 Jul 2015 21:04:59 +0200 Subject: [PATCH 1/1] Add test for removing peers with unknown node identifiers --- .../fcp/quelaton/DefaultFcpClientTest.java | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) 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(); -- 2.7.4