Mockrunner umí pomocí mock-objektů testovat JDBC, webové (servletové) aplikace i EJB.
public class RedirectServletTest extends BasicServletTestCaseAdapter {
protected void setUp() throws Exception {
super.setUp();
createServlet(RedirectServlet.class);
}
public void testServletOutputAsXML() throws Exception {
addRequestParameter("redirecturl", "http://www.mockrunner.com");
doPost();
Element root = getOutputAsJDOMDocument().getRootElement();
assertEquals("html", root.getName());
Element head = root.getChild("head");
Element meta = head.getChild("meta");
assertEquals("refresh", meta.getAttributeValue("http-equiv"));
assertEquals("0;URL=http://www.mockrunner.com",
meta.getAttributeValue("content"));
}
}