I have an extremely odd problem in my JUnit tests that I just can't seem to nail down. I have a multi-module java webapp project with a fairly standard structure (DAO's, service clasess, etc...). Within this project I have a 'core' project which contains some abstracted setup code which inserts a test user along with the necessary items for a user (in this case an 'enterprise', so a user must belong to an enterprise and this is enforced at the database level)
Fairly simple so far... but here is where the strangeness begins
I have been banging my head against a wall with this for days and haven't really made any progress. I'm not even sure what information to offer up to help diagnose this.
Please ask for any info which may help me solve my problem!
Update: I have turned up the logging to the max. There is only one slight difference between this test that fails, and another just like it which succeeds. The difference is highlighted. After the error occurs I see a number of "Creating [java.util.concurrent.ConcurrentHashMap]" lines and then the error handling code begins
Well... I seem to have stumbled upon the solution to this problem, although I can't really put my finger on what exactly it is. I was rebuilding my tests by moving them all and then restoring them one by one. Low and behold it wasn't until I added the final test class that the problem showed up again
This test class extended from a base test class which defined all the Spring related setup annotations like @RunWith and @ContextConfiguration. For some reason this test class redefined the @RunWith and @ContextConfiguration attributes and as soon as I removed them things started working again. The other odd thing about this test class was that I was using @Ignore on each test in it (it contained some old tests).
So... if anybody ever has this strange problem, you can try removing the extra annotations to fix it up