I'll answer my own concern. I was lost in the Eclipse editor "folding"
of the "import" statements and didn't see that I had the wrong "import"
for EasyMock. Namely org.easymock.EasyMock instead of
org.easymock.classextension.EasyMock. I must have picked the wrong one
up from Ctrl-Shift-M. And not having enough coffee.
Cheers,
-Polar
Polar Humenn wrote:
I have a question about EasyMock.
I'm trying to get (some of) the EasyMock'd tests to work using
Eclipse. After substantial wrangling, I find that there is an
easymock-2.2.jar and an easymockclassextension-2.2.1.jar!
This threw me for a loop because every time I tried something like:
control.createMock(HttpURLConnection.class)
it would die with "java.net.HttpURLConnection is not an interface"
coming from this call.
I find out that the static class EasyMock is shadowed by
easymockclassextension-2.2.1.jar.
I'm using the Maven2 Eclipse plugin and it puts the easymock-2.2.jar
in front of the easymockclassextension-2.2.1.jar, and therefore, I get
the EasyMock from easymock-2.2.jar, and thus the error.
Is the Maven2 plug-in doing the wrong thing in setting up the classpath?
Or, with Maven proper, are we just getting lucky?
Is there an enforced ordering for maven retrieval of jar files?
Cheers,
-Polar