How to test executable JAR?
<p>I have a simple class in executable JAR file:</p>

<pre><code>public final class Main {
  public static void main(String[] args) {
    System.out.println("hello, world!");
    System.exit(-1);
  }
}
</code></pre>

<p>Now I'm trying to test this class/method:</p>

<pre><code>public class MainTest {
  @Test public void testMain() {
    Main.main(new String[] { "something" });
  }
}
</code></pre>

<p>Testing crashes on <code>System.exit(0)</code>, and I can understand why. Now what should I do? Shall I mock <code>System</code>? What is a standard approach here? Btw, maybe I should test the method "in container" (read "in JAR"), the same way we're doing it with WAR files?</p>
