title: Why is my Mockito-based unit test unable to run in Eclipse?
body: <p>I have a Maven-managed project that uses Mockito mocking in its unit tests.  I can run all the tests within a Maven build, and they run without error (and pass!).  However, if I right-click a single test function, and choose "Run As -> JUnit Test", I get an exception <code>java.lang.NoSuchMethodError: org.mockito.Mockito.doAnswer(Lorg/mockito/stubbing/Answer;)Lorg/mockito/stubbing/Stubber;</code>.  Of course, the "missing" method is there if I look at the sources, and like I said the tests compile and run from the command line.</p>
  
  <p>Best I can think of is if Eclipse is trying to "help" me by providing an outdated Mockito artifact (I'm using 1.8.5 in my Maven dependencies) for the JUnit plugin, akin to how the Maven plugin can stick you with an oddball version of the Maven runtime for certain tasks.</p>
  
  <p>Is this the problem?  Is it something else?  Can I fix this?</p>
  
  <p>ETA: Apparently this may relate to a <a href="http://code.google.com/p/mockito/issues/detail?id=106" rel="nofollow">known issue</a>.  There's a good chance that it stems from having multiple versions of Mockito in my classpath (thanks, Maven :-/ ).  I seem to have my house in order -- Eclipse can run the tests now -- but unfortunately the bug has bitten my Hudson.  I have to track down how to remove the old JAR from the classpath there as well.</p>