From: David ‘Bombe’ Roden Date: Fri, 13 Dec 2013 22:52:22 +0000 (+0100) Subject: Use a single constant for the string to be encoded. X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=4e1385a04cd57cad86de0b4bc8d5fb5afd85d061;p=Sone.git Use a single constant for the string to be encoded. --- diff --git a/src/test/java/net/pterodactylus/sone/freenet/StringBucketTest.java b/src/test/java/net/pterodactylus/sone/freenet/StringBucketTest.java index 3109a6f..25bf65a 100644 --- a/src/test/java/net/pterodactylus/sone/freenet/StringBucketTest.java +++ b/src/test/java/net/pterodactylus/sone/freenet/StringBucketTest.java @@ -38,12 +38,13 @@ import org.junit.Test; */ public class StringBucketTest { - private final StringBucket stringBucket = new StringBucket("StringBücket Test", Charset.forName("UTF-8")); + private static final String TEST_STRING = "StringBücket Test"; + private final StringBucket stringBucket = new StringBucket(TEST_STRING, Charset.forName("UTF-8")); @Test public void shadowYieldsTheSameContent() throws IOException { Bucket secondBucket = stringBucket.createShadow(); - assertThat(secondBucket.getInputStream(), delivers("StringBücket Test".getBytes("UTF-8"))); + assertThat(secondBucket.getInputStream(), delivers(TEST_STRING.getBytes("UTF-8"))); } @Test @@ -53,12 +54,12 @@ public class StringBucketTest { @Test public void stringBucketHasTheCorrectSize() throws UnsupportedEncodingException { - assertThat(stringBucket.size(), is((long) "StringBücket Test".getBytes("UTF-8").length)); + assertThat(stringBucket.size(), is((long) TEST_STRING.getBytes("UTF-8").length)); } @Test public void inputStreamDeliversContent() throws UnsupportedEncodingException { - assertThat(stringBucket.getInputStream(), delivers("StringBücket Test".getBytes("UTF-8"))); + assertThat(stringBucket.getInputStream(), delivers(TEST_STRING.getBytes("UTF-8"))); } @Test