Hello!
During to migration from JUnit 3.8 to JUnit 4.4 I changed also definitions of my unit-test to use more annotations.
I have quite small project - target of this project is to test web-services via CXF. So, this project has sprint-core, context and test in dependencies plus some libraries required for building CXF client.
This project do not used any database, so, it has no any dataSource bean specified, as well as do not worked with transactions at all. So, it has no spring-tx in dependencies.
Then I declared by unit-test as:
I've got an error during test exection:Code:@RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(locations={"classpath:/META-INF/emforge-ws-config-test.xml", "classpath:/META-INF/emforge-ws-test.xml"}) public class BaseWsUnitTest {
That means if it is required spring-tx. If I will add - it will start to tell me that it cannot find dataSource, "transactionManager" bean and so on and so on.Code:java.lang.NoClassDefFoundError: org/springframework/transaction/TransactionDefinition at java.lang.Class.getDeclaredConstructors0(Native Method) at java.lang.Class.privateGetDeclaredConstructors(Class.java:2389) at java.lang.Class.getConstructor0(Class.java:2699) at java.lang.Class.getDeclaredConstructor(Class.java:1985) at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:61) at org.springframework.test.context.TestContextManager.retrieveTestExecutionListeners(TestContextManager.java:171) at org.springframework.test.context.TestContextManager.<init>(TestContextManager.java:108) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.createTestContextManager(SpringJUnit4ClassRunner.java:107) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.<init>(SpringJUnit4ClassRunner.java:79) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) at java.lang.reflect.Constructor.newInstance(Constructor.java:513) at org.junit.internal.requests.ClassRequest.buildRunner(ClassRequest.java:33) at org.junit.internal.requests.ClassRequest.getRunner(ClassRequest.java:28) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.<init>(JUnit4TestReference.java:26) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestClassReference.<init>(JUnit4TestClassReference.java:24) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.createTest(JUnit4TestLoader.java:40) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.loadTests(JUnit4TestLoader.java:30) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:445) 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)
So, is this requiremenets of Transactions by simple test runner a feature of Spring-Test - or it is a bug?
Thank you for any suggestions


Reply With Quote