From 16a826adc69484e8610d35bd0295f0328c349501 Mon Sep 17 00:00:00 2001 From: Gary Gregory Date: Fri, 15 Dec 2023 16:26:58 -0500 Subject: [PATCH] Use StandardCharsets instead of magic string --- src/test/java/org/apache/commons/lang3/StringUtilsTest.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/test/java/org/apache/commons/lang3/StringUtilsTest.java b/src/test/java/org/apache/commons/lang3/StringUtilsTest.java index 748ddd38e..9094633f8 100644 --- a/src/test/java/org/apache/commons/lang3/StringUtilsTest.java +++ b/src/test/java/org/apache/commons/lang3/StringUtilsTest.java @@ -3037,7 +3037,7 @@ public class StringUtilsTest extends AbstractLangTest { // sanity check end assertEquals(expectedString, StringUtils.toEncodedString(expectedBytes, Charset.defaultCharset())); assertEquals(expectedString, StringUtils.toEncodedString(expectedBytes, Charset.forName(encoding))); - encoding = "UTF-16"; + encoding = StandardCharsets.UTF_16.name(); expectedBytes = expectedString.getBytes(Charset.forName(encoding)); assertEquals(expectedString, StringUtils.toEncodedString(expectedBytes, Charset.forName(encoding))); } @@ -3097,7 +3097,7 @@ public class StringUtilsTest extends AbstractLangTest { // sanity check end assertEquals(expectedString, StringUtils.toString(expectedBytes, null)); assertEquals(expectedString, StringUtils.toString(expectedBytes, SystemUtils.FILE_ENCODING)); - final String encoding = "UTF-16"; + final String encoding = StandardCharsets.UTF_16.name(); expectedBytes = expectedString.getBytes(Charset.forName(encoding)); assertEquals(expectedString, StringUtils.toString(expectedBytes, encoding)); }