Improve ClientGet tests
authorDavid ‘Bombe’ Roden <bombe@freenetproject.org>
Mon, 24 Aug 2015 04:33:06 +0000 (06:33 +0200)
committerDavid ‘Bombe’ Roden <bombe@freenetproject.org>
Mon, 24 Aug 2015 04:33:06 +0000 (06:33 +0200)
src/test/java/net/pterodactylus/fcp/quelaton/DefaultFcpClientTest.java

index 32837dd..428ee04 100644 (file)
@@ -1866,7 +1866,7 @@ public class DefaultFcpClientTest {
                @Test
                public void works() throws InterruptedException, ExecutionException, IOException {
                        Future<Optional<Data>> dataFuture = fcpClient.clientGet().uri("KSK@foo.txt").execute();
                @Test
                public void works() throws InterruptedException, ExecutionException, IOException {
                        Future<Optional<Data>> dataFuture = fcpClient.clientGet().uri("KSK@foo.txt").execute();
-                       connectAndAssert(() -> matchesFcpMessage("ClientGet", "URI=KSK@foo.txt"));
+                       connectAndAssert(() -> matchesFcpMessage("ClientGet", "URI=KSK@foo.txt", "ReturnType=direct"));
                        replyWithAllData("not-test", "Hello World", "text/plain;charset=latin-9");
                        replyWithAllData(identifier, "Hello", "text/plain;charset=utf-8");
                        Optional<Data> data = dataFuture.get();
                        replyWithAllData("not-test", "Hello World", "text/plain;charset=latin-9");
                        replyWithAllData(identifier, "Hello", "text/plain;charset=utf-8");
                        Optional<Data> data = dataFuture.get();
@@ -1877,6 +1877,7 @@ public class DefaultFcpClientTest {
                public void getFailedIsRecognized() throws InterruptedException, ExecutionException, IOException {
                        Future<Optional<Data>> dataFuture = fcpClient.clientGet().uri("KSK@foo.txt").execute();
                        connectAndAssert(() -> matchesFcpMessage("ClientGet", "URI=KSK@foo.txt"));
                public void getFailedIsRecognized() throws InterruptedException, ExecutionException, IOException {
                        Future<Optional<Data>> dataFuture = fcpClient.clientGet().uri("KSK@foo.txt").execute();
                        connectAndAssert(() -> matchesFcpMessage("ClientGet", "URI=KSK@foo.txt"));
+                       replyWithGetFailed("not-test");
                        replyWithGetFailed(identifier);
                        Optional<Data> data = dataFuture.get();
                        assertThat(data.isPresent(), is(false));
                        replyWithGetFailed(identifier);
                        Optional<Data> data = dataFuture.get();
                        assertThat(data.isPresent(), is(false));