|
From: Steve F. <st...@m3...> - 2003-08-17 22:04:08
|
Tony Obermeit wrote:
> I've used the j2ee v1.2 MockHttpServletRequest and added code to the
> [..]
> that had methods, if the method you wanted wasn't implemented, you added
> an implementation.
exactly!
> Now I'm trying to use the latest j2ee mock objects
> (mockobjects-jdk1.4-j2ee1.3-0.09.jar) which require the use of Dynamic
> Mock objects. I've followed the documentation to be able to test the
> getParameter method but have no idea of how to set up the
> getParameterNames method.
I woudl guess that you use expectAndReturn("getParameterNames",
new Object[] {"one", "two"});
> I cannot find any documentation or examples of dynamic mock objects that
> goes beyond the simple example above and am subsequently stuck. Any
> help is appreciated, otherwise I'll go back to the j2ee 1.2 mock
> library, I was really hoping to move forward with the new dynamic
> approach but the lack of examples and my inexperience with dynamic mocks
> is holding me up.
it's still a work in progress, which is why we haven't packaged it up
yet. The basics are quite simple, it tries to match a method call and
return a value if appropriate. If an expectation is set it will check
that, otherwise it'll just match. The rest is a rather messy
implementation that still needs cleanup.
S.
|