2222import java .io .PrintWriter ;
2323import java .io .StringWriter ;
2424import java .util .Iterator ;
25- import java .util .List ;
2625import java .util .Properties ;
2726
2827import junit .framework .TestCase ;
@@ -365,75 +364,6 @@ public void test15648() throws Exception
365364 CommandLine line = parser .parse ( options , args );
366365 assertEquals ( "Two Words" , line .getOptionValue ( "m" ) );
367366 }
368-
369- public void test27635 ()
370- {
371- Option help = new Option ("h" , "help" , false , "print this message" );
372- Option version = new Option ("v" , "version" , false , "print version information" );
373- Option newRun = new Option ("n" , "new" , false , "Create NLT cache entries only for new items" );
374- Option trackerRun = new Option ("t" , "tracker" , false , "Create NLT cache entries only for tracker items" );
375-
376- Option timeLimit = OptionBuilder .withLongOpt ("limit" )
377- .hasArg ()
378- .withValueSeparator ()
379- .withDescription ("Set time limit for execution, in mintues" )
380- .create ("l" );
381-
382- Option age = OptionBuilder .withLongOpt ("age" )
383- .hasArg ()
384- .withValueSeparator ()
385- .withDescription ("Age (in days) of cache item before being recomputed" )
386- .create ("a" );
387-
388- Option server = OptionBuilder .withLongOpt ("server" )
389- .hasArg ()
390- .withValueSeparator ()
391- .withDescription ("The NLT server address" )
392- .create ("s" );
393-
394- Option numResults = OptionBuilder .withLongOpt ("results" )
395- .hasArg ()
396- .withValueSeparator ()
397- .withDescription ("Number of results per item" )
398- .create ("r" );
399-
400- Option configFile = OptionBuilder .withLongOpt ("config" )
401- .hasArg ()
402- .withValueSeparator ()
403- .withDescription ("Use the specified configuration file" )
404- .create ();
405-
406- Options mOptions = new Options ();
407- mOptions .addOption (help );
408- mOptions .addOption (version );
409- mOptions .addOption (newRun );
410- mOptions .addOption (trackerRun );
411- mOptions .addOption (timeLimit );
412- mOptions .addOption (age );
413- mOptions .addOption (server );
414- mOptions .addOption (numResults );
415- mOptions .addOption (configFile );
416-
417- HelpFormatter formatter = new HelpFormatter ();
418- final String EOL = System .getProperty ("line.separator" );
419- StringWriter out = new StringWriter ();
420- formatter .printHelp (new PrintWriter (out ),80 ,"commandline" ,"header" ,mOptions ,2 ,2 ,"footer" ,true );
421- assertEquals (
422- "usage: commandline [-a <arg>] [--config <arg>] [-h] [-l <arg>] [-n] [-r <arg>]" + EOL +
423- " [-s <arg>] [-t] [-v]" + EOL +
424- "header" +EOL +
425- " -a,--age <arg> Age (in days) of cache item before being recomputed" +EOL +
426- " --config <arg> Use the specified configuration file" +EOL +
427- " -h,--help print this message" +EOL +
428- " -l,--limit <arg> Set time limit for execution, in mintues" +EOL +
429- " -n,--new Create NLT cache entries only for new items" +EOL +
430- " -r,--results <arg> Number of results per item" +EOL +
431- " -s,--server <arg> The NLT server address" +EOL +
432- " -t,--tracker Create NLT cache entries only for tracker items" +EOL +
433- " -v,--version print version information" +EOL +
434- "footer" +EOL
435- ,out .toString ());
436- }
437367
438368 public void test31148 () throws ParseException
439369 {
@@ -452,42 +382,5 @@ public void test31148() throws ParseException
452382 assertTrue (cl .hasOption ('o' ));
453383 assertEquals ("ovalue" ,cl .getOptionValue ('o' ));
454384 }
455-
456- public void test21215 ()
457- {
458- Options options = new Options ();
459- HelpFormatter formatter = new HelpFormatter ();
460- String SEP = System .getProperty ("line.separator" );
461- String header = SEP +"Header" ;
462- String footer = "Footer" ;
463- StringWriter out = new StringWriter ();
464- formatter .printHelp (new PrintWriter (out ),80 , "foobar" , header , options , 2 , 2 , footer , true );
465- assertEquals (
466- "usage: foobar" +SEP +
467- "" +SEP +
468- "Header" +SEP +
469- "" +SEP +
470- "Footer" +SEP
471- ,out .toString ());
472- }
473-
474- public void test19383 ()
475- {
476- Options options = new Options ();
477- options .addOption (new Option ("a" ,"aaa" ,false ,"aaaaaaa" ));
478- options .addOption (new Option (null ,"bbb" ,false ,"bbbbbbb" ));
479- options .addOption (new Option ("c" ,null ,false ,"ccccccc" ));
480-
481- HelpFormatter formatter = new HelpFormatter ();
482- String SEP = System .getProperty ("line.separator" );
483- StringWriter out = new StringWriter ();
484- formatter .printHelp (new PrintWriter (out ),80 , "foobar" , "" , options , 2 , 2 , "" , true );
485- assertEquals (
486- "usage: foobar [-a] [--bbb] [-c]" +SEP +
487- " -a,--aaa aaaaaaa" +SEP +
488- " --bbb bbbbbbb" +SEP +
489- " -c ccccccc" +SEP
490- ,out .toString ());
491- }
492385
493386}
0 commit comments