Search in sources :

Example 76 with Expectations

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

the class DefaultDomainObjectCollectionTest method callsRemoveActionWhenObjectRemoved.

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

        {
            oneOf(action).execute(with(sameInstance(original)));
        }
    });
    container.whenObjectRemoved(action);
    container.add(original);
    assertTrue(container.remove(original));
}
Also used : Expectations(org.jmock.Expectations) Test(org.junit.Test)

Example 77 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 78 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 79 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 80 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)

Aggregations

Expectations (org.jmock.Expectations)651 Test (org.junit.Test)443 UnitTest (org.apache.geode.test.junit.categories.UnitTest)109 File (java.io.File)41 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