title: How to run JUnit test in separate processes?
body: <p>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:</p>
  
  <pre><code>System.setProperty("property", "value1");
  </code></pre>
  
  <p>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).</p>
  
  <p>I believe the solution could be to run those unit tests in separate processes. I saw similar discussion <a href="https://stackoverflow.com/questions/636367/executing-a-java-application-in-a-separate-process">here</a>, 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?</p>
  
  <p>Thanks in advance for any advices.</p>