From 4e1385a04cd57cad86de0b4bc8d5fb5afd85d061 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Fri, 13 Dec 2013 23:52:22 +0100 Subject: [PATCH] Use a single constant for the string to be encoded. --- .../java/net/pterodactylus/sone/freenet/StringBucketTest.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) 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 -- 2.7.4