1717
1818package org .apache .commons .codec .binary ;
1919
20- import static java .nio .charset .StandardCharsets .UTF_8 ;
2120import static org .junit .Assert .assertArrayEquals ;
2221import static org .junit .Assert .assertEquals ;
2322import static org .junit .Assert .assertFalse ;
@@ -70,7 +69,7 @@ protected ByteBuffer allocate(final int capacity) {
7069 * @return the byte buffer
7170 */
7271 private ByteBuffer getByteBufferUtf8 (final String string ) {
73- final byte [] bytes = string .getBytes (UTF_8 );
72+ final byte [] bytes = string .getBytes (StandardCharsets . UTF_8 );
7473 final ByteBuffer bb = allocate (bytes .length );
7574 bb .put (bytes );
7675 bb .flip ();
@@ -586,7 +585,7 @@ public void testEncodeHex_ByteBufferWithLimit() {
586585
587586 @ Test
588587 public void testEncodeHexPartialInput () {
589- final byte data [] = "hello world" .getBytes (UTF_8 );
588+ final byte data [] = "hello world" .getBytes (StandardCharsets . UTF_8 );
590589
591590 char [] hex = Hex .encodeHex (data , 0 , 0 , true );
592591 assertArrayEquals (new char [0 ], hex );
@@ -612,15 +611,15 @@ public void testEncodeHexPartialInput() {
612611
613612 @ Test (expected =ArrayIndexOutOfBoundsException .class )
614613 public void testEncodeHexPartialInputUnderbounds () {
615- final byte data [] = "hello world" .getBytes (UTF_8 );
614+ final byte data [] = "hello world" .getBytes (StandardCharsets . UTF_8 );
616615
617616 final char [] hex = Hex .encodeHex (data , -2 , 10 , true );
618617 assertArrayEquals ("64" .toCharArray (), hex );
619618 }
620619
621620 @ Test (expected =ArrayIndexOutOfBoundsException .class )
622621 public void testEncodeHexPartialInputOverbounds () {
623- final byte data [] = "hello world" .getBytes (UTF_8 );
622+ final byte data [] = "hello world" .getBytes (StandardCharsets . UTF_8 );
624623
625624 final char [] hex = Hex .encodeHex (data , 9 , 10 , true );
626625 assertArrayEquals ("64" .toCharArray (), hex );
@@ -713,12 +712,12 @@ public void testEncodeStringEmpty() throws EncoderException {
713712
714713 @ Test
715714 public void testGetCharset () {
716- Assert .assertEquals (UTF_8 , new Hex (UTF_8 ).getCharset ());
715+ Assert .assertEquals (StandardCharsets . UTF_8 , new Hex (StandardCharsets . UTF_8 ).getCharset ());
717716 }
718717
719718 @ Test
720719 public void testGetCharsetName () {
721- Assert .assertEquals (UTF_8 .name (), new Hex (UTF_8 ).getCharsetName ());
720+ Assert .assertEquals (StandardCharsets . UTF_8 .name (), new Hex (StandardCharsets . UTF_8 ).getCharsetName ());
722721 }
723722
724723 @ Test
0 commit comments