Search in sources :

Example 21 with Expectations

use of org.jmock.Expectations in project gradle by gradle.

the class DefaultDomainObjectCollectionTest method allCallsActionForEachNewObject.

@Test
public void allCallsActionForEachNewObject() {
    @SuppressWarnings("unchecked") final Action<CharSequence> action = context.mock(Action.class);
    context.checking(new Expectations() {

        {
            oneOf(action).execute("a");
        }
    });
    container.all(action);
    container.add("a");
}
Also used : Expectations(org.jmock.Expectations) Test(org.junit.Test)

Example 22 with Expectations

use of org.jmock.Expectations in project gradle by gradle.

the class DefaultDomainObjectCollectionTest method callsVetoActionOnceBeforeCollectionIsAdded.

@Test
public void callsVetoActionOnceBeforeCollectionIsAdded() {
    final Action<Void> action = Cast.uncheckedCast(context.mock(Action.class));
    container.beforeChange(action);
    context.checking(new Expectations() {

        {
            oneOf(action).execute(null);
        }
    });
    container.addAll(toList("a", "b"));
}
Also used : Expectations(org.jmock.Expectations) Action(org.gradle.api.Action) Test(org.junit.Test)

Example 23 with Expectations

use of org.jmock.Expectations in project gradle by gradle.

the class BasePomFilterContainerTest method setUp.

@Before
public void setUp() {
    pomFilterMock = context.mock(PomFilter.class);
    pomMock = context.mock(MavenPom.class);
    publishFilterMock = context.mock(PublishFilter.class);
    context.checking(new Expectations() {

        {
            allowing(mavenPomFactoryMock).create();
            will(returnValue(pomMock));
        }
    });
    pomFilterContainer = createPomFilterContainer();
    pomFilterContainer.setDefaultPomFilter(pomFilterMock);
}
Also used : Expectations(org.jmock.Expectations) MavenPom(org.gradle.api.artifacts.maven.MavenPom) PublishFilter(org.gradle.api.artifacts.maven.PublishFilter) Before(org.junit.Before)

Example 24 with Expectations

use of org.jmock.Expectations in project gradle by gradle.

the class BasePomFilterContainerTest method setPom.

@Test
public void setPom() {
    context.checking(new Expectations() {

        {
            allowing(pomFilterMock).setPomTemplate(pomMock);
        }
    });
    pomFilterContainer.setPom(pomMock);
}
Also used : Expectations(org.jmock.Expectations) Test(org.junit.Test)

Example 25 with Expectations

use of org.jmock.Expectations in project gradle by gradle.

the class FileCopyActionTest method file.

private FileCopyDetailsInternal file(final RelativePath relativePath, final File targetFile) {
    final FileCopyDetailsInternal details = context.mock(FileCopyDetailsInternal.class, relativePath.getPathString());
    context.checking(new Expectations() {

        {
            allowing(details).getRelativePath();
            will(returnValue(relativePath));
            one(details).copyTo(targetFile);
        }
    });
    return details;
}
Also used : Expectations(org.jmock.Expectations)

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