Extract URIGenerated reply to its own method
authorDavid ‘Bombe’ Roden <bombe@freenetproject.org>
Fri, 16 Oct 2015 06:29:21 +0000 (08:29 +0200)
committerDavid ‘Bombe’ Roden <bombe@freenetproject.org>
Fri, 16 Oct 2015 06:29:21 +0000 (08:29 +0200)
src/test/java/net/pterodactylus/fcp/quelaton/DefaultFcpClientTest.java

index d0ae0e5..c8a834a 100644 (file)
@@ -1607,12 +1607,7 @@ public class DefaultFcpClientTest {
                                connectNode();
                                List<String> lines = fcpServer.collectUntil(is("Hello"));
                                String identifier = extractIdentifier(lines);
-                               fcpServer.writeLine(
-                                       "URIGenerated",
-                                       "Identifier=" + identifier,
-                                       "URI=KSK@foo.txt",
-                                       "EndMessage"
-                               );
+                               replyWithGeneratedUri();
                                replyWithPutSuccessful(identifier);
                                assertThat(key.get().get().getKey(), is("KSK@foo.txt"));
                                assertThat(generatedKeys, contains("KSK@foo.txt"));
@@ -1651,6 +1646,15 @@ public class DefaultFcpClientTest {
                        );
                }
 
+               private void replyWithGeneratedUri() throws IOException {
+                       fcpServer.writeLine(
+                               "URIGenerated",
+                               "Identifier=" + identifier,
+                               "URI=KSK@foo.txt",
+                               "EndMessage"
+                       );
+               }
+
                private void replyWithSimpleProgress(
                        int total, int required, int failed, int fatallyFailed, int succeeded, int lastProgress,
                        boolean finalizedTotal, int minSuccessFetchBlocks) throws IOException {