### Question:
ExecuteMain { void parseArgs(String... args) throws IllegalArgumentException { List<String> rest = null; rest = Args.parse(this, args); if (rest == null || rest.size() != 1) { throw new IllegalArgumentException("missing input"); } context = parseContext(); String input = rest.get(0); url = parseInputAsURL(input); }  ExecutionFilter parseBookmark(); ExecutionFilter parseRange(); Context parseContext(); void execute(String... args); static void main(String... args);  }### Answer:
@Test public void testRange2to3(){ main.parseArgs("helloworld.pptx","-range","2-3"); assertThat(main.context.getExecutionFilter().accept(event1), equalTo(false)); assertThat(main.context.getExecutionFilter().accept(event2), equalTo(true)); assertThat(main.context.getExecutionFilter().accept(event3), equalTo(true)); assertThat(main.context.getExecutionFilter().accept(event4), equalTo(false)); }
@Test public void testInputIsAnURL(){ main.parseArgs("http: assertThat(main.url.toString(), containsString("some.url")); assertThat(main.url.getProtocol(), containsString("http")); }
@Test(expected = IllegalArgumentException.class) public void testNoInput(){ main.parseArgs("-screen","1"); }
@Test public void testRange2(){ main.parseArgs("helloworld.pptx","-range","2"); assertThat(main.context.getExecutionFilter().accept(event1), equalTo(false)); assertThat(main.context.getExecutionFilter().accept(event2), equalTo(true)); assertThat(main.context.getExecutionFilter().accept(event3), equalTo(false)); assertThat(main.context.getExecutionFilter().accept(event4), equalTo(false)); }
@Test public void testRange2andLater(){ main.parseArgs("helloworld.pptx","-range","2-"); assertThat(main.context.getExecutionFilter().accept(event1), equalTo(false)); assertThat(main.context.getExecutionFilter().accept(event2), equalTo(true)); assertThat(main.context.getExecutionFilter().accept(event3), equalTo(true)); assertThat(main.context.getExecutionFilter().accept(event4), equalTo(true)); }
@Test public void testRangeDefaultToAll(){ main.parseArgs("helloworld.pptx"); assertThat(main.context.getExecutionFilter().accept(event1), equalTo(true)); assertThat(main.context.getExecutionFilter().accept(event2), equalTo(true)); assertThat(main.context.getExecutionFilter().accept(event3), equalTo(true)); assertThat(main.context.getExecutionFilter().accept(event4), equalTo(true)); }
@Test public void testScreenId(){ main.parseArgs("helloworld.pptx","-screen","0"); assertThat(((DesktopScreen) main.context.getScreenRegion().getScreen()).getScreenId(), equalTo(0)); }
@Test public void testWaitTime(){ main.parseArgs("helloworld.pptx","-wait","5000"); assertThat(main.context.getWaitTime(), equalTo(5000L)); }
@Test public void testMinScore(){ main.parseArgs("helloworld.pptx","-min_score","0.9"); assertThat((double) main.context.getMinScore(), closeTo(0.9,0.05)); }
@Test(expected = IllegalArgumentException.class) public void testMinScoreTooBig(){ main.parseArgs("helloworld.pptx","-min_score","100"); }
@Test(expected = IllegalArgumentException.class) public void testBadOptionName(){ main.parseArgs("helloworld.pptx","-not_a_good_optionname","100"); }
@Test public void testInputIsAFilePath(){ main.parseArgs("helloworld.pptx"); assertThat(main.url.toString(), containsString("helloworld.pptx")); assertThat(main.url.getProtocol(), containsString("file")); }