use of org.jmock.Expectations in project jewelcli by lexicalscope.
the class TestArgumentCollectionBuilder method testParseArgumentsNotUparsed.
@Test
public void testParseArgumentsNotUparsed() throws ArgumentValidationException {
argumentCollectionBuilder.addOption("a");
argumentCollectionBuilder.addOption("b");
argumentCollectionBuilder.addOption("c");
context.checking(new Expectations() {
{
oneOf(argumentProcessor).processOption("a", emptyStringList());
oneOf(argumentProcessor).processOption("b", emptyStringList());
oneOf(argumentProcessor).processLastOption("c", emptyStringList());
oneOf(argumentProcessor).processUnparsed(emptyStringList());
oneOf(argumentProcessor).finishedProcessing();
}
});
argumentCollectionBuilder.processArguments(argumentProcessor);
}
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);
}
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" });
}
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" });
}
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" });
}
Aggregations