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 8480219
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T19:14:11+00:00 2026-06-10T19:14:11+00:00

I have 2 integration tests implemented with JUnit. Both of the tests perform calls

  • 0

I have 2 integration tests implemented with JUnit. Both of the tests perform calls to the remote server and the server target is configured by environment variable:

System.setProperty("property", "value1");

The tricky thing is that those properties must be different for 2 tests. If I set the environment variable for each unit test it does not work, because the middleware that we are using caches the property value on first call and does not evaluate it anymore (for the second test).

I believe the solution could be to run those unit tests in separate processes. I saw similar discussion here, but maybe there is more elegant way fo doing this with JUnit4? This problem looks pretty common.
Or maybe there are another ways to run unit tests with different configuration?

Thanks in advance for any advices.

  • 1 1 Answer
  • 0 Views
  • 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-06-10T19:14:12+00:00Added an answer on June 10, 2026 at 7:14 pm

    It is considered bad practice to have state which cannot be reset between tests. While code which cannot be tested easily is common, the solutions are not simple.

    I would consider resetting the cached value even if you have use reflections to do it. Exactly what needs to be reset depends on the internal representation of the library.

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

Sidebar

Related Questions

We have a lot of integration tests written using JUnit 3 , though we're
Normally I would have one junit test that shows up in my integration server
We have a number of integration tests that fail when our staging server goes
I have several suites of integration tests implemented in C#/NUNit. Each test suite is
I have integration tests using RavenDB with RunInMemory = true . One of the
We currently have a suite of integration tests that run via MbUnit test suites.
I have a web-application written in java. I would like to run integration tests
I have a class that creates a file. I am now doing integration tests
I have a Spring JUnit test with configuration files and @ContextConfiguration parameters: package ru.csbi.registry.domain.envers.integration;
I have some integration tests that hit a webserver and verify certain functionalities. Depending

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.