This is an automated email from the ASF dual-hosted git repository.

orpiske pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git

commit b78904f255aee2e2f1ff8ce9863d7734b5e7a4b5
Author: Otavio Rodolfo Piske <[email protected]>
AuthorDate: Tue Apr 9 17:14:00 2024 +0200

    (chores) camel-core: use the standard charsets constants
---
 .../camel/component/language/LanguageCacheScriptTest.java   |  3 ++-
 .../camel/component/language/LanguageNoCacheScriptTest.java |  3 ++-
 .../component/language/LanguageRouteConvertBodyTest.java    |  3 ++-
 .../component/language/LanguageRouteNoTransformTest.java    |  3 ++-
 .../apache/camel/component/language/LanguageRouteTest.java  |  3 ++-
 .../LanguageScriptInHeaderRouteTakePrecedenceTest.java      |  3 ++-
 .../PropertiesComponentEIPChoiceConvertBodyToTest.java      |  4 +++-
 .../properties/PropertiesComponentEIPConvertBodyToTest.java |  4 +++-
 .../test/java/org/apache/camel/converter/ConverterTest.java |  3 ++-
 .../java/org/apache/camel/converter/IOConverterTest.java    |  3 ++-
 .../org/apache/camel/converter/jaxp/DomConverterTest.java   |  7 +++++--
 .../org/apache/camel/converter/jaxp/StaxConverterTest.java  |  6 +++---
 .../processor/MultiCastParallelAndStreamCachingTest.java    | 13 +++++++++----
 .../processor/MultiCastStreamCachingInSubRouteTest.java     |  2 +-
 .../processor/SplitterStreamCachingInSubRouteTest.java      |  2 +-
 .../apache/camel/processor/converter/ConvertBodyTest.java   |  9 +++++----
 .../apache/camel/processor/converter/ConvertHeaderTest.java | 13 +++++++++----
 .../camel/processor/converter/ConvertVariableTest.java      | 11 +++++++----
 .../camel/support/builder/RecordableInputStreamTest.java    |  9 +++++----
 .../apache/camel/support/builder/RecordableReaderTest.java  |  9 +++++----
 20 files changed, 72 insertions(+), 41 deletions(-)

diff --git 
a/core/camel-core/src/test/java/org/apache/camel/component/language/LanguageCacheScriptTest.java
 
b/core/camel-core/src/test/java/org/apache/camel/component/language/LanguageCacheScriptTest.java
index 76c70a6fe2d..9fc38cb366e 100644
--- 
a/core/camel-core/src/test/java/org/apache/camel/component/language/LanguageCacheScriptTest.java
+++ 
b/core/camel-core/src/test/java/org/apache/camel/component/language/LanguageCacheScriptTest.java
@@ -17,6 +17,7 @@
 package org.apache.camel.component.language;
 
 import java.net.URLEncoder;
+import java.nio.charset.StandardCharsets;
 
 import org.apache.camel.ContextTestSupport;
 import org.apache.camel.Expression;
@@ -52,7 +53,7 @@ public class LanguageCacheScriptTest extends 
ContextTestSupport {
         return new RouteBuilder() {
             @Override
             public void configure() throws Exception {
-                String script = URLEncoder.encode("Hello ${body}", "UTF-8");
+                String script = URLEncoder.encode("Hello ${body}", 
StandardCharsets.UTF_8);
                 endpoint = context.getEndpoint("language:simple:" + script + 
"?transform=false&cacheScript=true",
                         LanguageEndpoint.class);
 
diff --git 
a/core/camel-core/src/test/java/org/apache/camel/component/language/LanguageNoCacheScriptTest.java
 
b/core/camel-core/src/test/java/org/apache/camel/component/language/LanguageNoCacheScriptTest.java
index 8b0c73230cf..f73a2d5170c 100644
--- 
a/core/camel-core/src/test/java/org/apache/camel/component/language/LanguageNoCacheScriptTest.java
+++ 
b/core/camel-core/src/test/java/org/apache/camel/component/language/LanguageNoCacheScriptTest.java
@@ -17,6 +17,7 @@
 package org.apache.camel.component.language;
 
 import java.net.URLEncoder;
+import java.nio.charset.StandardCharsets;
 
 import org.apache.camel.ContextTestSupport;
 import org.apache.camel.Expression;
@@ -52,7 +53,7 @@ public class LanguageNoCacheScriptTest extends 
ContextTestSupport {
         return new RouteBuilder() {
             @Override
             public void configure() throws Exception {
-                String script = URLEncoder.encode("Hello ${body}", "UTF-8");
+                String script = URLEncoder.encode("Hello ${body}", 
StandardCharsets.UTF_8);
                 endpoint = context.getEndpoint("language:simple:" + script + 
"?transform=false&cacheScript=false",
                         LanguageEndpoint.class);
 
diff --git 
a/core/camel-core/src/test/java/org/apache/camel/component/language/LanguageRouteConvertBodyTest.java
 
b/core/camel-core/src/test/java/org/apache/camel/component/language/LanguageRouteConvertBodyTest.java
index dde27996c9f..1370e555a1d 100644
--- 
a/core/camel-core/src/test/java/org/apache/camel/component/language/LanguageRouteConvertBodyTest.java
+++ 
b/core/camel-core/src/test/java/org/apache/camel/component/language/LanguageRouteConvertBodyTest.java
@@ -17,6 +17,7 @@
 package org.apache.camel.component.language;
 
 import java.net.URLEncoder;
+import java.nio.charset.StandardCharsets;
 
 import org.apache.camel.ContextTestSupport;
 import org.apache.camel.builder.RouteBuilder;
@@ -39,7 +40,7 @@ public class LanguageRouteConvertBodyTest extends 
ContextTestSupport {
             @Override
             public void configure() throws Exception {
                 // START SNIPPET: e1
-                String script = 
URLEncoder.encode("${mandatoryBodyAs(String)}", "UTF-8");
+                String script = 
URLEncoder.encode("${mandatoryBodyAs(String)}", StandardCharsets.UTF_8);
                 from("direct:start").to("language:simple:" + 
script).to("mock:result");
                 // END SNIPPET: e1
             }
diff --git 
a/core/camel-core/src/test/java/org/apache/camel/component/language/LanguageRouteNoTransformTest.java
 
b/core/camel-core/src/test/java/org/apache/camel/component/language/LanguageRouteNoTransformTest.java
index 80279c84e0a..6cc1e9e95d8 100644
--- 
a/core/camel-core/src/test/java/org/apache/camel/component/language/LanguageRouteNoTransformTest.java
+++ 
b/core/camel-core/src/test/java/org/apache/camel/component/language/LanguageRouteNoTransformTest.java
@@ -17,6 +17,7 @@
 package org.apache.camel.component.language;
 
 import java.net.URLEncoder;
+import java.nio.charset.StandardCharsets;
 
 import org.apache.camel.ContextTestSupport;
 import org.apache.camel.builder.RouteBuilder;
@@ -38,7 +39,7 @@ public class LanguageRouteNoTransformTest extends 
ContextTestSupport {
         return new RouteBuilder() {
             @Override
             public void configure() throws Exception {
-                String script = URLEncoder.encode("Hello ${body}", "UTF-8");
+                String script = URLEncoder.encode("Hello ${body}", 
StandardCharsets.UTF_8);
                 from("direct:start").to("language:simple:" + script + 
"?transform=false").to("mock:result");
             }
         };
diff --git 
a/core/camel-core/src/test/java/org/apache/camel/component/language/LanguageRouteTest.java
 
b/core/camel-core/src/test/java/org/apache/camel/component/language/LanguageRouteTest.java
index 340a52d5d54..4bb6efc4c22 100644
--- 
a/core/camel-core/src/test/java/org/apache/camel/component/language/LanguageRouteTest.java
+++ 
b/core/camel-core/src/test/java/org/apache/camel/component/language/LanguageRouteTest.java
@@ -17,6 +17,7 @@
 package org.apache.camel.component.language;
 
 import java.net.URLEncoder;
+import java.nio.charset.StandardCharsets;
 
 import org.apache.camel.ContextTestSupport;
 import org.apache.camel.builder.RouteBuilder;
@@ -39,7 +40,7 @@ public class LanguageRouteTest extends ContextTestSupport {
             @Override
             public void configure() throws Exception {
                 // START SNIPPET: e1
-                String script = URLEncoder.encode("Hello ${body}", "UTF-8");
+                String script = URLEncoder.encode("Hello ${body}", 
StandardCharsets.UTF_8);
                 from("direct:start").to("language:simple:" + 
script).to("mock:result");
                 // END SNIPPET: e1
             }
diff --git 
a/core/camel-core/src/test/java/org/apache/camel/component/language/LanguageScriptInHeaderRouteTakePrecedenceTest.java
 
b/core/camel-core/src/test/java/org/apache/camel/component/language/LanguageScriptInHeaderRouteTakePrecedenceTest.java
index c4da22e1458..bed7172c3bc 100644
--- 
a/core/camel-core/src/test/java/org/apache/camel/component/language/LanguageScriptInHeaderRouteTakePrecedenceTest.java
+++ 
b/core/camel-core/src/test/java/org/apache/camel/component/language/LanguageScriptInHeaderRouteTakePrecedenceTest.java
@@ -17,6 +17,7 @@
 package org.apache.camel.component.language;
 
 import java.net.URLEncoder;
+import java.nio.charset.StandardCharsets;
 
 import org.apache.camel.ContextTestSupport;
 import org.apache.camel.Exchange;
@@ -48,7 +49,7 @@ public class LanguageScriptInHeaderRouteTakePrecedenceTest 
extends ContextTestSu
         return new RouteBuilder() {
             @Override
             public void configure() throws Exception {
-                String script = URLEncoder.encode("Bye ${body}", "UTF-8");
+                String script = URLEncoder.encode("Bye ${body}", 
StandardCharsets.UTF_8);
                 from("direct:start").to("language:simple:" + 
script).to("mock:result");
             }
         };
diff --git 
a/core/camel-core/src/test/java/org/apache/camel/component/properties/PropertiesComponentEIPChoiceConvertBodyToTest.java
 
b/core/camel-core/src/test/java/org/apache/camel/component/properties/PropertiesComponentEIPChoiceConvertBodyToTest.java
index feae7d781bf..e6cea5051ba 100644
--- 
a/core/camel-core/src/test/java/org/apache/camel/component/properties/PropertiesComponentEIPChoiceConvertBodyToTest.java
+++ 
b/core/camel-core/src/test/java/org/apache/camel/component/properties/PropertiesComponentEIPChoiceConvertBodyToTest.java
@@ -16,6 +16,8 @@
  */
 package org.apache.camel.component.properties;
 
+import java.nio.charset.StandardCharsets;
+
 import org.apache.camel.CamelContext;
 import org.apache.camel.ContextTestSupport;
 import org.apache.camel.builder.RouteBuilder;
@@ -26,7 +28,7 @@ public class PropertiesComponentEIPChoiceConvertBodyToTest 
extends ContextTestSu
 
     @Test
     public void testConvertToBytesCharset() throws Exception {
-        byte[] body = "Hello World".getBytes("iso-8859-1");
+        byte[] body = "Hello World".getBytes(StandardCharsets.ISO_8859_1);
 
         getMockEndpoint("mock:null").expectedMessageCount(0);
         MockEndpoint result = getMockEndpoint("mock:result");
diff --git 
a/core/camel-core/src/test/java/org/apache/camel/component/properties/PropertiesComponentEIPConvertBodyToTest.java
 
b/core/camel-core/src/test/java/org/apache/camel/component/properties/PropertiesComponentEIPConvertBodyToTest.java
index 39857f0641d..7dc2c75fd4e 100644
--- 
a/core/camel-core/src/test/java/org/apache/camel/component/properties/PropertiesComponentEIPConvertBodyToTest.java
+++ 
b/core/camel-core/src/test/java/org/apache/camel/component/properties/PropertiesComponentEIPConvertBodyToTest.java
@@ -16,6 +16,8 @@
  */
 package org.apache.camel.component.properties;
 
+import java.nio.charset.StandardCharsets;
+
 import org.apache.camel.CamelContext;
 import org.apache.camel.ContextTestSupport;
 import org.apache.camel.builder.RouteBuilder;
@@ -26,7 +28,7 @@ public class PropertiesComponentEIPConvertBodyToTest extends 
ContextTestSupport
 
     @Test
     public void testConvertToBytesCharset() throws Exception {
-        byte[] body = "Hello World".getBytes("iso-8859-1");
+        byte[] body = "Hello World".getBytes(StandardCharsets.ISO_8859_1);
 
         MockEndpoint result = getMockEndpoint("mock:result");
         result.expectedBodiesReceived(body);
diff --git 
a/core/camel-core/src/test/java/org/apache/camel/converter/ConverterTest.java 
b/core/camel-core/src/test/java/org/apache/camel/converter/ConverterTest.java
index 1eca55a02f8..78cebc90fec 100644
--- 
a/core/camel-core/src/test/java/org/apache/camel/converter/ConverterTest.java
+++ 
b/core/camel-core/src/test/java/org/apache/camel/converter/ConverterTest.java
@@ -20,6 +20,7 @@ import java.io.File;
 import java.io.InputStream;
 import java.net.URL;
 import java.net.URLDecoder;
+import java.nio.charset.StandardCharsets;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.List;
@@ -159,7 +160,7 @@ public class ConverterTest extends TestSupport {
     public void testFileToString() throws Exception {
         URL resource = getClass().getResource("dummy.txt");
         assertNotNull(resource, "Cannot find resource!");
-        File file = new File(URLDecoder.decode(resource.getFile(), "UTF-8"));
+        File file = new File(URLDecoder.decode(resource.getFile(), 
StandardCharsets.UTF_8));
         String text = converter.convertTo(String.class, file);
         assertNotNull(text, "Should have returned a String!");
         text = text.trim();
diff --git 
a/core/camel-core/src/test/java/org/apache/camel/converter/IOConverterTest.java 
b/core/camel-core/src/test/java/org/apache/camel/converter/IOConverterTest.java
index 391748a6c39..77fa82da825 100644
--- 
a/core/camel-core/src/test/java/org/apache/camel/converter/IOConverterTest.java
+++ 
b/core/camel-core/src/test/java/org/apache/camel/converter/IOConverterTest.java
@@ -29,6 +29,7 @@ import java.io.Reader;
 import java.io.StringReader;
 import java.io.Writer;
 import java.net.URL;
+import java.nio.charset.StandardCharsets;
 import java.nio.file.Files;
 import java.nio.file.Path;
 import java.nio.file.Paths;
@@ -239,7 +240,7 @@ public class IOConverterTest extends ContextTestSupport {
     @Test
     public void testInputStreamToString() throws Exception {
         String data = "46\u00B037'00\"N\"";
-        ByteArrayInputStream is = new 
ByteArrayInputStream(data.getBytes("UTF-8"));
+        ByteArrayInputStream is = new 
ByteArrayInputStream(data.getBytes(StandardCharsets.UTF_8));
         Exchange exchange = new DefaultExchange(context);
         exchange.setProperty(Exchange.CHARSET_NAME, "UTF-8");
         String result = IOConverter.toString(is, exchange);
diff --git 
a/core/camel-core/src/test/java/org/apache/camel/converter/jaxp/DomConverterTest.java
 
b/core/camel-core/src/test/java/org/apache/camel/converter/jaxp/DomConverterTest.java
index 632b05c87b7..ae2a0560335 100644
--- 
a/core/camel-core/src/test/java/org/apache/camel/converter/jaxp/DomConverterTest.java
+++ 
b/core/camel-core/src/test/java/org/apache/camel/converter/jaxp/DomConverterTest.java
@@ -17,6 +17,7 @@
 package org.apache.camel.converter.jaxp;
 
 import java.io.InputStream;
+import java.nio.charset.StandardCharsets;
 import java.util.List;
 
 import org.w3c.dom.Document;
@@ -46,7 +47,8 @@ public class DomConverterTest extends ContextTestSupport {
                 "<?xml version=\"1.0\" 
encoding=\"UTF-8\"?><hello>world!</hello>");
 
         byte[] bytes = new 
DomConverter().toByteArray(document.getChildNodes(), null);
-        
assertTrue(ObjectHelper.equalByteArray("<hello>world!</hello>".getBytes("UTF-8"),
 bytes), "Should be equal");
+        
assertTrue(ObjectHelper.equalByteArray("<hello>world!</hello>".getBytes(StandardCharsets.UTF_8),
 bytes),
+                "Should be equal");
     }
 
     @Test
@@ -55,7 +57,8 @@ public class DomConverterTest extends ContextTestSupport {
                 "<?xml version=\"1.0\" 
encoding=\"UTF-8\"?><foo>\u99f1\u99ddb\u00e4r</foo>");
 
         byte[] bytes = new 
DomConverter().toByteArray(document.getChildNodes(), null);
-        
assertTrue(ObjectHelper.equalByteArray("<foo>\u99f1\u99ddb\u00e4r</foo>".getBytes("UTF-8"),
 bytes), "Should be equal");
+        
assertTrue(ObjectHelper.equalByteArray("<foo>\u99f1\u99ddb\u00e4r</foo>".getBytes(StandardCharsets.UTF_8),
 bytes),
+                "Should be equal");
     }
 
     @Test
diff --git 
a/core/camel-core/src/test/java/org/apache/camel/converter/jaxp/StaxConverterTest.java
 
b/core/camel-core/src/test/java/org/apache/camel/converter/jaxp/StaxConverterTest.java
index e8e3f72a982..573b76c4bed 100644
--- 
a/core/camel-core/src/test/java/org/apache/camel/converter/jaxp/StaxConverterTest.java
+++ 
b/core/camel-core/src/test/java/org/apache/camel/converter/jaxp/StaxConverterTest.java
@@ -110,7 +110,7 @@ public class StaxConverterTest extends ContextTestSupport {
         }
         assertNotNull(output);
 
-        String result = new String(output.toByteArray(), UTF_8.name());
+        String result = new String(output.toByteArray(), UTF_8);
         // normalize the auotation mark
         if (result.indexOf('\'') > 0) {
             result = result.replace('\'', '"');
@@ -169,7 +169,7 @@ public class StaxConverterTest extends ContextTestSupport {
         }
         assertNotNull(output);
 
-        String result = new String(output.toByteArray(), UTF_8.name());
+        String result = new String(output.toByteArray(), UTF_8);
 
         assertEquals(TEST_XML, result);
     }
@@ -222,7 +222,7 @@ public class StaxConverterTest extends ContextTestSupport {
             in = 
context.getTypeConverter().mandatoryConvertTo(InputStream.class, xreader);
 
             // verify
-            InputStream expected = new 
ByteArrayInputStream(TEST_XML_7000.getBytes("utf-8"));
+            InputStream expected = new 
ByteArrayInputStream(TEST_XML_7000.getBytes(StandardCharsets.UTF_8));
             byte[] tmp1 = new byte[512];
             byte[] tmp2 = new byte[512];
             for (;;) {
diff --git 
a/core/camel-core/src/test/java/org/apache/camel/processor/MultiCastParallelAndStreamCachingTest.java
 
b/core/camel-core/src/test/java/org/apache/camel/processor/MultiCastParallelAndStreamCachingTest.java
index 17f4300d4b6..1262af9cf4c 100644
--- 
a/core/camel-core/src/test/java/org/apache/camel/processor/MultiCastParallelAndStreamCachingTest.java
+++ 
b/core/camel-core/src/test/java/org/apache/camel/processor/MultiCastParallelAndStreamCachingTest.java
@@ -21,6 +21,7 @@ import java.io.ByteArrayOutputStream;
 import java.io.InputStream;
 import java.io.InputStreamReader;
 import java.io.Reader;
+import java.nio.charset.StandardCharsets;
 
 import javax.xml.transform.sax.SAXSource;
 import javax.xml.transform.stream.StreamSource;
@@ -130,7 +131,7 @@ public class MultiCastParallelAndStreamCachingTest extends 
ContextTestSupport {
         mock = getMockEndpoint("mock:resultb");
         mock.expectedBodiesReceived("<start></start>");
 
-        template.sendBody("direct:start", new 
ByteArrayInputStream("<start></start>".getBytes("UTF-8")));
+        template.sendBody("direct:start", new 
ByteArrayInputStream("<start></start>".getBytes(StandardCharsets.UTF_8)));
 
         assertMockEndpointsSatisfied();
     }
@@ -194,7 +195,9 @@ public class MultiCastParallelAndStreamCachingTest extends 
ContextTestSupport {
         mock.expectedBodiesReceived(abcScharpS);
 
         InputStreamReader isr
-                = new InputStreamReader(new 
ByteArrayInputStream(abcScharpS.getBytes("ISO-8859-1")), "ISO-8859-1");
+                = new InputStreamReader(
+                        new 
ByteArrayInputStream(abcScharpS.getBytes(StandardCharsets.ISO_8859_1)),
+                        StandardCharsets.ISO_8859_1);
         template.sendBody("direct:start", isr);
 
         assertMockEndpointsSatisfied();
@@ -209,7 +212,7 @@ public class MultiCastParallelAndStreamCachingTest extends 
ContextTestSupport {
         mock = getMockEndpoint("mock:resultb");
         mock.expectedBodiesReceived(input);
 
-        StreamSource ss = new StreamSource(new 
ByteArrayInputStream(input.getBytes("UTF-8")));
+        StreamSource ss = new StreamSource(new 
ByteArrayInputStream(input.getBytes(StandardCharsets.UTF_8)));
         template.sendBody("direct:start", ss);
 
         assertMockEndpointsSatisfied();
@@ -224,7 +227,9 @@ public class MultiCastParallelAndStreamCachingTest extends 
ContextTestSupport {
         mock = getMockEndpoint("mock:resultb");
         mock.expectedBodiesReceived(input);
 
-        InputStreamReader isr = new InputStreamReader(new 
ByteArrayInputStream(input.getBytes("ISO-8859-1")), "ISO-8859-1");
+        InputStreamReader isr = new InputStreamReader(
+                new 
ByteArrayInputStream(input.getBytes(StandardCharsets.ISO_8859_1)),
+                StandardCharsets.ISO_8859_1);
         StreamSource ss = new StreamSource(isr);
         template.sendBody("direct:start", ss);
 
diff --git 
a/core/camel-core/src/test/java/org/apache/camel/processor/MultiCastStreamCachingInSubRouteTest.java
 
b/core/camel-core/src/test/java/org/apache/camel/processor/MultiCastStreamCachingInSubRouteTest.java
index a6e25b0263d..af99f03292f 100644
--- 
a/core/camel-core/src/test/java/org/apache/camel/processor/MultiCastStreamCachingInSubRouteTest.java
+++ 
b/core/camel-core/src/test/java/org/apache/camel/processor/MultiCastStreamCachingInSubRouteTest.java
@@ -111,7 +111,7 @@ public class MultiCastStreamCachingInSubRouteTest extends 
ContextTestSupport {
                 String merged = oldBody + newBody;
                 // also do stream caching in the aggregation strategy
                 CachedOutputStream cos = new CachedOutputStream(newExchange);
-                cos.write(merged.getBytes("UTF-8"));
+                cos.write(merged.getBytes(StandardCharsets.UTF_8));
                 cos.close();
                 oldExchange.getIn().setBody(cos.newStreamCache());
                 return oldExchange;
diff --git 
a/core/camel-core/src/test/java/org/apache/camel/processor/SplitterStreamCachingInSubRouteTest.java
 
b/core/camel-core/src/test/java/org/apache/camel/processor/SplitterStreamCachingInSubRouteTest.java
index 33599392b19..46391bf102c 100644
--- 
a/core/camel-core/src/test/java/org/apache/camel/processor/SplitterStreamCachingInSubRouteTest.java
+++ 
b/core/camel-core/src/test/java/org/apache/camel/processor/SplitterStreamCachingInSubRouteTest.java
@@ -120,7 +120,7 @@ public class SplitterStreamCachingInSubRouteTest extends 
ContextTestSupport {
                 String merged = oldBody + newBody;
                 // also do stream caching in the aggregation strategy
                 CachedOutputStream cos = new CachedOutputStream(newExchange);
-                cos.write(merged.getBytes("UTF-8"));
+                cos.write(merged.getBytes(StandardCharsets.UTF_8));
                 cos.close();
                 oldExchange.getIn().setBody(cos.newStreamCache());
                 return oldExchange;
diff --git 
a/core/camel-core/src/test/java/org/apache/camel/processor/converter/ConvertBodyTest.java
 
b/core/camel-core/src/test/java/org/apache/camel/processor/converter/ConvertBodyTest.java
index af5f8745510..56a15e1d1bc 100644
--- 
a/core/camel-core/src/test/java/org/apache/camel/processor/converter/ConvertBodyTest.java
+++ 
b/core/camel-core/src/test/java/org/apache/camel/processor/converter/ConvertBodyTest.java
@@ -17,6 +17,7 @@
 package org.apache.camel.processor.converter;
 
 import java.io.ByteArrayInputStream;
+import java.nio.charset.StandardCharsets;
 import java.nio.charset.UnsupportedCharsetException;
 import java.util.Date;
 
@@ -149,7 +150,7 @@ public class ConvertBodyTest extends ContextTestSupport {
 
     @Test
     public void testConvertToBytesCharset() throws Exception {
-        byte[] body = "Hello World".getBytes("iso-8859-1");
+        byte[] body = "Hello World".getBytes(StandardCharsets.ISO_8859_1);
 
         MockEndpoint result = getMockEndpoint("mock:result");
         result.expectedBodiesReceived(body);
@@ -167,14 +168,14 @@ public class ConvertBodyTest extends ContextTestSupport {
         MockEndpoint result = getMockEndpoint("mock:result");
         result.expectedBodiesReceived(body);
 
-        template.sendBody("direct:charset3", new 
ByteArrayInputStream(body.getBytes("utf-16")));
+        template.sendBody("direct:charset3", new 
ByteArrayInputStream(body.getBytes(StandardCharsets.UTF_16)));
 
         assertMockEndpointsSatisfied();
     }
 
     @Test
     public void testConvertToBytesCharsetFail() throws Exception {
-        byte[] body = "Hello World".getBytes("utf-8");
+        byte[] body = "Hello World".getBytes(StandardCharsets.UTF_8);
 
         MockEndpoint result = getMockEndpoint("mock:result");
         result.expectedBodiesReceived(body);
@@ -194,7 +195,7 @@ public class ConvertBodyTest extends ContextTestSupport {
         MockEndpoint result = getMockEndpoint("mock:result");
         result.expectedBodiesReceived(body);
 
-        template.sendBody("direct:charset3", new 
ByteArrayInputStream(body.getBytes("utf-8")));
+        template.sendBody("direct:charset3", new 
ByteArrayInputStream(body.getBytes(StandardCharsets.UTF_8)));
 
         // should NOT be okay as we expected utf-8 but got it in utf-16
         result.assertIsNotSatisfied();
diff --git 
a/core/camel-core/src/test/java/org/apache/camel/processor/converter/ConvertHeaderTest.java
 
b/core/camel-core/src/test/java/org/apache/camel/processor/converter/ConvertHeaderTest.java
index 0680c6f6be0..638bb35d151 100644
--- 
a/core/camel-core/src/test/java/org/apache/camel/processor/converter/ConvertHeaderTest.java
+++ 
b/core/camel-core/src/test/java/org/apache/camel/processor/converter/ConvertHeaderTest.java
@@ -17,6 +17,7 @@
 package org.apache.camel.processor.converter;
 
 import java.io.ByteArrayInputStream;
+import java.nio.charset.StandardCharsets;
 import java.nio.charset.UnsupportedCharsetException;
 import java.util.Date;
 
@@ -160,7 +161,7 @@ public class ConvertHeaderTest extends ContextTestSupport {
 
     @Test
     public void testConvertToBytesCharset() throws Exception {
-        byte[] body = "Hello World".getBytes("iso-8859-1");
+        byte[] body = "Hello World".getBytes(StandardCharsets.ISO_8859_1);
 
         MockEndpoint result = getMockEndpoint("mock:result");
         result.expectedHeaderReceived("foo", body);
@@ -177,14 +178,16 @@ public class ConvertHeaderTest extends ContextTestSupport 
{
         MockEndpoint result = getMockEndpoint("mock:result");
         result.expectedHeaderReceived("foo", body);
 
-        template.sendBodyAndHeader("direct:charset3", null, "foo", new 
ByteArrayInputStream(body.getBytes("utf-16")));
+        template.sendBodyAndHeader("direct:charset3", null, "foo", new 
ByteArrayInputStream(
+                body.getBytes(
+                        StandardCharsets.UTF_16)));
 
         assertMockEndpointsSatisfied();
     }
 
     @Test
     public void testConvertToBytesCharsetFail() throws Exception {
-        byte[] body = "Hello World".getBytes("utf-8");
+        byte[] body = "Hello World".getBytes(StandardCharsets.UTF_8);
 
         MockEndpoint result = getMockEndpoint("mock:result");
         result.expectedHeaderReceived("foo", body);
@@ -206,7 +209,9 @@ public class ConvertHeaderTest extends ContextTestSupport {
         result.expectedHeaderReceived("foo", body);
         result.expectedMessageCount(1);
 
-        template.sendBodyAndHeader("direct:charset3", null, "foo", new 
ByteArrayInputStream(body.getBytes("utf-8")));
+        template.sendBodyAndHeader("direct:charset3", null, "foo", new 
ByteArrayInputStream(
+                body.getBytes(
+                        StandardCharsets.UTF_8)));
 
         // should NOT be okay as we expected utf-8 but got it in utf-16
         result.assertIsNotSatisfied();
diff --git 
a/core/camel-core/src/test/java/org/apache/camel/processor/converter/ConvertVariableTest.java
 
b/core/camel-core/src/test/java/org/apache/camel/processor/converter/ConvertVariableTest.java
index bafb26a1027..a367acd14cc 100644
--- 
a/core/camel-core/src/test/java/org/apache/camel/processor/converter/ConvertVariableTest.java
+++ 
b/core/camel-core/src/test/java/org/apache/camel/processor/converter/ConvertVariableTest.java
@@ -17,6 +17,7 @@
 package org.apache.camel.processor.converter;
 
 import java.io.ByteArrayInputStream;
+import java.nio.charset.StandardCharsets;
 import java.nio.charset.UnsupportedCharsetException;
 import java.util.Date;
 
@@ -164,7 +165,7 @@ public class ConvertVariableTest extends ContextTestSupport 
{
 
     @Test
     public void testConvertToBytesCharset() throws Exception {
-        byte[] body = "Hello World".getBytes("iso-8859-1");
+        byte[] body = "Hello World".getBytes(StandardCharsets.ISO_8859_1);
 
         MockEndpoint result = getMockEndpoint("mock:result");
         result.expectedVariableReceived("foo", body);
@@ -181,14 +182,15 @@ public class ConvertVariableTest extends 
ContextTestSupport {
         MockEndpoint result = getMockEndpoint("mock:result");
         result.expectedVariableReceived("foo", body);
 
-        fluent.to("direct:charset3").withVariable("foo", new 
ByteArrayInputStream(body.getBytes("utf-16"))).send();
+        fluent.to("direct:charset3").withVariable("foo", new 
ByteArrayInputStream(body.getBytes(StandardCharsets.UTF_16)))
+                .send();
 
         assertMockEndpointsSatisfied();
     }
 
     @Test
     public void testConvertToBytesCharsetFail() throws Exception {
-        byte[] body = "Hello World".getBytes("utf-8");
+        byte[] body = "Hello World".getBytes(StandardCharsets.UTF_8);
 
         MockEndpoint result = getMockEndpoint("mock:result");
         result.expectedVariableReceived("foo", body);
@@ -210,7 +212,8 @@ public class ConvertVariableTest extends ContextTestSupport 
{
         result.expectedVariableReceived("foo", body);
         result.expectedMessageCount(1);
 
-        fluent.to("direct:charset3").withVariable("foo", new 
ByteArrayInputStream(body.getBytes("utf-8"))).send();
+        fluent.to("direct:charset3").withVariable("foo", new 
ByteArrayInputStream(body.getBytes(StandardCharsets.UTF_8)))
+                .send();
 
         // should NOT be okay as we expected utf-8 but got it in utf-16
         result.assertIsNotSatisfied();
diff --git 
a/core/camel-core/src/test/java/org/apache/camel/support/builder/RecordableInputStreamTest.java
 
b/core/camel-core/src/test/java/org/apache/camel/support/builder/RecordableInputStreamTest.java
index 8096df5e98c..4de2bd9d16d 100644
--- 
a/core/camel-core/src/test/java/org/apache/camel/support/builder/RecordableInputStreamTest.java
+++ 
b/core/camel-core/src/test/java/org/apache/camel/support/builder/RecordableInputStreamTest.java
@@ -17,6 +17,7 @@
 package org.apache.camel.support.builder;
 
 import java.io.ByteArrayInputStream;
+import java.nio.charset.StandardCharsets;
 
 import org.junit.jupiter.api.Test;
 
@@ -49,12 +50,12 @@ public class RecordableInputStreamTest {
             int offset = i * 64;
             // consume the first 32 bytes
             String text = ris.getText(32);
-            assertEquals(new String(DATA, offset, 32, "utf-8"), text);
+            assertEquals(new String(DATA, offset, 32, StandardCharsets.UTF_8), 
text);
             assertEquals(32, ris.size());
 
             // consume the other 32 bytes
             text = ris.getText(32);
-            assertEquals(new String(DATA, offset + 32, 32, "utf-8"), text);
+            assertEquals(new String(DATA, offset + 32, 32, 
StandardCharsets.UTF_8), text);
             assertEquals(0, ris.size());
 
             ris.record();
@@ -77,7 +78,7 @@ public class RecordableInputStreamTest {
         // consume the 64 bytes
         String text = ris.getText(64);
 
-        assertEquals(new String(DATA, 0, 64, "utf-8"), text);
+        assertEquals(new String(DATA, 0, 64, StandardCharsets.UTF_8), text);
         assertEquals(0, ris.size());
 
         // read the next 64 bytes
@@ -95,7 +96,7 @@ public class RecordableInputStreamTest {
         text = ris.getText(64);
 
         // 64 * 2 = 128
-        assertEquals(new String(DATA, 128, 64, "utf-8"), text);
+        assertEquals(new String(DATA, 128, 64, StandardCharsets.UTF_8), text);
         assertEquals(0, ris.size());
 
         ris.close();
diff --git 
a/core/camel-core/src/test/java/org/apache/camel/support/builder/RecordableReaderTest.java
 
b/core/camel-core/src/test/java/org/apache/camel/support/builder/RecordableReaderTest.java
index dc445b7920d..acbf4d8a6a5 100644
--- 
a/core/camel-core/src/test/java/org/apache/camel/support/builder/RecordableReaderTest.java
+++ 
b/core/camel-core/src/test/java/org/apache/camel/support/builder/RecordableReaderTest.java
@@ -17,6 +17,7 @@
 package org.apache.camel.support.builder;
 
 import java.io.ByteArrayInputStream;
+import java.nio.charset.StandardCharsets;
 
 import org.junit.jupiter.api.Test;
 
@@ -49,12 +50,12 @@ public class RecordableReaderTest {
             int offset = i * 64;
             // consume the first 32 bytes
             String text = ris.getText(32);
-            assertEquals(new String(DATA, offset, 32, "utf-8"), text);
+            assertEquals(new String(DATA, offset, 32, StandardCharsets.UTF_8), 
text);
             assertEquals(32, ris.size());
 
             // consume the other 32 bytes
             text = ris.getText(32);
-            assertEquals(new String(DATA, offset + 32, 32, "utf-8"), text);
+            assertEquals(new String(DATA, offset + 32, 32, 
StandardCharsets.UTF_8), text);
             assertEquals(0, ris.size());
 
             ris.record();
@@ -77,7 +78,7 @@ public class RecordableReaderTest {
         // consume the 64 bytes
         String text = ris.getText(64);
 
-        assertEquals(new String(DATA, 0, 64, "utf-8"), text);
+        assertEquals(new String(DATA, 0, 64, StandardCharsets.UTF_8), text);
         assertEquals(0, ris.size());
 
         // read the next 64 bytes
@@ -95,7 +96,7 @@ public class RecordableReaderTest {
         text = ris.getText(64);
 
         // 64 * 2 = 128
-        assertEquals(new String(DATA, 128, 64, "utf-8"), text);
+        assertEquals(new String(DATA, 128, 64, StandardCharsets.UTF_8), text);
         assertEquals(0, ris.size());
 
         ris.close();

Reply via email to