@Test @SuppressWarnings("deprecation") public void shouldExitAndPrintUsageSinceParameterNumberLessThanThree() throws Exception { final String[] args = new String[] { "one", "two" }; String line = "ERROR: Wrong number of parameters: " + args.length; String result = new OutputReader(System.err) { @Override void doRead() throws Exception { assertEquals(-1, new RowCounter().run(args)); } }.read(); assertTrue(result.startsWith(line)); }
public int run(final String[] args) throws Exception { if (args.length < 3) { System.err.println("ERROR: Wrong number of parameters: " + args.length); return printUsage(); } JobClient.runJob(createSubmittableJob(args)); return 0; }
RowCounter extends Configured implements Tool { public int run(final String[] args) throws Exception { if (args.length < 3) { System.err.println("ERROR: Wrong number of parameters: " + args.length); return printUsage(); } JobClient.runJob(createSubmittableJob(args)); return 0; } }
RowCounter extends Configured implements Tool { public int run(final String[] args) throws Exception { if (args.length < 3) { System.err.println("ERROR: Wrong number of parameters: " + args.length); return printUsage(); } JobClient.runJob(createSubmittableJob(args)); return 0; }  }
RowCounter extends Configured implements Tool { public int run(final String[] args) throws Exception { if (args.length < 3) { System.err.println("ERROR: Wrong number of parameters: " + args.length); return printUsage(); } JobClient.runJob(createSubmittableJob(args)); return 0; }  JobConf createSubmittableJob(String[] args); int run(final String[] args); static void main(String[] args); }
RowCounter extends Configured implements Tool { public int run(final String[] args) throws Exception { if (args.length < 3) { System.err.println("ERROR: Wrong number of parameters: " + args.length); return printUsage(); } JobClient.runJob(createSubmittableJob(args)); return 0; }  JobConf createSubmittableJob(String[] args); int run(final String[] args); static void main(String[] args);  }