2424import static org .junit .jupiter .api .Assumptions .assumeFalse ;
2525import static org .junit .jupiter .api .Assumptions .assumeTrue ;
2626
27+ import java .nio .charset .StandardCharsets ;
2728import java .nio .file .Files ;
2829import java .nio .file .Path ;
30+ import java .util .Base64 ;
2931import java .util .List ;
3032import land .oras .ContainerRef ;
3133import land .oras .exception .OrasException ;
@@ -482,8 +484,7 @@ void testConfigLoad_success() throws Exception {
482484 void testPasswordContainingColonIsPreserved () throws Exception {
483485 String user = "user" ;
484486 String password = "p@ss:with:colons" ;
485- String auth = java .util .Base64 .getEncoder ()
486- .encodeToString ((user + ":" + password ).getBytes (java .nio .charset .StandardCharsets .UTF_8 ));
487+ String auth = Base64 .getEncoder ().encodeToString ((user + ":" + password ).getBytes (StandardCharsets .UTF_8 ));
487488 // language=json
488489 String config = """
489490 {
@@ -505,10 +506,8 @@ void testPasswordContainingColonIsPreserved() throws Exception {
505506
506507 @ Test
507508 void testMalformedEntryIsSkippedWithoutDroppingOtherCredentials () throws Exception {
508- String malformed = java .util .Base64 .getEncoder ()
509- .encodeToString ("no-colon-here" .getBytes (java .nio .charset .StandardCharsets .UTF_8 ));
510- String valid = java .util .Base64 .getEncoder ()
511- .encodeToString ("user:password" .getBytes (java .nio .charset .StandardCharsets .UTF_8 ));
509+ String malformed = Base64 .getEncoder ().encodeToString ("no-colon-here" .getBytes (StandardCharsets .UTF_8 ));
510+ String valid = Base64 .getEncoder ().encodeToString ("user:password" .getBytes (StandardCharsets .UTF_8 ));
512511 // language=json
513512 String config = """
514513 {
@@ -531,8 +530,7 @@ void testMalformedEntryIsSkippedWithoutDroppingOtherCredentials() throws Excepti
531530
532531 @ Test
533532 void testEmptyPasswordIsPreserved () throws Exception {
534- String auth =
535- java .util .Base64 .getEncoder ().encodeToString ("user:" .getBytes (java .nio .charset .StandardCharsets .UTF_8 ));
533+ String auth = Base64 .getEncoder ().encodeToString ("user:" .getBytes (StandardCharsets .UTF_8 ));
536534 // language=json
537535 String config = """
538536 {
@@ -556,8 +554,7 @@ void testEmptyPasswordIsPreserved() throws Exception {
556554 void testPasswordWithArbitraryCharactersIsPreserved () throws Exception {
557555 String user = "user" ;
558556 String password = "p:ä ss\" w0rd\\ :with=🔒:tail" ;
559- String auth = java .util .Base64 .getEncoder ()
560- .encodeToString ((user + ":" + password ).getBytes (java .nio .charset .StandardCharsets .UTF_8 ));
557+ String auth = Base64 .getEncoder ().encodeToString ((user + ":" + password ).getBytes (StandardCharsets .UTF_8 ));
561558 // language=json
562559 String config = """
563560 {
0 commit comments