What is the best practice way to do unit testing with Spring? I assume the combination TestNG & jmockit with Spring 3 isn\'t bad, so that\'s what I\'m doing right now, b
You might want to try hibernate-annotations-3.5.0-Beta-1 as this aligns with hibernate-core-3.5.0-Beta-1.
I still get the java.lang.IncompatibleClassChangeError sometimes, as I'm trying to use hibernate search which is using the "old" annotations.
Also, not sure if you are running JBoss, but if you are you'll get this error with core 3.5.0.
Your test ckass needs to extend AbstractTestNGSpringContextTests. Or if your code is testing database acces another useful class to extend is AbstractTransactionalTestNGSpringContextTests.
Consult the chapter on TestNG in the Spring documentation:
Now the problem doesn't seem to be related to any of Spring or TestNG. The key part is:
java.lang.IncompatibleClassChangeError: class org.hibernate.cfg.ExtendedMappings has interface org.hibernate.cfg.Mappings as super class
Are you sure your CLASSPATH is OK? I.e. you have compatible version of Hibernate modules and no repetitions there?
What if you create a simple TestNG test that does the following:
Class.forName("org.hibernate.cfg.ExtendedMappings");
?
For me this problem was caused because I had different hibernate versions included myself, not because of a third party including them. A sweep of your project/poms to make sure you youserlf are only using one hibernate version is worthwhile.