Search in sources :

Example 66 with Expectations

use of org.jmock.Expectations in project jewelcli by lexicalscope.

the class TestArgumentValidatorImpl method testMissingOption.

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

        {
            oneOf(validationErrorBuilder).validate();
            oneOf(specification).getMandatoryOptions();
            will(returnValue($.asList(option)));
            oneOf(validationErrorBuilder).missingOption(option);
            oneOf(validationErrorBuilder).validate();
        }
    });
    argumentValidator.finishedProcessing();
}
Also used : Expectations(org.jmock.Expectations) Ignore(org.junit.Ignore) Test(org.junit.Test)

Example 67 with Expectations

use of org.jmock.Expectations in project jewelcli by lexicalscope.

the class TestArgumentValidatorImpl method testMultipleValue.

@Test
@Ignore
public void testMultipleValue() throws ArgumentValidationException {
    context.checking(new Expectations() {

        {
            oneOf(specification).isSpecified("name");
            will(returnValue(true));
            oneOf(specification).getSpecification("name");
            will(returnValue(option));
            oneOf(option).isHelpOption();
            will(returnValue(false));
            oneOf(option).allowedThisManyValues(2);
            will(returnValue(true));
            oneOf(option).allowedValue("a");
            will(returnValue(true));
            oneOf(option).allowedValue("b");
            will(returnValue(true));
            oneOf(validationErrorBuilder).validate();
            oneOf(specification).getMandatoryOptions();
            will(returnValue($.asList(option)));
            oneOf(validationErrorBuilder).validate();
        }
    });
    argumentValidator.processOption("name", asList("a", "b"));
    argumentValidator.finishedProcessing();
}
Also used : Expectations(org.jmock.Expectations) Ignore(org.junit.Ignore) Test(org.junit.Test)

Example 68 with Expectations

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

the class DefaultDomainObjectCollectionTest method callsClosureWithNewObjectAsParameterWhenObjectAdded.

@Test
public void callsClosureWithNewObjectAsParameterWhenObjectAdded() {
    final TestClosure closure = context.mock(TestClosure.class);
    context.checking(new Expectations() {

        {
            oneOf(closure).call("a");
        }
    });
    container.whenObjectAdded(TestUtil.toClosure(closure));
    container.add("a");
}
Also used : TestClosure(org.gradle.util.TestClosure) Expectations(org.jmock.Expectations) Test(org.junit.Test)

Example 69 with Expectations

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

the class DefaultDomainObjectCollectionTest method callsClosureWithRemovedObjectAsParameterWhenObjectRemoved.

@Test
public void callsClosureWithRemovedObjectAsParameterWhenObjectRemoved() {
    final TestClosure closure = context.mock(TestClosure.class);
    container.add("a");
    context.checking(new Expectations() {

        {
            oneOf(closure).call("a");
        }
    });
    container.whenObjectRemoved(TestUtil.toClosure(closure));
    container.remove("a");
}
Also used : TestClosure(org.gradle.util.TestClosure) Expectations(org.jmock.Expectations) Test(org.junit.Test)

Example 70 with Expectations

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

the class DefaultDomainObjectCollectionTest method filteredCollectionExecutesActionWhenMatchingObjectAdded.

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

        {
            oneOf(action).execute("a");
        }
    });
    Spec<CharSequence> spec = new Spec<CharSequence>() {

        public boolean isSatisfiedBy(CharSequence element) {
            return !element.equals("b");
        }
    };
    container.matching(spec).whenObjectAdded(action);
    container.add("a");
    container.add("b");
}
Also used : Expectations(org.jmock.Expectations) Spec(org.gradle.api.specs.Spec) 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