diff options
author | Martin Polden <mpolden@mpolden.no> | 2020-10-05 13:26:07 +0200 |
---|---|---|
committer | Martin Polden <mpolden@mpolden.no> | 2020-10-05 13:46:23 +0200 |
commit | c2b5c6561939017b1bc36d6845a405f64b34234d (patch) | |
tree | b64d27216e328522e127bfeb32eec7b6d4573d9e /vespajlib/src/test/java | |
parent | 2754be0ed9a6f9e391816ea6ed807e3e18d008a0 (diff) |
Remove unused Utf8 methods
In-lined in the tests that used them.
Diffstat (limited to 'vespajlib/src/test/java')
3 files changed, 16 insertions, 17 deletions
diff --git a/vespajlib/src/test/java/com/yahoo/io/SlowInflateTestCase.java b/vespajlib/src/test/java/com/yahoo/io/SlowInflateTestCase.java index 7726cd7ea68..7f374441a18 100644 --- a/vespajlib/src/test/java/com/yahoo/io/SlowInflateTestCase.java +++ b/vespajlib/src/test/java/com/yahoo/io/SlowInflateTestCase.java @@ -1,20 +1,20 @@ -// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +// Copyright Verizon Media. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.io; -import static org.junit.Assert.*; +import org.junit.Before; +import org.junit.Test; +import java.nio.charset.StandardCharsets; import java.util.Arrays; import java.util.zip.Deflater; -import org.junit.Before; -import org.junit.Test; - -import com.yahoo.text.Utf8; +import static org.junit.Assert.assertArrayEquals; +import static org.junit.Assert.assertTrue; /** * Check decompressor used among other things for packed summary fields. * - * @author <a href="mailto:steinar@yahoo-inc.com">Steinar Knutsen</a> + * @author Steinar Knutsen */ public class SlowInflateTestCase { @@ -27,7 +27,7 @@ public class SlowInflateTestCase { @Before public void setUp() throws Exception { value = "000000000000000000000000000000000000000000000000000000000000000"; - raw = Utf8.toBytesStd(value); + raw = value.getBytes(StandardCharsets.UTF_8); output = new byte[raw.length * 2]; Deflater compresser = new Deflater(); compresser.setInput(raw); diff --git a/vespajlib/src/test/java/com/yahoo/slime/JsonFormatTestCase.java b/vespajlib/src/test/java/com/yahoo/slime/JsonFormatTestCase.java index 44aa4ab2ff7..3b31c2b559e 100644 --- a/vespajlib/src/test/java/com/yahoo/slime/JsonFormatTestCase.java +++ b/vespajlib/src/test/java/com/yahoo/slime/JsonFormatTestCase.java @@ -1,8 +1,7 @@ -// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +// Copyright Verizon Media. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.slime; import com.yahoo.text.Utf8; -import org.junit.Ignore; import org.junit.Test; import java.io.ByteArrayOutputStream; @@ -201,7 +200,7 @@ public class JsonFormatTestCase { public void testDecodeUnicodeAmp() { final String json = "{\"body\":\"some text\\u0026more text\"}"; Slime slime = new Slime(); - new JsonDecoder().decode(slime, Utf8.toBytesStd(json)); + new JsonDecoder().decode(slime, json.getBytes(StandardCharsets.UTF_8)); Cursor a = slime.get().field("body"); assertThat(a.asString(), is("some text&more text")); } @@ -224,7 +223,7 @@ public class JsonFormatTestCase { " }\n"; Slime slime = new Slime(); - slime = new JsonDecoder().decode(slime, Utf8.toBytesStd(json)); + slime = new JsonDecoder().decode(slime, json.getBytes(StandardCharsets.UTF_8)); Cursor a = slime.get().field("rules"); assertThat(a.asString(), is(str)); } @@ -261,7 +260,7 @@ public class JsonFormatTestCase { private void verifyEncodeDecode(String json, boolean compact) { try { Slime slime = new Slime(); - new JsonDecoder().decode(slime, Utf8.toBytesStd(json)); + new JsonDecoder().decode(slime, json.getBytes(StandardCharsets.UTF_8)); ByteArrayOutputStream a = new ByteArrayOutputStream(); new JsonFormat(compact).encode(a, slime); assertEquals(json, Utf8.toString(a.toByteArray())); diff --git a/vespajlib/src/test/java/com/yahoo/text/Utf8TestCase.java b/vespajlib/src/test/java/com/yahoo/text/Utf8TestCase.java index 97d0717dc0b..8293554140d 100644 --- a/vespajlib/src/test/java/com/yahoo/text/Utf8TestCase.java +++ b/vespajlib/src/test/java/com/yahoo/text/Utf8TestCase.java @@ -1,4 +1,4 @@ -// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +// Copyright Verizon Media. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.text; import com.google.common.collect.ImmutableMap; @@ -24,8 +24,8 @@ import static org.junit.Assert.assertThat; import static org.junit.Assert.assertTrue; /** - * @author <a href="mailto:borud@yahoo-inc.com">Bjorn Borud</a> - * @author <a href="mailto:steinar@yahoo-inc.com">Steinar Knutsen</a> + * @author Bjorn Borud + * @author Steinar Knutsen */ public class Utf8TestCase { @@ -322,7 +322,7 @@ public class Utf8TestCase { for (char c=0; c < i; c++) { sb.append(c); } - assertTrue(Arrays.equals(Utf8.toBytesStd(sb.toString()), Utf8.toBytes(sb.toString()))); + assertTrue(Arrays.equals(sb.toString().getBytes(StandardCharsets.UTF_8), Utf8.toBytes(sb.toString()))); } } |