public static final class RqFallback.Fake extends Object implements RqFallback
Use this class in unit tests, when you need to create a fake version of a request with an exception inside. For example:
new TkIndex().act( new RqFallback.Fake("/(.*)", "/hello") );
RqFallback.Fake
Constructor and Description |
---|
Fake(int code)
Ctor.
|
Fake(int code,
Throwable error)
Ctor.
|
Fake(Request req,
int code,
Throwable error)
Ctor.
|
Modifier and Type | Method and Description |
---|---|
InputStream |
body()
HTTP request body.
|
int |
code()
Get HTTP status code suggested.
|
Iterable<String> |
head()
All lines above the body.
|
Throwable |
throwable()
Get throwable that occurred.
|
public Fake(int code)
code
- HTTP status codepublic Fake(int code, Throwable error)
code
- HTTP status codeerror
- Exceptionpublic int code()
RqFallback
code
in interface RqFallback
public Throwable throwable()
RqFallback
throwable
in interface RqFallback
public Iterable<String> head() throws IOException
Request
head
in interface Request
IOException
- If something goes wrongpublic InputStream body() throws IOException
Request
body
in interface Request
IOException
- If something goes wrongCopyright © 2015–2018 Take. All rights reserved.