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")));
}
});
Monday, October 08, 2007
Java Mock Objects tip
Labels:
hacking,
java,
mockobjects
Subscribe to:
Post Comments (Atom)
1 comment:
you have a nice site.thanks for sharing this site. various kinds of ebooks are available here
http://feboook.blogspot.com
Post a Comment