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

  String localDir = "target/SaveLogs";
  Path localPath = new Path(localDir);
  FileSystem fs = FileSystem.get(conf);
  ApplicationId appId1 = ApplicationId.newInstance(0, 1);
  LogsCLI cli = createCli();
  // Specify a file name to the option -out
  try {
    fs.mkdirs(localPath);
    Path tmpFilePath = new Path(localPath, "tmpFile");
    if (!fs.exists(tmpFilePath)) {
      fs.createNewFile(tmpFilePath);
    }
    int exitCode = cli.run(new String[] {"-applicationId",
        appId1.toString(),
        "-out" , tmpFilePath.toString()});
    assertTrue(exitCode == -1);
    assertTrue(sysErrStream.toString().contains(
        "Invalid value for -out option. Please provide a directory."));
  } finally {
    fs.delete(localPath, true);
  }
}