title: JMockit Mocking java.net.URL causes test not run
body: <p>I'm using the newest versions of junit and jmockit and Oracle JDK 7 in Eclipse. When I try to mock java.net.URL my test won't run.</p>
  
  <p>I have in my code something like:</p>
  
  <pre><code>URL url = new URL("String representing the url.");
  </code></pre>
  
  <p>So I figured in my test I could mock this like so:</p>
  
  <pre><code>@Mocked private URL _url;
  </code></pre>
  
  <p>Since this works for pretty much everything else, I know URL is final but I thought that was okay with JMockit.</p>
  
  <p>When I run a test class with the above mock in eclipse the result is a grey line(as opposed to green or red.) So I'm assuming some kind of initialization problem. The rest of the test or code doesn't seem to matter, no matter what I put that @Mocked line in, this happens.</p>
  
  <p>A workaround would be great, an explanation of what is actually causing this would be even better. Any help is definitely appreciated! Thanks!</p>
  
  <p>Quick example. This actually gives an exception, but I think it is basically doing the same thing I have seen:</p>
  
  <pre><code>package demo;
  
  import java.io.IOException;
  import java.net.HttpURLConnection;
  import java.net.URL;
  
  public class Connecting {
      public boolean connectionattempt() throws IOException {
      URL url = new URL("http://nowhere/");
      HttpURLConnection connection = (HttpURLConnection) url.openConnection();
          if (connection != null) {
              return true;
          }
          else {
              return false;
          }
      }
  }
  </code></pre>
  
  <p>And this test:</p>
  
  <pre><code>package demo;
  
  import static org.junit.Assert.assertEquals;
  
  import java.io.IOException;
  import java.net.HttpURLConnection;
  import java.net.URL;
  
  import org.junit.Test;
  import mockit.Expectations;
  import mockit.Mocked;
  import mockit.Tested;
  
  public class TestConnecting {
      @Mocked URL _url;
      @Mocked HttpURLConnection _connection;
      @Tested Connecting _sut;
  
      @Test
      public void testConnect() throws IOException {
          new Expectations() { {
              _url.openConnection(); result = _connection;
          } };
          assertEquals(true, _sut.connectionattempt());
      }
  }
  </code></pre>
  
  <p>and the stack trace:</p>
  
  <pre><code>java.lang.NoClassDefFoundError: org/eclipse/jdt/internal/junit/runner/TestReferenceFailure
      at org.eclipse.jdt.internal.junit4.runner.JUnit4TestListener.testFailure(JUnit4TestListener.java:91)
      at org.eclipse.jdt.internal.junit4.runner.JUnit4TestListener.testFailure(JUnit4TestListener.java:69)
      at org.junit.runner.notification.RunNotifier$4.notifyListener(RunNotifier.java:139)
      at org.junit.runner.notification.RunNotifier$SafeNotifier.run(RunNotifier.java:61)
      at org.junit.runner.notification.RunNotifier.fireTestFailures(RunNotifier.java:134)
      at org.junit.runner.notification.RunNotifier.fireTestFailure(RunNotifier.java:128)
      at org.junit.internal.runners.model.EachTestNotifier.addFailure(EachTestNotifier.java:23)
      at org.junit.runners.ParentRunner.run(ParentRunner.java:315)
      at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
      at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
  </code></pre>