Description

OpenCms Unittest Helper

OpenCms is a Content Management System that is based on Open Source Software. Complex Intranet and Internet websites can be quickly and cost-effectively created, maintained and managed.

Features

  • Log4jModifier: Useful to validate correct logging-Messages.
  • ServletRequestFactory: Create a HttpServletRequest Mock Object with Attributes, Parameters and Session Handling.
  • CmsFlexControllerFactory: Create a CmsFlexController Mock Object.
  • CmsJspActionElementFactory: Create a CmsJspActionElement Mock Object.

for more Information see JavaDoc.

Example Usage

        ...
        CmsJspActionElement jspActionElement =
                CmsJspActionElementFactory.createCmsJspActionElement("/testPage.xml", "Admin", "admin");
        HttpServletRequest request = jspActionElement.getRequest();
        HttpServletResponse response = jspActionElement.getResponse();
        CmsFlexController flexController = CmsFlexController.getController(request);
        assertEquals("/testPage.xml", flexController.getCmsObject().getRequestContext().getUri());
        ...