Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 854861
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T07:59:32+00:00 2026-05-15T07:59:32+00:00

I have an extremely odd problem in my JUnit tests that I just can’t

  • 0

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

  1. some tests fail to run and throw a database exception where it complains that a user cannot be inserted because an enterprise does not exist. But it just created the enterprise in the preceding line of code! And there was no errors in the insertion of the enterprise.
  2. Stranger yet, if this test class is run by itself everything works fine. It is only when the test is run as part of the project that it fails!
  3. And the exact same abstracted code was run by 10+ tests before the one that fails!
  4. f

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.

  • Using JUnit 4.4, Spring 2.5.6, iBatis 2.3.0, Postgresql 8.3
  • Switching to org.springframework.jdbc.datasource.DriverManagerDataSource from org.apache.commons.dbcp.BasicDataSource changed the problem. Using DriverManagerDataSource the tests work for the first time, but now all of a sudden a lot of data isn’t rolled back in the database! It leaves everything behind. All with no errors
  • Tests fail when run via Eclipse & Maven

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

  • The test that fails
  • The test that succeeds
  • 1 1 Answer
  • 1 View
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T07:59:33+00:00Added an answer on May 15, 2026 at 7:59 am

    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

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an extremely simple page that I'm trying to view in the Facebook
I'm extremely new to JS and have this code that I'm trying to tweak.
I have a collection of PHP scripts that are extremely CPU intensive, juggling millions
I have an extremely simple JSON object that looks like the following: var data
I have an extremely simple BizTalk orchestration that takes a HIPAA 837 file in,
I have some extremely weird behavior that seems to result in silent exceptions. How
I seem to be having some extremely odd cache_money interactions. When I am on
Let's say I have an extremely long string with arguments that I want to
Yo. I have this extremely simple swap function that seems to not work. Probably
I have an extremely simple web application running in Tomcat using Spring 3.0.2, Hibernate

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.