File tree Expand file tree Collapse file tree
api/all/src/test/java/io/opentelemetry/api/logs Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -211,5 +211,17 @@ void valueByteAsString() {
211211 String base64Encoded = Value .of (str .getBytes (StandardCharsets .UTF_8 )).asString ();
212212 byte [] decodedBytes = Base64 .getDecoder ().decode (base64Encoded );
213213 assertThat (new String (decodedBytes , StandardCharsets .UTF_8 )).isEqualTo (str );
214+
215+ // Test empty string
216+ String emptyStr = "" ;
217+ String emptyBase64 = Value .of (emptyStr .getBytes (StandardCharsets .UTF_8 )).asString ();
218+ byte [] decodedEmpty = Base64 .getDecoder ().decode (emptyBase64 );
219+ assertThat (new String (decodedEmpty , StandardCharsets .UTF_8 )).isEqualTo (emptyStr );
220+
221+ // Test string with special characters
222+ String specialStr = "hello \n \t 🌍 world!" ;
223+ String specialBase64 = Value .of (specialStr .getBytes (StandardCharsets .UTF_8 )).asString ();
224+ byte [] decodedSpecial = Base64 .getDecoder ().decode (specialBase64 );
225+ assertThat (new String (decodedSpecial , StandardCharsets .UTF_8 )).isEqualTo (specialStr );
214226 }
215227}
You can’t perform that action at this time.
0 commit comments