Class StrutsRestTestCase<T>


public class StrutsRestTestCase<T> extends StrutsJUnit4TestCase<T>
  • Constructor Details

    • StrutsRestTestCase

      public StrutsRestTestCase()
  • Method Details

    • executeAction

      protected String executeAction(String uri) throws jakarta.servlet.ServletException, UnsupportedEncodingException
      Executes an action and returns it's output (not the result returned from execute()), but the actual output that would be written to the response. For this to work the configured result for the action needs to be JSON, FreeMarker, or Velocity (JSPs can be used with the Embedded JSP plugin)
      Overrides:
      executeAction in class StrutsJUnit4TestCase<T>
      Parameters:
      uri - action uri to test
      Returns:
      execution result
      Throws:
      jakarta.servlet.ServletException - in case of servlet errors
      UnsupportedEncodingException - in case of unsupported encoding
    • executeAction

      protected String executeAction(String httpMethod, String uri) throws jakarta.servlet.ServletException, UnsupportedEncodingException
      Executes an action and returns it's output (not the result returned from execute()), but the actual output that would be written to the response. For this to work the configured result for the action needs to be JSON, FreeMarker, or Velocity (JSPs can be used with the Embedded JSP plugin)
      Parameters:
      httpMethod - HTTP method of request like GET, POST, PUT or DELETE
      uri - action uri to test
      Returns:
      execution result
      Throws:
      jakarta.servlet.ServletException - in case of servlet errors
      UnsupportedEncodingException - in case of unsupported encoding
    • getActionProxy

      protected ActionProxy getActionProxy(String uri)
      Creates an action proxy for a request, and sets parameters of the ActionInvocation to the passed parameters. Make sure to set the request parameters in the protected "request" object before calling this method.
      Overrides:
      getActionProxy in class StrutsJUnit4TestCase<T>
      Parameters:
      uri - request uri to test
      Returns:
      action proxy found for this request uri
    • getActionProxy

      protected ActionProxy getActionProxy(String httpMethod, String uri)
      Creates an action proxy for a request, and sets parameters of the ActionInvocation to the passed parameters. Make sure to set the request parameters in the protected "request" object before calling this method.
      Parameters:
      httpMethod - HTTP method of request like GET, POST, PUT or DELETE
      uri - request uri to test
      Returns:
      action proxy found for this request uri
    • initServletMockObjects

      protected void initServletMockObjects()
      Overrides:
      initServletMockObjects in class StrutsJUnit4TestCase<T>