@Test
public void testCommandShellExample() throws Exception {

  Example ex = new Example();
  ex.setConf(new Configuration());
  int rc = 0;
  outContent.reset();
  String[] args1 = {"hello"};
  rc = ex.run(args1);
  assertEquals(outMsg("test exit code - normal hello"), 0, rc);
  assertTrue(outMsg("test normal hello message"),
             outContent.toString().contains(Example.HELLO_MSG));
  outContent.reset();
  String[] args2 = {"hello", "x"};
  rc = ex.run(args2);
  assertEquals(outMsg("test exit code - bad hello"), 1, rc);
  assertTrue(outMsg("test bad hello message"),
             outContent.toString().contains(Example.Hello.HELLO_USAGE));
  outContent.reset();
  String[] args3 = {"goodbye"};
  rc = ex.run(args3);
  assertEquals(outMsg("test exit code - normal goodbye"), 0, rc);
  assertTrue(outMsg("test normal goodbye message"),
             outContent.toString().contains(Example.GOODBYE_MSG));
}