title: Cannot inject @Test annotated Method with TestNG and JMockit
body: <p>So basically, I want to check if test() function calls the static method <code>JOptionPane.showInputDialog(&quot;Enter a string.&quot;)</code>. This is what I have achieved so far.</p>
  <p><strong>Libraries used:</strong></p>
  <ol>
  <li>TestNG 7.4.0</li>
  <li>JMockit 1.49</li>
  </ol>
  <p><strong>Current Test code:</strong></p>
  <pre><code>package com.example;
  
  import javax.swing.*;
  import org.testng.annotations.Test;
  import mockit.Mocked;
  import mockit.Verifications;
  
  public class Activity1Test {
      @Test
      public void shouldShowInputDialogOnUpdateTextButtonClick(@Mocked JOptionPane jOptionPane) {
          Activity1 activity1 = new Activity1();
          activity1.test();
  
          new Verifications() {{ JOptionPane.showInputDialog(&quot;Enter a string.&quot;); }};
      }
  }
  </code></pre>
  <p><strong>The test() function:</strong></p>
  <pre><code>public void test() {
      JOptionPane.showInputDialog(&quot;Enter a string.&quot;);
  }
  </code></pre>
  <p>Unfortunately, it gives me this error:</p>
  <pre><code>-------------------------------------------------------------------------------
  Test set: TestSuite
  -------------------------------------------------------------------------------
  Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.781 s &lt;&lt;&lt; FAILURE! - in TestSuite
  com.example.Activity1Test.shouldShowInputDialogOnUpdateTextButtonClick  Time elapsed: 0.434 s  &lt;&lt;&lt; FAILURE!
  org.testng.TestNGException: 
  
  Cannot inject @Test annotated Method [shouldShowInputDialogOnUpdateTextButtonClick] with [class javax.swing.JOptionPane].
  For more information on native dependency injection please refer to https://testng.org/doc/documentation-main.html#native-dependency-injection
  </code></pre>