Announcement Announcement Module
Collapse
No announcement yet.
spring-test breaks in Junit 4.5 Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • spring-test breaks in Junit 4.5

    Basically, Junit 4.5 took out exceptions out the constructor classes. So I am running spring2.5.5 under it will get:

    java.lang.NoClassDefFoundError: org/junit/Assume$AssumptionViolatedException at org.springframework.test.context.junit4.SpringMeth odRoadie.runTestMethod(SpringMethodRoad
    ie.java:240)

  • #2
    hello,
    found similar problems but looked like my test assertions was incorrect
    could you please post :
    - your code
    - your test cocde
    - your pom.xml if you are using Maven to build your project


    i dont know your whole situation.. could you run your tests using JUnit 4.4 and see results?
    i found some posts somewhere that Spring sources were compiled using JUnit4.4 and JUnit guys changed signatures of certain methods

    regards
    marco

    Comment


    • #3
      The spring folks built there SpringJUnit4ClassRunner to extend an internal class. The internal class changed in junit 4.5. They need to be extending BlockJUnit4ClassRunner.

      Comment


      • #4
        see: htxp://thorndike.javaeye.com/blog/263197
        (sorry can't post URLs yet, change "htxp to http")

        what i took from this is to bump my junit support down to 4.4. although it appears that maybe upgrading to Spring 2.5.6 will alleviate this problem.

        Thanks for leading along the right track, Adamal!

        Comment


        • #5
          I'm not sure if this is related but in the following code

          Code:
          @RunWith(SpringJUnit4ClassRunner.class)
          public class GenericRequestControllerTests {
          
          	@Test
          	public void testLogout() {
          		.....
          	}
          }
          I get the exception
          Code:
          java.lang.NoSuchMethodError: org.junit.runner.notification.RunNotifier.testAborted(Lorg/junit/runner/Description;Ljava/lang/Throwable;)V
          	at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.invokeTestMethod(SpringJUnit4ClassRunner.java:137)
          	at org.junit.internal.runners.JUnit4ClassRunner.runMethods(JUnit4ClassRunner.java:59)
          	at org.junit.internal.runners.JUnit4ClassRunner$1.run(JUnit4ClassRunner.java:52)
          	at org.junit.internal.runners.ClassRoadie.runUnprotected(ClassRoadie.java:34)
          	at org.junit.internal.runners.ClassRoadie.runProtected(ClassRoadie.java:44)
          	at org.junit.internal.runners.JUnit4ClassRunner.run(JUnit4ClassRunner.java:50)
          	at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:45)
          	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
          	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
          	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
          	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
          	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)

          Comment


          • #6
            Spring 2.5.6 & JUnit 4.4 works

            I was getting the same error with Spring 2.5.6 and Junit 4.5.
            When I downgraded to JUnit 4.4, the exception went away.

            Comment


            • #7
              Thanks for the tip - I was seeing this error and downgraded to junit 4.4 which fixed it too.

              Comment


              • #8
                Originally posted by jfd View Post
                Basically, Junit 4.5 took out exceptions out the constructor classes. So I am running spring2.5.5 under it will get:

                java.lang.NoClassDefFoundError: org/junit/Assume$AssumptionViolatedException at org.springframework.test.context.junit4.SpringMeth odRoadie.runTestMethod(SpringMethodRoad
                ie.java:240)
                See http://jira.springframework.org/browse/SPR-5145

                Comment


                • #9
                  Hi guys,

                  FYI: as of Spring 3.0 M3, the Spring TestContext Framework is now based on JUnit 4.5.

                  - Sam

                  Comment


                  • #10
                    One easy way to resolve the problem is to provide the missing class. You can do that by adding the following dependency to your pom.xml file :
                    <dependency>
                    <groupId>com.google.code.protoj</groupId>
                    <artifactId>protoj-nodep</artifactId>
                    <version>1.8.4</version>
                    <scope>test</scope>
                    </dependency>


                    So now you can keep taking advantage from the newest Junit version without having to downgrade to version 4.4.
                    Youssef Hbali.

                    Comment

                    Working...
                    X