PredefinedTask { public GradleCommandTemplate toCommandTemplate(String displayName) { List<String> rawTaskNames = new ArrayList<>(taskNames.size()); for (Name name: taskNames) { rawTaskNames.add(name.getName()); } GradleCommandTemplate.Builder builder = new GradleCommandTemplate.Builder(displayName, rawTaskNames); builder.setArguments(arguments); builder.setJvmArguments(jvmArguments); builder.setBlocking(!nonBlocking); return builder.create(); } PredefinedTask(
            String displayName,
            List<Name> taskNames,
            List<String> arguments,
            List<String> jvmArguments,
            boolean nonBlocking); boolean isNonBlocking(); String getDisplayName(); List<Name> getTaskNames(); List<String> getArguments(); List<String> getJvmArguments(); static PredefinedTask createSimple(String displayName, String taskName); GradleCommandTemplate toCommandTemplate(String displayName); GradleCommandTemplate toCommandTemplate(); boolean isTasksExistsIfRequired(NbGradleProject project, Lookup actionContext); boolean isTasksExistsIfRequired(NbGradleProject project, StringResolver taskNameResolver); boolean isTasksExistsIfRequired(NbGradleMultiProjectDef project, StringResolver taskNameResolver); @Override String toString(); @Override int hashCode(); @Override boolean equals(Object obj);  }
@Test public void testToCommandTemplate() { String displayName = "DISPLAY-NAME"; List<PredefinedTask.Name> taskNames = createTaskNames(true, "task1", "", "task2"); List<String> arguments = Arrays.asList("arg1", "", "arg2"); List<String> jvmArguments = Arrays.asList("jvmarg1", "", "jvmarg2"); boolean nonBlocking = false; PredefinedTask task = new PredefinedTask(displayName, taskNames, arguments, jvmArguments, nonBlocking); GradleCommandTemplate commandTemplate = task.toCommandTemplate(); assertEquals(Arrays.asList("task1", "", "task2"), commandTemplate.getTasks()); assertEquals(arguments, commandTemplate.getArguments()); assertEquals(jvmArguments, commandTemplate.getJvmArguments()); assertTrue(commandTemplate.isBlocking()); }