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.TestingFrameworkException
public void setDesiredResponse(Map<String,Object> desiredResponse) throws TestingFrameworkException
desiredResponse
- the desired response.TestingFrameworkException
public void assertNothingThrown() throws TestingFrameworkException
TestingFrameworkException
public 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 HttpRequestHandler
request
- 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–2022 The Apache Software Foundation. All rights reserved.