01: /*
02: Copyright 2004-2007 Paul R. Holser, Jr. All rights reserved.
03: Licensed under the Academic Free License version 3.0
04: */
05:
06: package joptsimple;
07:
08: import java.util.Collections;
09:
10: import junit.framework.TestCase;
11:
12: /**
13: * @author <a href="mailto:pholser@alumni.rice.edu">Paul Holser</a>
14: * @version $Id: PopulatedOptionSetTest.java,v 1.8 2007/04/10 20:06:27 pholser Exp $
15: */
16: public class PopulatedOptionSetTest extends TestCase {
17: private OptionSet populated;
18:
19: protected void setUp() throws Exception {
20: super .setUp();
21:
22: populated = new OptionSet();
23:
24: populated.add("a");
25: populated.addWithArgument("b", "arg-of-b");
26: }
27:
28: public void testArgumentOf() {
29: assertNull(populated.argumentOf("a"));
30: assertEquals("arg-of-b", populated.argumentOf("b"));
31: }
32:
33: public void testArgumentsOf() {
34: assertEquals(Collections.EMPTY_LIST, populated.argumentsOf("a"));
35: assertEquals(Collections.singletonList("arg-of-b"), populated
36: .argumentsOf("b"));
37: }
38:
39: public void testHasArgument() {
40: assertFalse(populated.hasArgument("a"));
41: assertTrue(populated.hasArgument("b"));
42: }
43: }
|