Community   SpringSource   Projects    Downloads    Documentation    Forums    Training   Exchange   Blogs

Go Back   Spring Community Forums > Core Spring Projects > Core Container

Reply
 
Thread Tools Display Modes
  #1  
Old Sep 13th, 2008, 09:56 AM
jfd jfd is offline
Junior Member
 
Join Date: Nov 2004
Posts: 18
Default 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)
__________________
Thanks,

jfd
Reply With Quote
  #2  
Old Sep 14th, 2008, 11:01 AM
MmarcoM MmarcoM is offline
Senior Member
 
Join Date: Sep 2004
Location: London
Posts: 266
Default

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
Reply With Quote
  #3  
Old Oct 9th, 2008, 10:15 PM
Adamal Adamal is offline
Junior Member
 
Join Date: Apr 2006
Posts: 19
Default

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.
Reply With Quote
  #4  
Old Nov 6th, 2008, 01:10 PM
jonmadison jonmadison is offline
Junior Member
 
Join Date: Aug 2008
Posts: 6
Default

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!
Reply With Quote
  #5  
Old Nov 7th, 2008, 12:03 AM
NubKnacker NubKnacker is offline
Senior Member
 
Join Date: Oct 2008
Location: Delhi, India
Posts: 163
Default

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)
Reply With Quote
  #6  
Old Nov 14th, 2008, 05:12 PM
tmcnamar2002 tmcnamar2002 is offline
Junior Member
 
Join Date: Nov 2008
Posts: 1
Default 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.
Reply With Quote
  #7  
Old Dec 1st, 2008, 02:09 PM
donohoe donohoe is offline
Junior Member
 
Join Date: Mar 2008
Location: Wayzata, MN
Posts: 11
Default

Thanks for the tip - I was seeing this error and downgraded to junit 4.4 which fixed it too.
Reply With Quote
  #8  
Old Dec 9th, 2008, 04:16 AM
Paul Newport Paul Newport is offline
Senior Member
 
Join Date: Sep 2004
Posts: 575
Default

Quote:
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
Reply With Quote
  #9  
Old May 2nd, 2009, 05:04 PM
Sam Brannen Sam Brannen is offline
Senior Member
 
Join Date: Jan 2006
Location: Zürich, Switzerland
Posts: 400
Default

Hi guys,

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

- Sam
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -5. The time now is 08:06 AM.


Contegix provides first-class managed hosting and partial sponsorship of these forums.

Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.