@Test(timeout = 5000l)
public void testHelpMessage() throws Exception {

  Configuration conf = new YarnConfiguration();
  YarnClient mockYarnClient = createMockYarnClient(YarnApplicationState.FINISHED);
  LogsCLI dumper = new LogsCLIForTest(mockYarnClient);
  dumper.setConf(conf);
  int exitCode = dumper.run(new String[]{});
  assertTrue(exitCode == -1);
  ByteArrayOutputStream baos = new ByteArrayOutputStream();
  PrintWriter pw = new PrintWriter(baos);
  pw.println("Retrieve logs for completed YARN applications.");
  pw.println("usage: yarn logs -applicationId <application ID> [OPTIONS]");
  pw.println();
  pw.println("general options are:");
  pw.println(" -appOwner <Application Owner>   AppOwner (assumed to be current user if");
  pw.println("                                 not specified)");
  pw.println(" -containerId <Container ID>     ContainerId (must be specified if node");
  pw.println("                                 address is specified)");
  pw.println(" -nodeAddress <Node Address>     NodeAddress in the format nodename:port");
  pw.println("                                 (must be specified if container id is");
  pw.println("                                 specified)");
  pw.close();
  String appReportStr = baos.toString("UTF-8");
  Assert.assertEquals(appReportStr, sysOutStream.toString());
}