2009-11-06 09:21:13 UTC
Thanks for your answer.
It is the same version for Hibernate 3.2.5.GA. I made some tests to understand which module needs cglib 2.2 and I find that required by your mock.
If I exclude dependencies like you wrote in your post, I have the exception I wrote in my first post. Your mock module needs cglib 2.2 and can't be work with cglib 2.1_3. So it is impossible to use all Unitils modules in a same Maven module without exception.
In your trunk, check why you need cglib 2.2 and why cglib 2.1_3 can't be sufficient. To help you, I have the next exception
java.lang.NoSuchMethodError: org.objectweb.asm.ClassWriter.<init>(Z)V
at net.sf.cglib.core.DebuggingClassWriter.<init>(DebuggingClassWriter.java:47)
at net.sf.cglib.core.DefaultGeneratorStrategy.getClassWriter(DefaultGeneratorStrategy.java:30)
at net.sf.cglib.core.DefaultGeneratorStrategy.generate(DefaultGeneratorStrategy.java:24)
at net.sf.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:216)
at net.sf.cglib.core.KeyFactory$Generator.create(KeyFactory.java:145)
at net.sf.cglib.core.KeyFactory.create(KeyFactory.java:117)
at net.sf.cglib.core.KeyFactory.create(KeyFactory.java:108)
at net.sf.cglib.core.KeyFactory.create(KeyFactory.java:104)
at net.sf.cglib.proxy.Enhancer.<clinit>(Enhancer.java:69)
at org.unitils.mock.core.proxy.ProxyFactory.createEnhancedClass(ProxyFactory.java:137)
at org.unitils.mock.core.proxy.ProxyFactory.createProxy(ProxyFactory.java:88)
at org.unitils.mock.core.proxy.ProxyFactory.createProxy(ProxyFactory.java:57)
at org.unitils.mock.core.MockProxy.<init>(MockProxy.java:47)
at org.unitils.mock.core.MockObject.createMockProxy(MockObject.java:407)
at org.unitils.mock.core.MockObject.<init>(MockObject.java:87)
at org.unitils.mock.MockModule.createMock(MockModule.java:117)
at org.unitils.mock.MockModule.createAndInjectMocksIntoTest(MockModule.java:143)
at org.unitils.mock.MockModule$MockTestListener.beforeTestSetUp(MockModule.java:223)
at org.unitils.core.Unitils$UnitilsTestListener.beforeTestSetUp(Unitils.java:273)
at org.unitils.UnitilsJUnit4TestClassRunner$TestListenerInvokingMethodRoadie.runBeforesThenTestThenAfters(UnitilsJUnit4TestClassRunner.java:151)
at org.junit.internal.runners.MethodRoadie.runTest(MethodRoadie.java:77)
at org.junit.internal.runners.MethodRoadie.run(MethodRoadie.java:42)
at org.unitils.UnitilsJUnit4TestClassRunner.invokeTestMethod(UnitilsJUnit4TestClassRunner.java:95)
at org.junit.internal.runners.JUnit4ClassRunner.runMethods(JUnit4ClassRunner.java:51)
at org.unitils.UnitilsJUnit4TestClassRunner.access$000(UnitilsJUnit4TestClassRunner.java:44)
at org.unitils.UnitilsJUnit4TestClassRunner$1.run(UnitilsJUnit4TestClassRunner.java:62)
at org.junit.internal.runners.ClassRoadie.runUnprotected(ClassRoadie.java:27)
at org.junit.internal.runners.ClassRoadie.runProtected(ClassRoadie.java:37)
at org.unitils.UnitilsJUnit4TestClassRunner.run(UnitilsJUnit4TestClassRunner.java:68)
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)
when JUnit execute the next instruction (mock is Mock Unitils)
mock.returns("TEST").getName();
My solution would be to use unitils 3.0 and don't use your mock module. I only use EasyMock module which is sufficient.
Thanks for your help.