public void printStreamedRow(final StreamedRow row) {
    row.getErrorMessage().ifPresent(this::printErrorMessage);

    row.getFinalMessage().ifPresent(finalMsg -> writer().println(finalMsg));

    row.getHeader().ifPresent(this::printRowHeader);

    if (row.getRow().isPresent()) {
      switch (outputFormat) {
        case JSON:
          printAsJson(row.getRow().get());
          break;
        case TABULAR:
          printAsTable(row.getRow().get());
          break;
        default:
          throw new RuntimeException(String.format(
              "Unexpected output format: '%s'",
              outputFormat.name()
          ));
      }
    }
  }
@Test
  public void testPrintFinalMessageStreamedRow() {
    console.printStreamedRow(StreamedRow.finalMessage("Some message"));
    assertThat(terminal.getOutputString(), is("Some message" + NEWLINE));
  }