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 junit.framework.TestCase;
09:
10: /**
11: * @author <a href="mailto:pholser@alumni.rice.edu">Paul Holser</a>
12: * @version $Id: AbstractOptionParserFixture.java,v 1.9 2007/04/10 20:06:27 pholser Exp $
13: */
14: public class AbstractOptionParserFixture extends TestCase {
15: protected OptionParser parser;
16:
17: protected void setUp() throws Exception {
18: super .setUp();
19:
20: parser = new OptionParser();
21: }
22:
23: static void assertOptionDetected(OptionSet detectedOptions,
24: String option) {
25: assertOptionDetected("option '" + option + "' not detected?",
26: detectedOptions, option);
27: }
28:
29: private static void assertOptionDetected(String message,
30: OptionSet detectedOptions, String option) {
31:
32: assertTrue(message, detectedOptions.wasDetected(option));
33: }
34:
35: static void assertOptionNotDetected(OptionSet detectedOptions,
36: String option) {
37: assertOptionNotDetected("option '" + option + "' detected?",
38: detectedOptions, option);
39: }
40:
41: static void assertOptionNotDetected(String message,
42: OptionSet detectedOptions, String option) {
43:
44: assertFalse(message, detectedOptions.wasDetected(option));
45: }
46: }
|