@Test
public void testCliCommandsNotEchoingUsage() throws Exception {

    // setup redirect out/err streams to get System.in/err, use this judiciously!
    final PrintStream systemErr = System.err; // get current err
    final ByteArrayOutputStream errContent = new ByteArrayOutputStream();
    System.setErr(new PrintStream(errContent));
    final ZooKeeper zk = createClient();
    ZooKeeperMain zkMain = new ZooKeeperMain(zk);
    String cmd1 = "printwatches";
    zkMain.executeLine(cmd1);
    String cmd2 = "history";
    zkMain.executeLine(cmd2);
    String cmd3 = "redo";
    zkMain.executeLine(cmd3);
    // revert redirect of out/err streams - important step!
    System.setErr(systemErr);
    if (errContent.toString().contains("ZooKeeper -server host:port cmd args")) {
        fail("CLI commands (history, redo, connect, printwatches) display usage info!");
    }
}