Search in sources :

Example 1 with AbstractWebScript

use of org.springframework.extensions.webscripts.AbstractWebScript in project records-management by Alfresco.

the class BaseWebScriptUnitTest method executeWebScript.

/**
 * Execute web script and return result as a string.
 *
 * @param parameters            map of all parameter values
 * @return {@link String}       result of web script
 */
protected String executeWebScript(Map<String, String> parameters, String content) throws Exception {
    AbstractWebScript webScript = getWebScript();
    String template = getWebScriptTemplate();
    // initialise webscript
    webScript.init(getMockedContainer(template), getMockedDescription());
    // execute webscript
    WebScriptResponse mockedResponse = getMockedWebScriptResponse();
    webScript.execute(getMockedWebScriptRequest(webScript, parameters, content), mockedResponse);
    // return results
    return mockedResponse.getWriter().toString();
}
Also used : AbstractWebScript(org.springframework.extensions.webscripts.AbstractWebScript) WebScriptResponse(org.springframework.extensions.webscripts.WebScriptResponse) Matchers.anyString(org.mockito.Matchers.anyString)

Aggregations

Matchers.anyString (org.mockito.Matchers.anyString)1 AbstractWebScript (org.springframework.extensions.webscripts.AbstractWebScript)1 WebScriptResponse (org.springframework.extensions.webscripts.WebScriptResponse)1