@Test
public void testOfflineEditsViewerHelpMessage() throws Throwable {

  final ByteArrayOutputStream bytes = new ByteArrayOutputStream();
  final PrintStream out = new PrintStream(bytes);
  final PrintStream oldOut = System.out;
  try {
    System.setOut(out);
    int status = new OfflineEditsViewer().run(new String[] { "-h" });
    assertTrue("" + "Exit code returned for help option is incorrect",
        status == 0);
    Assert.assertFalse(
        "Invalid Command error displayed when help option is passed.", bytes
            .toString().contains("Error parsing command-line options"));
  } finally {
    System.setOut(oldOut);
    IOUtils.closeStream(out);
  }
}