Search in sources :

Example 26 with Expectations

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;
}
Also used : Expectations(org.jmock.Expectations)

Example 27 with Expectations

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);
}
Also used : Expectations(org.jmock.Expectations) Test(org.junit.Test)

Example 28 with Expectations

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);
}
Also used : Expectations(org.jmock.Expectations) Test(org.junit.Test)

Example 29 with Expectations

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));
}
Also used : Expectations(org.jmock.Expectations) TaskInternal(org.gradle.api.internal.TaskInternal) TaskInputsInternal(org.gradle.api.internal.TaskInputsInternal) FileCollection(org.gradle.api.file.FileCollection) Test(org.junit.Test)

Example 30 with Expectations

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)));
}
Also used : Expectations(org.jmock.Expectations) ModuleDependency(org.gradle.api.artifacts.ModuleDependency) Closure(groovy.lang.Closure) ClientModule(org.gradle.api.artifacts.ClientModule) DefaultClientModule(org.gradle.api.internal.artifacts.dependencies.DefaultClientModule) Test(org.junit.Test)

Aggregations

Expectations (org.jmock.Expectations)651 Test (org.junit.Test)443 UnitTest (org.apache.geode.test.junit.categories.UnitTest)109 File (java.io.File)46 ConfigurationServiceImpl (org.nhindirect.config.service.impl.ConfigurationServiceImpl)41 InternalCache (org.apache.geode.internal.cache.InternalCache)35 SlingHttpServletRequest (org.apache.sling.api.SlingHttpServletRequest)33 SlingHttpServletResponse (org.apache.sling.api.SlingHttpServletResponse)32 Resource (org.apache.sling.api.resource.Resource)31 RewriterResponse (org.apache.sling.security.impl.ContentDispositionFilter.RewriterResponse)31 ArrayList (java.util.ArrayList)27 DiskStore (org.apache.geode.cache.DiskStore)23 ValueMap (org.apache.sling.api.resource.ValueMap)21 Before (org.junit.Before)20 CertificateGetOptions (org.nhindirect.config.service.impl.CertificateGetOptions)20 Sequence (org.jmock.Sequence)19 Cache (org.apache.geode.cache.Cache)18 Region (org.apache.geode.cache.Region)18 DistributedMember (org.apache.geode.distributed.DistributedMember)18 IntegrationTest (org.apache.geode.test.junit.categories.IntegrationTest)17