PageRenderTime 50ms CodeModel.GetById 25ms RepoModel.GetById 1ms app.codeStats 0ms

/args4j-2.0.16/args4j/test/org/kohsuke/args4j/Issue10Test.java

#
Java | 29 lines | 17 code | 7 blank | 5 comment | 0 complexity | 0ae942271cea00aa2f31c2a079b8e52d MD5 | raw file
Possible License(s): BSD-2-Clause
  1. package org.kohsuke.args4j;
  2. import java.io.ByteArrayOutputStream;
  3. import junit.framework.TestCase;
  4. /**
  5. * @see https://args4j.dev.java.net/issues/show_bug.cgi?id=10
  6. */
  7. @SuppressWarnings("unused")
  8. public class Issue10Test extends TestCase {
  9. @Option(name="-enum", required=false, usage="Enum2")
  10. private Enum crash;
  11. enum Enum {
  12. THIS, ENUM, HAS, A, VERY, LONG, USAGE, LINE,
  13. BECAUSE, OF, ITS, HUGE, LIST, Of, VALUES,
  14. SO, IT, WILL, CRASH
  15. }
  16. // The bug should be fixed with changing from manual printing to printf.
  17. public void testIssue10() {
  18. CmdLineParser parser = new CmdLineParser(this);
  19. parser.printUsage(new ByteArrayOutputStream());
  20. // occurred error: StringIndexOutOfBoundsException with index < 0
  21. }
  22. }