@Test public void treatsEachProvidedNameAsASeparateGroup() { final Task task1 = task("name1"); final Task task2 = task("name2"); context.checking( new Expectations() { { one(project).getTasksByName("name1", true); will(returnValue(toSet(task1))); one(project).getTasksByName("name2", true); will(returnValue(toSet(task2))); Sequence sequence = context.sequence("tasks"); one(taskExecuter).addTasks(toSet(task1)); inSequence(sequence); one(taskExecuter).addTasks(toSet(task2)); inSequence(sequence); one(taskExecuter).execute(); inSequence(sequence); } }); TaskNameResolvingBuildExecuter executer = new TaskNameResolvingBuildExecuter(toList("name1", "name2")); executer.select(gradle); assertThat(executer.getDisplayName(), equalTo("primary tasks 'name1', 'name2'")); executer.execute(); }
@Test public void executesAllSelectedTasks() { final Task task1 = task("name"); final Task task2 = task("name"); context.checking( new Expectations() { { one(project).getTasksByName("name", true); will(returnValue(toSet(task1, task2))); one(taskExecuter).addTasks(toSet(task1, task2)); one(taskExecuter).execute(); } }); TaskNameResolvingBuildExecuter executer = new TaskNameResolvingBuildExecuter(toList("name")); executer.select(gradle); executer.execute(); }