Search in sources :

Example 6 with Expectations

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

the class TestArgumentCollectionBuilder method testParseArgumentsUnparsed.

@Test
public void testParseArgumentsUnparsed() throws ArgumentValidationException {
    argumentCollectionBuilder.unparsedOptionsFollow();
    argumentCollectionBuilder.addValue("3");
    argumentCollectionBuilder.addValue("4");
    context.checking(new Expectations() {

        {
            oneOf(argumentProcessor).processUnparsed(asList("3", "4"));
            oneOf(argumentProcessor).finishedProcessing();
        }
    });
    argumentCollectionBuilder.processArguments(argumentProcessor);
}
Also used : Expectations(org.jmock.Expectations) Test(org.junit.Test)

Example 7 with Expectations

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

the class TestArgumentParserImpl method testParseArgumentsOnlyUnparsed.

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

        {
            oneOf(parsedArguments).unparsedOptionsFollow();
            oneOf(parsedArguments).addValue("3");
            oneOf(parsedArguments).addValue("4");
        }
    });
    parseArguments(new String[] { "--", "3", "4" });
}
Also used : Expectations(org.jmock.Expectations) Test(org.junit.Test)

Example 8 with Expectations

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

the class TestArgumentParserImpl method testParseAssignedValue.

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

        {
            oneOf(parsedArguments).addOption("option");
            oneOf(parsedArguments).addValue("value");
        }
    });
    parseArguments(new String[] { "--option=value" });
}
Also used : Expectations(org.jmock.Expectations) Test(org.junit.Test)

Example 9 with Expectations

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

the class TestArgumentParserImpl method testParseArgumentsNotUparsed.

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

        {
            oneOf(parsedArguments).addOption("a");
            oneOf(parsedArguments).addValue("1");
            oneOf(parsedArguments).addValue("2");
            oneOf(parsedArguments).addOption("b");
            oneOf(parsedArguments).addOption("c");
            oneOf(parsedArguments).addValue("1");
            oneOf(parsedArguments).addValue("2");
        }
    });
    parseArguments(new String[] { "-a", "1", "2", "-b", "-c", "1", "2" });
}
Also used : Expectations(org.jmock.Expectations) Test(org.junit.Test)

Example 10 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)

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