title: JUnitCore not loading libs required in test cases
body: <p>I am attempting to write a method which dynamically runs an <b>external</b> class' test. I am able to run tests which only use JDK libraries, however when I run a test which uses another library such as org.jmock.Mockery, the Result object returned by JUnitCore.run(args) has the following error:</p>
  
  <pre><code>[initializationError(package.TestClass): org/jmock/Mockery]
  java.lang.NoClassDefFoundError: org/jmock/Mockery
  
  com.sun.jdi.ClassNotLoadedException: Type has not been loaded occurred while retrieving component type of array.
  </code></pre>
  
  <p>Needless to say, the tests run and pass if I run them from their original project in eclipse.</p>
  
  <p>I believe the issue is related the classpath as the ClassLoader is seemingly only loading the class being tested and not loading dependencies (like jars) defined in the external project's classpath. I don't know how to dynamically load jars to an executing application.</p>
  
  <p>Below is the code loading the class and running the tests.</p>
  
  <pre><code>URL url = new File("E:\eclipseProjectName\bin\").toURL();
  final URL[] urls = new URL[] { url };
  final ClassLoader cl = new URLClassLoader(urls);
  @SuppressWarnings("rawtypes")
  final Class cls = cl.loadClass("package.ClassName");
  final JUnitCore core = new JUnitCore();
  final Result result = new JUnitCore().run(Request.method(cls, "methodName"));
  </code></pre>
  
  <p>Thanks in advance,</p>
  
  <p>Mark Cachia</p>