@Override
  public int run(String[] args) throws Exception {
    try {
      webServiceClient = WebServiceClient.getWebServiceClient().createClient();
      return runCommand(args);
    } finally {
      if (yarnClient != null) {
        yarnClient.close();
      }
      if (webServiceClient != null) {
        webServiceClient.destroy();
      }
    }
  }
@Test(timeout = 5000L)
  public void testUnknownApplicationAttemptId() throws Exception {
    YarnClient mockYarnClient = createMockYarnClientUnknownApp();
    LogsCLI cli = new LogsCLIForTest(mockYarnClient);
    cli.setConf(conf);
    ApplicationId appId = ApplicationId.newInstance(0, 1);

    int exitCode = cli.run(new String[] {"-applicationAttemptId",
            ApplicationAttemptId.newInstance(appId, 1).toString() });

    // Error since no logs present for the app.
    assertTrue(exitCode != 0);
    assertTrue(sysErrStream.toString().contains(
            "Unable to get ApplicationState."));
  }