|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.github.kristofa.test.http.file.FileHttpResponseProvider
public class FileHttpResponseProvider
HttpResponseProvider that is able to serve responses for requests/responses previously saved by
HttpRequestResponseFileLogger.
It supports submitting same request multiple times with different return result.
It reads all http requests on construction and keeps them in memory. It does not keep responses in memory. They are read from disk on request and not cached.
HttpRequestResponseFileLogger,
LoggingHttpProxy| Constructor Summary | |
|---|---|
FileHttpResponseProvider(String directory,
String fileName)
Creates a new instance. |
|
FileHttpResponseProvider(String directory,
String fileName,
com.github.kristofa.test.http.file.HttpRequestFileReader requestFileReader,
HttpResponseFileReader responseFileReader)
Creates a new instance. |
|
| Method Summary | |
|---|---|
HttpResponse |
getResponse(HttpRequest request)
Gets expected response for given request. |
void |
verify()
Should be executed when all requests have been submitted. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public FileHttpResponseProvider(String directory,
String fileName)
directory - Directory from which to read files.fileName - Base file name. Should not contain extension. Will be suffixed with sequence number and .txt
extension. Should be same as used in HttpRequestResponseFileLogger.
public FileHttpResponseProvider(String directory,
String fileName,
com.github.kristofa.test.http.file.HttpRequestFileReader requestFileReader,
HttpResponseFileReader responseFileReader)
directory - Directory from which to read files.fileName - Base file name. Should not contain extension. Will be suffixed with sequence number and .txt
extension. Should be same as used in HttpRequestResponseFileLogger.requestFileReader - HTTP request file reader.responseFileReader - HTTP response file reader.| Method Detail |
|---|
public HttpResponse getResponse(HttpRequest request)
getResponse in interface HttpResponseProviderrequest - HttpRequest.
null in case we don't know given request.
public void verify()
throws UnsatisfiedExpectationException
verify in interface HttpResponseProviderUnsatisfiedExpectationException - In case expectation were not as expected. See
UnsatisfiedExpectationException.getMissingHttpRequests() and
UnsatisfiedExpectationException.getUnexpectedHttpRequests() to get missing and unexpected
requests.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||