use of org.gradle.api.internal.attributes.ImmutableAttributesFactory in project gradle by gradle.
the class DefaultResolvedDependencyTest method createResolvedArtifact.
public static DefaultResolvedArtifact createResolvedArtifact(final Mockery context, final String name, final String type, final String extension, final File file) {
final IvyArtifactName artifactStub = context.mock(IvyArtifactName.class, "artifact" + name);
final ImmutableAttributesFactory factory = context.mock(ImmutableAttributesFactory.class);
final BuildOperationExecutor buildOperationExecutor = context.mock(BuildOperationExecutor.class);
context.checking(new Expectations() {
{
allowing(factory).builder(ImmutableAttributes.EMPTY);
allowing(artifactStub).getName();
will(returnValue(name));
allowing(artifactStub).getType();
will(returnValue(type));
allowing(artifactStub).getExtension();
will(returnValue(extension));
allowing(artifactStub).getClassifier();
will(returnValue(null));
}
});
final Factory artifactSource = context.mock(Factory.class);
context.checking(new Expectations() {
{
allowing(artifactSource).create();
will(returnValue(file));
}
});
final ResolvedDependency resolvedDependency = context.mock(ResolvedDependency.class);
final ResolvedModuleVersion version = context.mock(ResolvedModuleVersion.class);
context.checking(new Expectations() {
{
allowing(resolvedDependency).getModule();
will(returnValue(version));
allowing(version).getId();
will(returnValue(new DefaultModuleVersionIdentifier("group", name, "1.2")));
}
});
return new DefaultResolvedArtifact(resolvedDependency.getModule().getId(), artifactStub, context.mock(ComponentArtifactIdentifier.class), context.mock(TaskDependency.class), artifactSource);
}
Aggregations