public final class ProjectTestUtils
extends java.lang.Object
| Modifier and Type | Method and Description |
|---|---|
static org.gradle.api.Project |
createChildProject(org.gradle.api.Project parent)
Creates a child project instance with the specified parent project.
|
static org.gradle.api.Project |
createChildProject(org.gradle.api.Project parent,
java.lang.String name)
Creates a child project instance with the specified parent project and name.
|
static org.gradle.api.Project |
createChildProject(org.gradle.api.Project parent,
java.lang.String name,
java.io.File projectDirectory)
Creates a child project instance with the specified parent project, name and directory.
|
static org.gradle.api.Project |
createChildProject(org.gradle.api.Project parent,
java.lang.String name,
java.nio.file.Path projectDirectory)
Creates a child project instance with the specified parent project, name and directory.
|
static org.gradle.api.artifacts.Dependency |
createDependency(java.lang.Object notation)
Creates a
Dependency instance for the specified notation. |
static org.gradle.api.Project |
createRootProject(java.io.File rootDirectory)
Creates a new root project instance for the given project directory.
|
static org.gradle.api.Project |
createRootProject(java.nio.file.Path rootDirectory)
Creates a new root project instance for the given project directory.
|
static org.gradle.api.Project |
evaluate(org.gradle.api.Project project)
Force the evaluation of the specified Gradle project.
|
static org.gradle.api.model.ObjectFactory |
objectFactory()
Returns an functional
ObjectFactory instance. |
static org.gradle.api.provider.ProviderFactory |
providerFactory()
Returns a functional
ProviderFactory instance. |
static org.gradle.api.Project |
rootProject()
Creates a new root project instance.
|
public static org.gradle.api.model.ObjectFactory objectFactory()
ObjectFactory instance.
The project associated to the returned ObjectFactory is unspecified meaning tests should not depend on it.
This particularity means that each file related operation that would spawn from this ObjectFactory will be resolved from an unspecified, but valid, file system location.
If the file resolution needs to be specified, create a Project instance using createRootProject(File).ObjectFactory instance, never nullpublic static org.gradle.api.provider.ProviderFactory providerFactory()
ProviderFactory instance.ProviderFactory instance, never nullpublic static org.gradle.api.artifacts.Dependency createDependency(java.lang.Object notation)
Dependency instance for the specified notation.notation - dependency notation, must not be nullDependency instance for the notation, never nullpublic static org.gradle.api.Project rootProject()
Project instance, never nullpublic static org.gradle.api.Project createRootProject(java.io.File rootDirectory)
rootDirectory - a project directory for the root project, must not be nullProject instance, never nullpublic static org.gradle.api.Project createRootProject(java.nio.file.Path rootDirectory)
rootDirectory - a project directory for the root project, must not be nullProject instance, never nullpublic static org.gradle.api.Project createChildProject(org.gradle.api.Project parent)
${parent.projectDir}/test respectively.parent - the parent project for the child project, must not be nullProject instance of the specified parent project, never nullpublic static org.gradle.api.Project createChildProject(org.gradle.api.Project parent,
java.lang.String name)
${parent.projectDir}/${name}.parent - the parent project for the child project, must not be nullname - the child project name, must not be nullProject instance of the specified parent project, never nullpublic static org.gradle.api.Project createChildProject(org.gradle.api.Project parent,
java.lang.String name,
java.io.File projectDirectory)
parent - the parent project for the child project, must not be nullname - the child project name, must not be nullprojectDirectory - the child project directory, must not be nullProject instance of the specified parent project, never nullpublic static org.gradle.api.Project createChildProject(org.gradle.api.Project parent,
java.lang.String name,
java.nio.file.Path projectDirectory)
parent - the parent project for the child project, must not be nullname - the child project name, must not be nullprojectDirectory - the child project directory, must not be nullProject instance of the specified parent project, never nullpublic static org.gradle.api.Project evaluate(org.gradle.api.Project project)
Project.afterEvaluate(Action) configuration action.
Note: It is generally preferable to write functional test using Gradle Runner Kit to test after evaluate behavior.
Implementation Note: It uses a call to an internal Gradle API, e.g. ProjectInternal.evaluate().project - the project to evaluate, must not be null