Example #1
1
 public <T extends AbstractTask> T createTask(Class<T> type, Project project, String name) {
   Task task =
       TASK_FACTORY.createTask(
           (ProjectInternal) project, GUtil.map(Task.TASK_TYPE, type, Task.TASK_NAME, name));
   assertTrue(type.isAssignableFrom(task.getClass()));
   return type.cast(task);
 }
  private <T extends AstTerm<?>> T loadFirstTermAs(Class<T> termKind) {
    AstScript script = load();
    assertThat(script.models.size(), greaterThanOrEqualTo(1));
    AstModelDefinition<?> firstModel = script.models.get(0);

    List<? extends AstTerm<?>> terms = extract(firstModel.expression);
    assertThat(terms.size(), greaterThanOrEqualTo(1));
    AstTerm<?> term = terms.get(0);

    return termKind.cast(term);
  }