blob: 8f113f859a72590e785f54932a3f5f6fdd09d4ef (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
package joptsimple.examples;
import static java.util.Arrays.*;
import joptsimple.OptionException;
import joptsimple.OptionParser;
import joptsimple.OptionSet;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
import static org.junit.Assert.*;
import static org.junit.rules.ExpectedException.*;
public class ShortOptionsWithMultipleArgumentsForSingleOptionTest {
@Rule public final ExpectedException thrown = none();
@Test
public void allowsMultipleValuesForAnOption() {
OptionParser parser = new OptionParser( "a:" );
OptionSet options = parser.parse( "-a", "foo", "-abar", "-a=baz" );
assertTrue( options.has( "a" ) );
assertTrue( options.hasArgument( "a" ) );
assertEquals( asList( "foo", "bar", "baz" ), options.valuesOf( "a" ) );
thrown.expect( OptionException.class );
options.valueOf( "a" );
}
}
|