Class RequestHandlerTestDriver

  • All Implemented Interfaces:
    java.lang.AutoCloseable
    Direct Known Subclasses:
    ProcessingTestDriver

    @Beta
    public class RequestHandlerTestDriver
    extends java.lang.Object
    implements java.lang.AutoCloseable
    A helper for making tests creating jDisc requests and checking their responses.
    Author:
    bratseth
    • Constructor Detail

      • RequestHandlerTestDriver

        public RequestHandlerTestDriver​(com.yahoo.jdisc.handler.RequestHandler handler)
        Creates this with a binding to "http://localhost/*"
      • RequestHandlerTestDriver

        public RequestHandlerTestDriver​(java.lang.String binding,
                                        com.yahoo.jdisc.handler.RequestHandler handler)
    • Method Detail

      • close

        public void close()
        Specified by:
        close in interface java.lang.AutoCloseable
      • jDiscDriver

        public com.yahoo.jdisc.test.TestDriver jDiscDriver()
        Returns the jDisc level driver wrapped by this
      • sendRequest

        public RequestHandlerTestDriver.MockResponseHandler sendRequest​(java.lang.String uri,
                                                                        com.yahoo.jdisc.http.HttpRequest.Method method,
                                                                        java.lang.String body,
                                                                        java.lang.String contentType)
        Send a POST request with defined content type
      • censorDigits

        public java.lang.String censorDigits​(java.lang.String s)
        Replaces all occurrences of 0-9 digits by d's