@Test
public void testFormatBadLogData() {

  Throwable cause = new Throwable("Original Cause");
  LogData data =
      FakeLogData.withPrintfStyle("Hello World").addMetadata(LogContext.Key.LOG_CAUSE, cause);
  SimpleLogHandler handler = getSimpleLogHandler();
  RuntimeException error = new RuntimeException("Runtime Error");
  LogDataFormatter.formatBadLogData(error, data, handler);
  String message = handler.toString();
  assertThat(message).contains("message: Hello World");
  assertThat(message).contains("level: INFO");
  assertThat(message).contains("Original Cause");
}