use of org.jmock.Expectations in project gradle by gradle.
the class NormalizingCopyActionDecoratorTest method file.
private FileCopyDetailsInternal file(final String path, final boolean isDir, final boolean includeEmptyDirs) {
final FileCopyDetailsInternal details = context.mock(FileCopyDetailsInternal.class, path);
context.checking(new Expectations() {
{
allowing(details).getRelativePath();
will(returnValue(RelativePath.parse(false, path)));
allowing(details).isDirectory();
will(returnValue(isDir));
allowing(details).isIncludeEmptyDirs();
will(returnValue(includeEmptyDirs));
}
});
return details;
}
use of org.jmock.Expectations in project gradle by gradle.
the class NormalizingCopyActionDecoratorTest method visitsFileAncestorsWhichHaveNotBeenVisited.
@Test
public void visitsFileAncestorsWhichHaveNotBeenVisited() {
final FileCopyDetailsInternal details = file("a/b/c", false, true);
context.checking(new Expectations() {
{
one(delegateAction).processFile(with(hasPath("a")));
one(delegateAction).processFile(with(hasPath("a/b")));
one(delegateAction).processFile(details);
}
});
visit(decorator, details);
}
use of org.jmock.Expectations in project gradle by gradle.
the class NormalizingCopyActionDecoratorTest method doesNotVisitAnEmptyDirectoryIfCorrespondingOptionIsOff.
@Test
public void doesNotVisitAnEmptyDirectoryIfCorrespondingOptionIsOff() {
final FileCopyDetailsInternal dir = file("dir", true, false);
context.checking(new Expectations() {
{
exactly(0).of(delegateAction).processFile(dir);
}
});
visit(decorator, dir);
}
use of org.jmock.Expectations in project gradle by gradle.
the class DependencyAutoWireTaskFactoryTest method addsDependencyOnInputFiles.
@Test
public void addsDependencyOnInputFiles() {
final TaskInternal task = context.mock(TaskInternal.class);
final TaskInputsInternal taskInputs = context.mock(TaskInputsInternal.class);
final FileCollection inputFiles = context.mock(FileCollection.class);
context.checking(new Expectations() {
{
one(delegate).createTask(map());
will(returnValue(task));
allowing(task).getInputs();
will(returnValue(taskInputs));
allowing(taskInputs).getFiles();
will(returnValue(inputFiles));
one(task).dependsOn(inputFiles);
}
});
assertThat(factory.createTask(map()), sameInstance(task));
}
use of org.jmock.Expectations in project gradle by gradle.
the class ModuleFactoryDelegateTest method module.
@Test
public void module() {
final String clientModuleNotation = "someNotation";
final Closure configureClosure = TestUtil.toClosure("{}");
final ClientModule clientModuleDummy = context.mock(ClientModule.class);
context.checking(new Expectations() {
{
allowing(dependencyFactoryStub).createModule(clientModuleNotation, configureClosure);
will(returnValue(clientModuleDummy));
}
});
moduleFactoryDelegate.module(clientModuleNotation, configureClosure);
assertThat(this.clientModule.getDependencies(), Matchers.equalTo(WrapUtil.<ModuleDependency>toSet(clientModuleDummy)));
}
Aggregations