How to start a Jersey Test Container (Grizzly) once for all tests in a test class?
<p>I am working on fixing the integration tests in one of the projects. Currently, all the integration test classes extend the JerseyTest class. Going through the <a href="https://github.com/jersey/jersey/blob/master/test-framework/core/src/main/java/org/glassfish/jersey/test/JerseyTest.java#L601" rel="noreferrer">JerseyTest class</a> I realized that it starts and stops the container for every test method using Junit's Before and After annotations. </p>

<p>Why is this necessary? Isn't it enough if we bring up the container once, run the tests and shut it down at the end of it? </p>

<p>We also use Spring and it takes time for the context to get initialized. </p>

<p>Prior to Junit4 we worked around this limitation by handling it manually using boolean flags. </p>

<pre><code>@Before
public void setup() {
  if(!containerStarted) {
   // start
   containerStarted = true;    
  }
 // else do nothing
}
</code></pre>