use of org.gradle.api.internal.project.DefaultProjectTaskLister in project gradle by gradle.
the class TestUtility method createMockProject.
/**
* Creates a mock project with the specified properties.
*
* Note: depth is 0 for a root project. 1 for a root project's subproject, etc.
*/
public static Project createMockProject(JUnit4Mockery context, final String name, final String buildFilePath, final int depth, Project[] subProjectArray, Task[] tasks, String[] defaultTasks) {
final ProjectInternal project = context.mock(ProjectInternal.class, "[project]_" + name + '_' + uniqueNameCounter++);
final ServiceRegistry services = ServiceRegistryBuilder.builder().provider(new Object() {
ProjectTaskLister createTaskLister() {
return new DefaultProjectTaskLister();
}
}).build();
context.checking(new Expectations() {
{
allowing(project).getName();
will(returnValue(name));
allowing(project).getDescription();
will(returnValue(null));
allowing(project).getBuildFile();
will(returnValue(new File(buildFilePath)));
allowing(project).getDepth();
will(returnValue(depth));
allowing(project).getServices();
will(returnValue(services));
}
});
attachSubProjects(context, project, subProjectArray);
attachTasks(context, project, tasks);
assignDefaultTasks(context, project, defaultTasks);
return project;
}
Aggregations