32
32
import com .google .gson .JsonParser ;
33
33
import java .io .ByteArrayOutputStream ;
34
34
import java .io .PrintStream ;
35
+ import java .io .UnsupportedEncodingException ;
35
36
import java .util .logging .ErrorManager ;
36
37
import java .util .logging .Filter ;
37
38
import java .util .logging .Formatter ;
@@ -398,14 +399,15 @@ public void testEnhancedLogEntry() {
398
399
handler .publish (newLogRecord (Level .FINEST , MESSAGE ));
399
400
}
400
401
401
- void validateJsonOutput (ByteArrayOutputStream bout ) {
402
+ void validateJsonOutput (ByteArrayOutputStream bout ) throws UnsupportedEncodingException {
402
403
final String expectedOutput =
403
404
"{\" severity\" :\" INFO\" ,\" time\" :\" 1970-01-02T10:17:36.789Z\" ,\" logging.googleapis.com/labels\" :{\" enhanced\" :\" true\" },\" logging.googleapis.com/trace_sampled\" :false,\" message\" :\" message\" }" ;
404
- assertEquals (JsonParser .parseString (expectedOutput ), JsonParser .parseString (bout .toString ()));
405
+ assertEquals (
406
+ JsonParser .parseString (expectedOutput ), JsonParser .parseString (bout .toString ("UTF-8" )));
405
407
}
406
408
407
409
@ Test
408
- public void testEnhancedLogEntryPrintToStdout () {
410
+ public void testEnhancedLogEntryPrintToStdout () throws UnsupportedEncodingException {
409
411
outputStreamPatcher .patch ();
410
412
411
413
replay (options , logging );
@@ -422,7 +424,7 @@ public void testEnhancedLogEntryPrintToStdout() {
422
424
}
423
425
424
426
@ Test
425
- public void testEnhancedLogEntryPrintToStderr () {
427
+ public void testEnhancedLogEntryPrintToStderr () throws UnsupportedEncodingException {
426
428
outputStreamPatcher .patch ();
427
429
428
430
replay (options , logging );
0 commit comments