ClassCastException in junit 4.5 AllTests

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • eazyigz
    New Member
    • Sep 2008
    • 6

    ClassCastException in junit 4.5 AllTests

    I downloaded Junit 4.5 and am using the TestRunner class to test the AllTests class in the junit/tests package. I am issuing the following command at a DOS prompt:
    java -classpath junit-4.5.jar;. junit.textui.Te stRunner junit.tests.All Tests

    I get an Error:
    java.lang.Class CastException: class junit.tests.All Tests

    These classes are already compiled though.
    Any help would be appreciated.
  • JosAH
    Recognized Expert MVP
    • Mar 2007
    • 11453

    #2
    That's a runtime error: your code tries to cast an AllTests object to something
    else but it can't do that. Without seeing your code we can't say much more.

    kind regards,

    Jos

    Comment

    • eazyigz
      New Member
      • Sep 2008
      • 6

      #3
      There is not code to see. Simply because I'm tesing my Junit installation. Hence, there is no code to show.

      Comment

      • jkmyoung
        Recognized Expert Top Contributor
        • Mar 2006
        • 2057

        #4
        Just tried downloading it and got the same message. I don't get this with JUnit 4.0. Probably an environment variable out of place somewhere.
        By any chance do you have multiple JUnit installs on your computer?

        Comment

        • Pradip1632
          New Member
          • Jul 2010
          • 1

          #5
          Try this..

          java -classpath junit-4.5.jar;. org.junit.runne r.JUnitCore junit.tests.All Tests

          Comment

          Working...