title: Using JUnit on code that terminates
body: <p>I am trying to test a given java application, and for that purpose I want to use JUnit.</p>
  
  <p>The problem I am facing is the following: Once the code I am trying to test finishes its work, its calling <code>System.exit()</code>, which closes the application. Although it is also stoping my tests from completing, as it closes the JVM (I assume).</p>
  
  <p>Is there anyway to go around this problem, without modifying the original code? Initially I tried launching the application im testing from new thread, although that obviously didn't make much difference.</p>