title: How to get all test methods' names from an extern .class file
body: <p>I'm trying to get testing methods' names from extern .class files.
  Here is the directory tree：</p>
  <ul>
  <li>classes
  <ul>
  <li>CMD.class</li>
  </ul>
  </li>
  <li>target-classes
  <ul>
  <li>CMDTest.class</li>
  <li>CMDTest1.class</li>
  <li>CMDTest2.class</li>
  </ul>
  </li>
  </ul>
  <p>Adding these files to working directory is not allowed.</p>
  <p>My solution is using <strong>URLClassloader</strong> to load all the files from the target-classes and then using getDeclaredMethods() to get all the methods with annotation @Test. However, there are some custom exceptions defined in CMD.class which with cause exceptions as follows:</p>
  <ul>
  <li>&quot;Exception in thread &quot;main&quot; java.lang.NoClassDefFoundError: CMD$OptionException&quot;</li>
  </ul>
  <p>OptionException is defined in CMD.class.</p>
  <p>How to solve this problem or is there any effective methods to get testing methods' names from extern .class files？</p>
  <p>Thanks a lot!</p>