-
Notifications
You must be signed in to change notification settings - Fork 235
TestContext extracted to interface in Spring 4 #46
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I have the same issue and if you upgrade spring-test-dbunit to use spring-test 4.0.0.RELEASE everything works well. The problem is that the projects with 3.x.x spring will not work with spring-test-dbunit which depends on spring 4 and vice versa ... |
Thanks for the advice, but how can you upgrade spring-test-dbunit? To say, do you recompile changing the spring-test-dbunit pom.xml? |
Use reflection to access Spring's TestContext to protect against IncompatibleClassChangeError caused by the fact that it changed from a class to an interface between Spring 3.2 and 4.0 Issue: #46
I have started a 1.1.0 version on master that targets Spring 4.0 whilst remaining compatible with Spring 3.2. Could you try building the latest master and let me know if that works for you. |
All is ok. |
<target>${java.version}<target> (apologize html enities...) |
I did the same and it worked. Some tests still fail, but mostly regarding the @rule support, but since that feature will be dropped it doesn't matter. Also, 'mvn install' failed, in fact to be able to complete this I had to exclude all tests from the maven lifecycle. Also, I had to change the com.github.springtestdbunit.testutils.ExtendedTestContextManager class and replace this line: getTestContext().markApplicationContextDirty(); with getTestContext().markApplicationContextDirty(DirtiesContext.HierarchyMode.EXHAUSTIVE); ... to able to compile the code. |
Sorry if I'm a bit out of the loop here, I tried to line up this thread to the commit histories and maven artifact publish history, but thought i should ask just to make sure, has the 1.1.0 artifact been published and verified to continue to work with spring 3.2.x? I'm still seeing this issue when using spring 3.2.8, downgrading to 1.0.1 solves it for now, but I was hoping to leverage the query feature in the expected database annotation introduced in 1.1.0. Great work by the way! |
I have the same issue at Spring 3.2.0. With version 1.0.1 it works fine but with version 1.1.1 I get the error about TestContext. I suggest to add small note about dependence between dbUnit version and Spring version at main documentation page. |
can use spring-test-dbunit |
Upgrading tests from Spring 3.2.6 (all worked well) to Spring 4.0.0, recently released, an error arises:
java.lang.IncompatibleClassChangeError: Found interface org.springframework.test.context.TestContext, but class was expected
at com.github.springtestdbunit.TestExecutionListenerChain.runChain(TestExecutionListenerChain.java:134) ~[spring-test-dbunit-1.0.1.jar:na]
This is due to the fact that the TestContext is now an interface, so the DefaultTestContext (or another implementation) should be fed to the chain
The text was updated successfully, but these errors were encountered: