aboutsummaryrefslogtreecommitdiffstats
path: root/vespajlib/src/test/java/com/yahoo/io/HexDumpTestCase.java
diff options
context:
space:
mode:
authorHarald Musum <musum@verizonmedia.com>2020-10-05 15:04:38 +0200
committerGitHub <noreply@github.com>2020-10-05 15:04:38 +0200
commit3f96fe4e1a96b3b21c913a392da87e5ec669b286 (patch)
treebfcfbad0db1a54372fec7e483749706bdc55f6f6 /vespajlib/src/test/java/com/yahoo/io/HexDumpTestCase.java
parent233b521555e240458e38f555430459c3e30f0d64 (diff)
Revert "Remove unused Utf8 methods"
Diffstat (limited to 'vespajlib/src/test/java/com/yahoo/io/HexDumpTestCase.java')
-rw-r--r--vespajlib/src/test/java/com/yahoo/io/HexDumpTestCase.java19
1 files changed, 14 insertions, 5 deletions
diff --git a/vespajlib/src/test/java/com/yahoo/io/HexDumpTestCase.java b/vespajlib/src/test/java/com/yahoo/io/HexDumpTestCase.java
index d250338b8fe..dcea8101d9c 100644
--- a/vespajlib/src/test/java/com/yahoo/io/HexDumpTestCase.java
+++ b/vespajlib/src/test/java/com/yahoo/io/HexDumpTestCase.java
@@ -1,19 +1,28 @@
-// Copyright Verizon Media. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.io;
import org.junit.Test;
-import java.nio.charset.StandardCharsets;
+import com.yahoo.text.Utf8;
+
+import java.io.ByteArrayOutputStream;
+import java.io.PrintStream;
+import java.io.UnsupportedEncodingException;
+import java.nio.ByteBuffer;
+import java.nio.charset.Charset;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
/**
* @author Simon Thoresen Hult
- * @author Steinar Knutsen
+ * @author <a href="mailto:steinar@yahoo-inc.com">Steinar Knutsen</a>
*/
public class HexDumpTestCase {
+ private static final Charset UTF8 = Charset.forName("UTF-8");
+ private static final Charset UTF16 = Charset.forName("UTF-16");
+
@Test
public void requireThatToHexStringAcceptsNull() {
assertNull(HexDump.toHexString(null));
@@ -22,10 +31,10 @@ public class HexDumpTestCase {
@Test
public void requireThatToHexStringIsUnformatted() {
assertEquals("6162636465666768696A6B6C6D6E6F707172737475767778797A",
- HexDump.toHexString("abcdefghijklmnopqrstuvwxyz".getBytes(StandardCharsets.UTF_8)));
+ HexDump.toHexString("abcdefghijklmnopqrstuvwxyz".getBytes(UTF8)));
assertEquals("FEFF006100620063006400650066006700680069006A006B006C00" +
"6D006E006F0070007100720073007400750076007700780079007A",
- HexDump.toHexString("abcdefghijklmnopqrstuvwxyz".getBytes(StandardCharsets.UTF_16)));
+ HexDump.toHexString("abcdefghijklmnopqrstuvwxyz".getBytes(UTF16)));
}
}