title: How to Suspend/Delay java unit tests
body: <p>Is there a way to suspend java ( springboot )  unit tests execution when running mvn test and resume them later ?</p>
  <p>So I have this test class :</p>
  <pre><code>
  @SpringBootTest(webEnvironment = WebEnvironment.DEFINED_PORT)
  class JavaAppApplicationTests {
  
      @Test
      void contextLoads() {} 
  
      @Test
      @RepeatedTest(10)
      public void testApplication() {
          JavaAppApplication javaApp = new JavaAppApplication();
          String result = javaApp.sanitize();
          assertEquals(result, &quot;{\&quot;key1\&quot;:\&quot;value1\&quot;,\&quot;type\&quot;:\&quot;Booking\&quot;,\&quot;sid\&quot;:\&quot;A435211\&quot;,\&quot;region\&quot;:\&quot;ASIA\&quot;,\&quot;fetchFromFile\&quot;:\&quot;false\&quot;,\&quot;service\&quot;:\&quot;true\&quot;,\&quot;isEom\&quot;:\&quot;true\&quot;}&quot;);
      }
  
  }
  </code></pre>
  <p>And when I run mvn test, I see in the console logs the following :</p>
  <pre><code> /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
  ( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
   \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
    '  |____| .__|_| |_|_| |_\__, | / / / /
   =========|_|==============|___/=/_/_/_/
   :: Spring Boot ::                (v2.6.6)
  
  2022-05-17 11:00:29.481  INFO 58143 --- [           main] c.e.javaapp.JavaAppApplicationTests      : Starting JavaAppApplicationTests using Java 17-internal on neo-VirtualBox with PID 58143 (started by neo in /home/neo/Desktop/spring-vulnerable-app)
  2022-05-17 11:00:29.483  INFO 58143 --- [           main] c.e.javaapp.JavaAppApplicationTests      : No active profile set, falling back to 1 default profile: &quot;default&quot;
  2022-05-17 11:00:30.542  INFO 58143 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat initialized with port(s): 8080 (http)
  2022-05-17 11:00:30.561  INFO 58143 --- [           main] o.apache.catalina.core.StandardService   : Starting service [Tomcat]
  2022-05-17 11:00:30.561  INFO 58143 --- [           main] org.apache.catalina.core.StandardEngine  : Starting Servlet engine: [Apache Tomcat/9.0.60]
  2022-05-17 11:00:30.749  INFO 58143 --- [           main] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
  2022-05-17 11:00:30.749  INFO 58143 --- [           main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 1230 ms
  2022-05-17 11:00:31.497  INFO 58143 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat started on port(s): 8080 (http) with context path ''
  2022-05-17 11:00:31.507  INFO 58143 --- [           main] c.e.javaapp.JavaAppApplicationTests      : Started JavaAppApplicationTests in 2.452 seconds (JVM running for 3.887)
  [INFO] Tests run: 12, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 4 s - in com.elastisys.javaapp.JavaAppApplicationTests
  [INFO] 
  [INFO] Results:
  [INFO] 
  [INFO] Tests run: 12, Failures: 0, Errors: 0, Skipped: 0
  
  </code></pre>
  <p>The JavaApplicationTests is started with a specific PID and a defined port and then tests are executed.</p>
  <p>What I am looking for is a way to start the application  and wait for a specific period before executing all the tests ( like it's suspended )</p>
  <p>Thanks in advance</p>