Class Requestor

java.lang.Object
org.gwizard.test.Requestor

@Singleton public class Requestor extends Object

In tests we often need to model the idea of a "request". Webapps have requests, rpc servers have requests, queue workers have requests, etc. This class manages that behavior for you. In particular, it allows us to register a stack of "filters" which execute around requests. The obvious application here is adding servlet Filters to simulated webapp requests.

Works in concert with the GuiceExtension.

  • Constructor Details

    • Requestor

      public Requestor()
  • Method Details

    • addFilter

      public void addFilter(RequestFilter filter)
    • req

      public <T> T req(Callable<T> callable) throws Exception
      Execute within the context of a request
      Throws:
      Exception
    • req

      public final void req(Runnable runnable) throws Exception
      Execute within the context of a request; just a wrapper for the Callable version
      Throws:
      Exception