public class TabbedFormTest extends TestCase {
public void testGetHeadElements() {
// TabbedForm uses Velocity to render its template. In this test we start a
// MockContainer which also configures Velocity
MockContainer container = new MockContainer("web");
container.start();
// MockContext is created when a container tests a page. There
// is no page to test so we manually create a MockContext
// and reuse the Mock Servlet objects created in the container.
MockContext.initContext(container.getServletConfig(),
container.getRequest(), container.getResponse(), container.getClickServlet());
TabbedForm form = new TabbedForm("form");
assertTrue(form.toString().indexOf("<form") > 0);
assertTrue(form.getHeadElements().toString().indexOf("/control.js") > 0);
assertTrue(form.getHeadElements().toString().indexOf("/control.css") > 0);
assertTrue(form.getHeadElements().toString().indexOf("/extras-control.css") > 0);
container.stop();
}