@Test public void testPrintUsage() throws Exception { ByteArrayOutputStream out = new ByteArrayOutputStream(); ByteArrayOutputStream err = new ByteArrayOutputStream(); TransactionAdmin txAdmin = new TransactionAdmin(new PrintStream(out), new PrintStream(err)); int status = txAdmin.doMain(new String[0], conf); Assert.assertEquals(1, status); Assert.assertTrue(err.toString("UTF-8").startsWith("Usage:")); Assert.assertEquals(0, out.toByteArray().length); }
private void printUsage() { String programName = TransactionAdmin.class.getSimpleName(); String spaces = " "; List<String> options = Lists.newArrayList(); options.add(join("Usage: ")); options.add(join(spaces, programName, OPT_TRUNCATE_INVALID_TX, "<tx1,tx2,...>")); options.add(join(spaces, programName, OPT_TRUNCATE_INVALID_TX_BEFORE, "<time in secs>")); options.add(join(spaces, programName, OPT_GET_INVALID_TX_SIZE)); String usage = Joiner.on(System.getProperty("line.separator")).join(options); err.println(usage); }
TransactionAdmin { private void printUsage() { String programName = TransactionAdmin.class.getSimpleName(); String spaces = " "; List<String> options = Lists.newArrayList(); options.add(join("Usage: ")); options.add(join(spaces, programName, OPT_TRUNCATE_INVALID_TX, "<tx1,tx2,...>")); options.add(join(spaces, programName, OPT_TRUNCATE_INVALID_TX_BEFORE, "<time in secs>")); options.add(join(spaces, programName, OPT_GET_INVALID_TX_SIZE)); String usage = Joiner.on(System.getProperty("line.separator")).join(options); err.println(usage); } }
TransactionAdmin { private void printUsage() { String programName = TransactionAdmin.class.getSimpleName(); String spaces = " "; List<String> options = Lists.newArrayList(); options.add(join("Usage: ")); options.add(join(spaces, programName, OPT_TRUNCATE_INVALID_TX, "<tx1,tx2,...>")); options.add(join(spaces, programName, OPT_TRUNCATE_INVALID_TX_BEFORE, "<time in secs>")); options.add(join(spaces, programName, OPT_GET_INVALID_TX_SIZE)); String usage = Joiner.on(System.getProperty("line.separator")).join(options); err.println(usage); } TransactionAdmin(PrintStream out, PrintStream err); }
TransactionAdmin { private void printUsage() { String programName = TransactionAdmin.class.getSimpleName(); String spaces = " "; List<String> options = Lists.newArrayList(); options.add(join("Usage: ")); options.add(join(spaces, programName, OPT_TRUNCATE_INVALID_TX, "<tx1,tx2,...>")); options.add(join(spaces, programName, OPT_TRUNCATE_INVALID_TX_BEFORE, "<time in secs>")); options.add(join(spaces, programName, OPT_GET_INVALID_TX_SIZE)); String usage = Joiner.on(System.getProperty("line.separator")).join(options); err.println(usage); } TransactionAdmin(PrintStream out, PrintStream err); static void main(String[] args); }
TransactionAdmin { private void printUsage() { String programName = TransactionAdmin.class.getSimpleName(); String spaces = " "; List<String> options = Lists.newArrayList(); options.add(join("Usage: ")); options.add(join(spaces, programName, OPT_TRUNCATE_INVALID_TX, "<tx1,tx2,...>")); options.add(join(spaces, programName, OPT_TRUNCATE_INVALID_TX_BEFORE, "<time in secs>")); options.add(join(spaces, programName, OPT_GET_INVALID_TX_SIZE)); String usage = Joiner.on(System.getProperty("line.separator")).join(options); err.println(usage); } TransactionAdmin(PrintStream out, PrintStream err); static void main(String[] args);  }