Rename method to add peer from a file
authorDavid ‘Bombe’ Roden <bombe@freenetproject.org>
Sat, 11 Jul 2015 17:03:37 +0000 (19:03 +0200)
committerDavid ‘Bombe’ Roden <bombe@freenetproject.org>
Sat, 11 Jul 2015 17:03:37 +0000 (19:03 +0200)
src/main/java/net/pterodactylus/fcp/quelaton/AddPeerCommand.java
src/main/java/net/pterodactylus/fcp/quelaton/AddPeerCommandImpl.java
src/test/java/net/pterodactylus/fcp/quelaton/DefaultFcpClientTest.java

index 8b7a7bb..5997af6 100644 (file)
@@ -1,5 +1,6 @@
 package net.pterodactylus.fcp.quelaton;
 
+import java.io.File;
 import java.net.URL;
 import java.util.Optional;
 
@@ -10,8 +11,9 @@ import net.pterodactylus.fcp.Peer;
  *
  * @author <a href="mailto:bombe@freenetproject.org">David ‘Bombe’ Roden</a>
  */
-public interface AddPeerCommand extends WithFile<Executable<Optional<Peer>>> {
+public interface AddPeerCommand {
 
+       Executable<Optional<Peer>> fromFile(File file);
        Executable<Optional<Peer>> fromURL(URL url);
 
 }
index fbfb314..a4f4452 100644 (file)
@@ -35,7 +35,7 @@ public class AddPeerCommandImpl implements AddPeerCommand {
        }
 
        @Override
-       public Executable<Optional<Peer>> withFile(File file) {
+       public Executable<Optional<Peer>> fromFile(File file) {
                this.file.set(file);
                return this::execute;
        }
index 574f4d7..840e601 100644 (file)
@@ -1001,7 +1001,7 @@ public class DefaultFcpClientTest {
 
        @Test
        public void defaultFcpClientCanAddPeerFromFile() throws InterruptedException, ExecutionException, IOException {
-               Future<Optional<Peer>> peer = fcpClient.addPeer().withFile(new File("/tmp/ref.txt")).execute();
+               Future<Optional<Peer>> peer = fcpClient.addPeer().fromFile(new File("/tmp/ref.txt")).execute();
                connectNode();
                List<String> lines = fcpServer.collectUntil(is("EndMessage"));
                String identifier = extractIdentifier(lines);