@Test public void testParserNoClusterNoTasks() throws Exception { String jar = "mr4c.jar"; String uri = "input.conf"; String[] args = new String[] {jar, uri}; MR4CArgumentParser parser = new MR4CArgumentParser(args, USAGE); parser.parse(); assertEquals(jar, parser.getJar()); assertEquals(URI.create(uri), parser.getExeConf()); assertNull(parser.getCluster()); assertNull(parser.getTasks()); }
@Test public void testParserAllArgs() throws Exception { String jar = "mr4c.jar"; String uri = "input.conf"; String cluster = "dev"; Integer tasks = 5; String[] args = new String[] {jar, uri, cluster, Integer.toString(tasks)}; MR4CArgumentParser parser = new MR4CArgumentParser(args, USAGE); parser.parse(); assertEquals(jar, parser.getJar()); assertEquals(URI.create(uri), parser.getExeConf()); assertEquals(tasks, parser.getTasks()); assertEquals(cluster, parser.getCluster()); }
@Test(expected = IllegalArgumentException.class) public void testParserTooManyArgs() throws Exception { String[] args = new String[] {"arg1", "arg2", "arg3", "arg4", "arg5"}; MR4CArgumentParser parser = new MR4CArgumentParser(args, USAGE); parser.parse(); }