From: David ‘Bombe’ Roden Date: Wed, 8 Jul 2015 18:53:08 +0000 (+0200) Subject: Reformatting X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=d1f191436ae44c4113f90976ea8fd9cc545c0216;p=jFCPlib.git Reformatting --- diff --git a/src/test/java/net/pterodactylus/fcp/quelaton/DefaultFcpClientTest.java b/src/test/java/net/pterodactylus/fcp/quelaton/DefaultFcpClientTest.java index 73774be..16c6190 100644 --- a/src/test/java/net/pterodactylus/fcp/quelaton/DefaultFcpClientTest.java +++ b/src/test/java/net/pterodactylus/fcp/quelaton/DefaultFcpClientTest.java @@ -34,11 +34,14 @@ import org.junit.Test; */ public class DefaultFcpClientTest { - private static final String INSERT_URI = "SSK@RVCHbJdkkyTCeNN9AYukEg76eyqmiosSaNKgE3U9zUw,7SHH53gletBVb9JD7nBsyClbLQsBubDPEIcwg908r7Y,AQECAAE/"; - private static final String REQUEST_URI = "SSK@wtbgd2loNcJCXvtQVOftl2tuWBomDQHfqS6ytpPRhfw,7SHH53gletBVb9JD7nBsyClbLQsBubDPEIcwg908r7Y,AQACAAE/"; + private static final String INSERT_URI = + "SSK@RVCHbJdkkyTCeNN9AYukEg76eyqmiosSaNKgE3U9zUw,7SHH53gletBVb9JD7nBsyClbLQsBubDPEIcwg908r7Y,AQECAAE/"; + private static final String REQUEST_URI = + "SSK@wtbgd2loNcJCXvtQVOftl2tuWBomDQHfqS6ytpPRhfw,7SHH53gletBVb9JD7nBsyClbLQsBubDPEIcwg908r7Y,AQACAAE/"; private static int threadCounter = 0; - private final ExecutorService threadPool = Executors.newCachedThreadPool((r) -> new Thread(r, "Test-Thread-" + threadCounter++)); + private final ExecutorService threadPool = + Executors.newCachedThreadPool(r -> new Thread(r, "Test-Thread-" + threadCounter++)); private final FakeTcpServer fcpServer; private final DefaultFcpClient fcpClient; @@ -106,15 +109,21 @@ public class DefaultFcpClientTest { Optional data = dataFuture.get(); assertThat(data.get().getMimeType(), is("text/plain;charset=utf-8")); assertThat(data.get().size(), is(6L)); - assertThat(ByteStreams.toByteArray(data.get().getInputStream()), is("Hello\n".getBytes(StandardCharsets.UTF_8))); + assertThat(ByteStreams.toByteArray(data.get().getInputStream()), + is("Hello\n".getBytes(StandardCharsets.UTF_8))); } private String extractIdentifier(List lines) { - return lines.stream().filter(s -> s.startsWith("Identifier=")).map(s -> s.substring(s.indexOf('=') + 1)).findFirst().orElse(""); + return lines.stream() + .filter(s -> s.startsWith("Identifier=")) + .map(s -> s.substring(s.indexOf('=') + 1)) + .findFirst() + .orElse(""); } @Test - public void clientGetDownloadsDataForCorrectIdentifier() throws InterruptedException, ExecutionException, IOException { + public void clientGetDownloadsDataForCorrectIdentifier() + throws InterruptedException, ExecutionException, IOException { Future> dataFuture = fcpClient.clientGet().uri("KSK@foo.txt"); connectNode(); List lines = fcpServer.collectUntil(is("EndMessage")); @@ -143,7 +152,8 @@ public class DefaultFcpClientTest { Optional data = dataFuture.get(); assertThat(data.get().getMimeType(), is("text/plain;charset=utf-8")); assertThat(data.get().size(), is(6L)); - assertThat(ByteStreams.toByteArray(data.get().getInputStream()), is("Hello\n".getBytes(StandardCharsets.UTF_8))); + assertThat(ByteStreams.toByteArray(data.get().getInputStream()), + is("Hello\n".getBytes(StandardCharsets.UTF_8))); } @Test @@ -164,7 +174,8 @@ public class DefaultFcpClientTest { } @Test - public void clientGetRecognizesGetFailedForCorrectIdentifier() throws InterruptedException, ExecutionException, IOException { + public void clientGetRecognizesGetFailedForCorrectIdentifier() + throws InterruptedException, ExecutionException, IOException { Future> dataFuture = fcpClient.clientGet().uri("KSK@foo.txt"); connectNode(); List lines = fcpServer.collectUntil(is("EndMessage")); @@ -198,7 +209,8 @@ public class DefaultFcpClientTest { } @Test - public void clientGetWithIgnoreDataStoreSettingSendsCorrectCommands() throws InterruptedException, ExecutionException, IOException { + public void clientGetWithIgnoreDataStoreSettingSendsCorrectCommands() + throws InterruptedException, ExecutionException, IOException { fcpClient.clientGet().ignoreDataStore().uri("KSK@foo.txt"); connectNode(); List lines = fcpServer.collectUntil(is("EndMessage")); @@ -206,7 +218,8 @@ public class DefaultFcpClientTest { } @Test - public void clientGetWithDataStoreOnlySettingSendsCorrectCommands() throws InterruptedException, ExecutionException, IOException { + public void clientGetWithDataStoreOnlySettingSendsCorrectCommands() + throws InterruptedException, ExecutionException, IOException { fcpClient.clientGet().dataStoreOnly().uri("KSK@foo.txt"); connectNode(); List lines = fcpServer.collectUntil(is("EndMessage")); @@ -214,7 +227,8 @@ public class DefaultFcpClientTest { } @Test - public void clientGetWithMaxSizeSettingSendsCorrectCommands() throws InterruptedException, ExecutionException, IOException { + public void clientGetWithMaxSizeSettingSendsCorrectCommands() + throws InterruptedException, ExecutionException, IOException { fcpClient.clientGet().maxSize(1048576).uri("KSK@foo.txt"); connectNode(); List lines = fcpServer.collectUntil(is("EndMessage")); @@ -222,7 +236,8 @@ public class DefaultFcpClientTest { } @Test - public void clientGetWithPrioritySettingSendsCorrectCommands() throws InterruptedException, ExecutionException, IOException { + public void clientGetWithPrioritySettingSendsCorrectCommands() + throws InterruptedException, ExecutionException, IOException { fcpClient.clientGet().priority(Priority.interactive).uri("KSK@foo.txt"); connectNode(); List lines = fcpServer.collectUntil(is("EndMessage")); @@ -230,7 +245,8 @@ public class DefaultFcpClientTest { } @Test - public void clientGetWithRealTimeSettingSendsCorrectCommands() throws InterruptedException, ExecutionException, IOException { + public void clientGetWithRealTimeSettingSendsCorrectCommands() + throws InterruptedException, ExecutionException, IOException { fcpClient.clientGet().realTime().uri("KSK@foo.txt"); connectNode(); List lines = fcpServer.collectUntil(is("EndMessage")); @@ -238,7 +254,8 @@ public class DefaultFcpClientTest { } @Test - public void clientGetWithGlobalSettingSendsCorrectCommands() throws InterruptedException, ExecutionException, IOException { + public void clientGetWithGlobalSettingSendsCorrectCommands() + throws InterruptedException, ExecutionException, IOException { fcpClient.clientGet().global().uri("KSK@foo.txt"); connectNode(); List lines = fcpServer.collectUntil(is("EndMessage"));