public int run() throws IOException {
    ObjectMapper objectMapper = new ObjectMapper();
    MetricsOutput metricsInfo = new MetricsOutput(mMetricsMasterClient.getMetrics());
    try {
      String json = objectMapper.writeValueAsString(metricsInfo);
      mPrintStream.println(json);
    } catch (JsonProcessingException e) {
      mPrintStream.println("Failed to convert metricsInfo output to JSON. "
          + "Check the command line log for the detailed error message.");
      LOG.error("Failed to output JSON object {}", metricsInfo);
      e.printStackTrace();
      return -1;
    }
    return 0;
  }
@Test
  public void metrics() throws IOException {
    MetricsCommand metricsCommand = new MetricsCommand(mMetricsMasterClient, mPrintStream);
    metricsCommand.run();
    checkOutput();
  }