Commons CLI
  1. Commons CLI
  2. CLI-50

[cli] TestHelpFormatter.testAutomaticUsage unit test failure

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: Nightly Builds
    • Fix Version/s: 2.0
    • Component/s: CLI-2.x
    • Labels:
      None
    • Environment:

      Operating System: Windows XP
      Platform: PC

      Description

      I am seing the following error:

      junit.framework.ComparisonFailure: simple auto usage expected:<...b] [-a...>
      but was:<...a] [-b...>
      at junit.framework.Assert.assertEquals(Assert.java:81)
      at org.apache.commons.cli.TestHelpFormatter.testAutomaticUsage
      (TestHelpFormatter.java:168)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke
      (NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke
      (DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:324)
      at junit.framework.TestCase.runTest(TestCase.java:154)
      at junit.framework.TestCase.runBare(TestCase.java:127)
      at junit.framework.TestResult$1.protect(TestResult.java:106)
      at junit.framework.TestResult.runProtected(TestResult.java:124)
      at junit.framework.TestResult.run(TestResult.java:109)
      at junit.framework.TestCase.run(TestCase.java:118)
      at junit.framework.TestSuite.runTest(TestSuite.java:208)
      at junit.framework.TestSuite.run(TestSuite.java:203)
      at junit.framework.TestSuite.runTest(TestSuite.java:208)
      at junit.framework.TestSuite.run(TestSuite.java:203)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests
      (RemoteTestRunner.java:392)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run
      (RemoteTestRunner.java:276)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main
      (RemoteTestRunner.java:167)

      Since HashMaps are used in the Options class the order or Option instances
      cannot be guaranteed.

      FYI, I am running the tests from Eclipse 2.1 on top of Java 1.4.1_02. Will the
      current pending "v2" changes from John K will solve this?

        Activity

        Hide
        ggregory@seagullsw.com added a comment -

        I am using the latest CLI from CVS.

        Show
        ggregory@seagullsw.com added a comment - I am using the latest CLI from CVS.
        Hide
        Rob Oxspring added a comment -

        CLI2 in the sandbox defaults to using the order in which options were added.
        If this doesn't suit then a Comparator instance can be supplied to control the
        ordering. Importantly though, the order is never left to Map implementation to
        dictate.

        Rob

        Show
        Rob Oxspring added a comment - CLI2 in the sandbox defaults to using the order in which options were added. If this doesn't suit then a Comparator instance can be supplied to control the ordering. Importantly though, the order is never left to Map implementation to dictate. Rob

          People

          • Assignee:
            Unassigned
            Reporter:
            Gary Gregory
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development