title: Shutdown hook is not printing to console in JUnit Test executed via Maven
body: <p>I have a simple JUnit test which is ran by Maven through a method marked by @Test annotation. I want to place the shutdown hook into that test because I want to print some test results if the user hits CTRL-C. I code the following lines:</p>
  
  <pre><code>@Test
  public void runTest() {
      Thread shutdownHook = new Thread()
      {
          @Override
          public void run()
          {
              System.out.println("hooked");
              ... print something via System.out.println ...
          }
      };
      Runtime.getRuntime().addShutdownHook(shutdownHook);
  
      ... run test ...
  
  }
  </code></pre>
  
  <p>To run it I use Maven:</p>
  
  <blockquote>
    <p>mvn clean test -DtestClassName=com.MyTest</p>
  </blockquote>
  
  <p>The problem is that nothing is printed. Looks like System.out.println is not working already. What can I do to fix it?</p>