Announcement Announcement Module
Collapse
No announcement yet.
Junit 4 tests stopped working - dependency problem? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Junit 4 tests stopped working - dependency problem?

    I am running a JUnit 4 testrunner in Ecllipse which previously worked and the test code is unchanged. I have substituted in and out 2 tests and get the same problem.

    Unfortunately I am not sure what has changed in the dependencies since it worked (which I know points to a flaw in my process, which I am just setting up).

    Perhaps someone might spot something! Thanks.

    I now get an error:
    Code:
    SpringJUnit4ClassRunner constructor called with [class mypackage.MyTest].
    @TestExecutionListeners is not present for class [class mypackage.MyTest]: using defaults.
    Invoking test method [public void mypackage.MyTest.testUpdate()]
    Creating new expensive value for key 'class org.springframework.core.style.DefaultValueStyler'
    Caching expensive value: org.springframework.core.ReflectiveVisitorHelper$ClassVisitMethods@b89838
    Creating new expensive value for key 'class java.lang.Class'
    Looking for method visit(class java.lang.Class)
    Caching expensive value: java.lang.String org.springframework.core.style.DefaultValueStyler.visit(java.lang.Class)
    For key 'class org.springframework.core.style.DefaultValueStyler', returning cached value: org.springframework.core.ReflectiveVisitorHelper$ClassVisitMethods@b89838
    Creating new expensive value for key 'class [Ljava.lang.String;'
    Looking for method visit(class [Ljava.lang.String;)
    Looking for method visit(interface java.lang.Cloneable)
    Looking for method visit(interface java.io.Serializable)
    Caching expensive value: java.lang.String org.springframework.core.style.DefaultValueStyler.visit(java.lang.Object)
    java.lang.NoSuchMethodError: org.springframework.util.ObjectUtils.nullSafeToString(Ljava/lang/Object;)Ljava/lang/String;
    	at org.springframework.test.context.TestContext.contextKeyString(TestContext.java:181)
    	at org.springframework.test.context.TestContext.getApplicationContext(TestContext.java:194)
    	at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.injectDependencies(DependencyInjectionTestExecutionListener.java:109)
    	at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.prepareTestInstance(DependencyInjectionTestExecutionListener.java:75)
    	at org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:255)
    	at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.createTest(SpringJUnit4ClassRunner.java:111)
    	at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.invokeTestMethod(SpringJUnit4ClassRunner.java:148)
    	at org.junit.internal.runners.JUnit4ClassRunner.runMethods(JUnit4ClassRunner.java:51)
    	at org.junit.internal.runners.JUnit4ClassRunner$1.run(JUnit4ClassRunner.java:44)
    	at org.junit.internal.runners.ClassRoadie.runUnprotected(ClassRoadie.java:27)
    	at org.junit.internal.runners.ClassRoadie.runProtected(ClassRoadie.java:37)
    	at org.junit.internal.runners.JUnit4ClassRunner.run(JUnit4ClassRunner.java:42)
    	at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:97)
    	at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:46)
    	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
    	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
    	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
    	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
    	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
    For key 'class org.springframework.core.style.DefaultValueStyler', returning cached value: org.springframework.core.ReflectiveVisitorHelper$ClassVisitMethods@b89838
    Creating new expensive value for key 'class java.lang.String'
    Looking for method visit(class java.lang.String)
    Caching expensive value: java.lang.String org.springframework.core.style.DefaultValueStyler.visit(java.lang.String)
    For key 'class org.springframework.core.style.DefaultValueStyler', returning cached value: org.springframework.core.ReflectiveVisitorHelper$ClassVisitMethods@b89838
    Creating new expensive value for key 'class mypackage.MyTest'
    Looking for method visit(class mypackage.MyTest)
    Caching expensive value: java.lang.String org.springframework.core.style.DefaultValueStyler.visit(java.lang.Object)
    For key 'class org.springframework.core.style.DefaultValueStyler', returning cached value: org.springframework.core.ReflectiveVisitorHelper$ClassVisitMethods@b89838
    Creating new expensive value for key 'null'
    Caching expensive value: java.lang.String org.springframework.core.style.DefaultValueStyler.visitNull()
    For key 'class org.springframework.core.style.DefaultValueStyler', returning cached value: org.springframework.core.ReflectiveVisitorHelper$ClassVisitMethods@b89838
    For key 'null', returning cached value: java.lang.String org.springframework.core.style.DefaultValueStyler.visitNull()
    Performing dependency injection for test context [[TestContext@422ede testClass = MyTest, locations = array<String>['file:src/test/resources/test-applicationContext.xml'], testInstance = mypackage.MyTest@19efb05, testMethod = [null], testException = [null]]].
    My maven dependencies are:
    http://i39.tinypic.com/b85iza.jpg

  • #2
    Well the picture tells it all, you are mixing spring versions... You have spring 1.2.8 and 2.5.6 in one project, never do that...

    Comment


    • #3
      Thanks! I was wondering why Spring 1.2.8 was in there alright. It turns out my pom included one of my own jars whose pom had this old version of spring in there which I had not spotted.
      Last edited by tomasc; Mar 16th, 2010, 07:20 PM.

      Comment

      Working...
      X