As mentioned to uwe on irc, i took a stab at improving hte tests for IndexUpgrader – we weren't doing any testing of the command line parsing logic, and only one of the class constructors was being tested.
this attached patch includes the new tests, as well as a quick attempt at fixing the issue reported. it also fixes another issue discoverd by the test: "-dir-impl" aparently didn't work at all, because it would be interpreted as the name of the directory and then the subsequent option value would be considered bogus and cause the usage to be printed.
This patch still has some problems...
1) since it now randomly tests "verbose" mode, it's really verbose. i don't have any good suggestions here other them to create a static variable that defaults to System.out when the code runs normally, but the tests could set it to some MockOutputStream in a @BeforeClass
2) there are some nocommit lines relate to how we randomize the "-dir-impl" option ... it's really kludgy now, but it's the best i could come up with w/o making changes to LuceneTestCase ... hopefully someone else has a suggestion.
3) as i mentioned on irc, i'm not convinced that IndexWriterConfig doesn't also need fixed...
- IndexWriterConfig.setInfoStream(InfoStream) javadocs say "If non-null, ... will be printed to this." but it throws an error if you try to set it to the value of null you get an error – why doesn't it just implicitly use NO_OUTPUT if the arg is null? why don't the javadocs mention NO_OUTPUT?
- IndexWriterConfig.setInfoStream(PrintStream) javadocs just say it's a convinience wrapper using PrintStreamInfoStream, with no mention of null at all – even if setInfoStream(InfoStream) is going to be a hard-ass about null, why can't setInfoStream(PrintStream) implicitly use NO_OUTPUT when it's arg is null?