public class TestingFrameworkRequestHandler extends Object implements HttpRequestHandler
| Modifier and Type | Field and Description |
|---|---|
protected Map<String,Object> |
desiredResponse |
protected Map<String,Object> |
requestExpectations |
protected Throwable |
thrown |
| Constructor and Description |
|---|
TestingFrameworkRequestHandler() |
| Modifier and Type | Method and Description |
|---|---|
void |
assertNothingThrown()
After the handler returns the response, any exception or failed assertion will be
in the member called "thrown".
|
void |
handle(ClassicHttpRequest request,
ClassicHttpResponse response,
HttpContext context)
Checks the HTTP request against the requestExpectations that it was previously given.
|
void |
setDesiredResponse(Map<String,Object> desiredResponse)
Sets the desired response.
|
void |
setRequestExpectations(Map<String,Object> requestExpectations)
Sets the request expectations.
|
protected Throwable thrown
public void setRequestExpectations(Map<String,Object> requestExpectations) throws TestingFrameworkException
requestExpectations - the expected values of the request.TestingFrameworkExceptionpublic void setDesiredResponse(Map<String,Object> desiredResponse) throws TestingFrameworkException
desiredResponse - the desired response.TestingFrameworkExceptionpublic void assertNothingThrown()
throws TestingFrameworkException
TestingFrameworkExceptionpublic void handle(ClassicHttpRequest request, ClassicHttpResponse response, HttpContext context) throws HttpException, IOException
Checks the HTTP request against the requestExpectations that it was previously given. If there is a mismatch, an exception will be saved in the "thrown" member.
Also, a response will be returned that matches the desiredResponse.
handle in interface HttpRequestHandlerrequest - the HTTP request.response - the HTTP response.context - the HTTP execution context.HttpException - in case of HTTP protocol violation or a processing
problem.IOException - in case of an I/O error.Copyright © 2005–2021 The Apache Software Foundation. All rights reserved.