Discovered while using JMock, but I would imagine it's also good for EasyMock, RMock, ...
checking(new Expectations() {
{
one(httpServletRequest).getParameter("c");
will(returnValue("-2"));
one(httpServletRequest).getParameterNames();
// StringTokenizer implements Enumeration. A bit cheeky!
will(returnValue(new StringTokenizer("c")));
}
});
Showing posts with label mockobjects. Show all posts
Showing posts with label mockobjects. Show all posts
Monday, October 08, 2007
Java Mock Objects tip
Subscribe to:
Posts (Atom)