public abstract class DocTester extends Object implements TestBrowser, RenderMachineCommands
| Modifier and Type | Field and Description |
|---|---|
protected static RenderMachine |
renderMachine |
org.junit.rules.TestRule |
testWatcher |
| Constructor and Description |
|---|
DocTester() |
| Modifier and Type | Method and Description |
|---|---|
void |
clearCookies()
The TestBrowser persists the cookie storage during multiple calls.
|
static void |
finishDocTest() |
List<org.apache.http.cookie.Cookie> |
getCookies() |
org.apache.http.cookie.Cookie |
getCookieWithName(String name)
Get cookie with a specific name.
|
RenderMachine |
getRenderMachine()
You may override this method if you want to supply your own rendering
machine for your class or classes.
|
TestBrowser |
getTestBrowser()
You may override this method if you want to supply your own testbrowser
for your class or classes.
|
void |
initRenderingMachineIfNull() |
Response |
makeRequest(Request httpRequest)
Make calls via this testBrowser.
|
void |
say(String textAsParagraph)
A text that will be wrapped inside a paragraph.
|
<T> void |
sayAndAssertThat(String message,
String reason,
T actual,
org.hamcrest.Matcher<? super T> matcher) |
<T> void |
sayAndAssertThat(String message,
T actual,
org.hamcrest.Matcher<? super T> matcher) |
List<org.apache.http.cookie.Cookie> |
sayAndGetCookies() |
org.apache.http.cookie.Cookie |
sayAndGetCookieWithName(String name) |
Response |
sayAndMakeRequest(Request httpRequest) |
void |
sayNextSection(String textAsH1)
A text that will be wrapped inside a h1.
|
void |
sayRaw(String rawHtml)
If you want to let the renderer render some raw custom html use this
method.
|
void |
setClassNameForDocTesterOutputFile(String name)
Alternative way to set the output file name.
|
void |
setupForTestCaseMethod() |
Url |
testServerUrl()
Convenience method that allows you to write tests with the testbrowser in
a fluent way.
|
public org.junit.rules.TestRule testWatcher
protected static RenderMachine renderMachine
public void setupForTestCaseMethod()
public void initRenderingMachineIfNull()
public static void finishDocTest()
public final void say(String textAsParagraph)
RenderMachineCommandssay in interface RenderMachineCommandstextAsParagraph - A text that may contain html tags like "This is my
bold
text".public final void sayNextSection(String textAsH1)
RenderMachineCommandssayNextSection in interface RenderMachineCommandstextAsH1 - A text that may contain html tags like "This is my
headline text".public final void sayRaw(String rawHtml)
RenderMachineCommandssayRaw in interface RenderMachineCommandsrawHtml - A raw plain html String like "public final <T> void sayAndAssertThat(String message, String reason, T actual, org.hamcrest.Matcher<? super T> matcher)
sayAndAssertThat in interface RenderMachineCommandspublic final <T> void sayAndAssertThat(String message, T actual, org.hamcrest.Matcher<? super T> matcher)
sayAndAssertThat in interface RenderMachineCommandspublic final List<org.apache.http.cookie.Cookie> getCookies()
getCookies in interface TestBrowserpublic final List<org.apache.http.cookie.Cookie> sayAndGetCookies()
sayAndGetCookies in interface RenderMachineCommandspublic final org.apache.http.cookie.Cookie getCookieWithName(String name)
TestBrowsergetCookieWithName in interface TestBrowsername - Name of the cookiepublic final org.apache.http.cookie.Cookie sayAndGetCookieWithName(String name)
sayAndGetCookieWithName in interface RenderMachineCommandspublic final void clearCookies()
TestBrowserclearCookies in interface TestBrowserpublic final Response makeRequest(Request httpRequest)
TestBrowsermakeRequest in interface TestBrowserhttpRequest - The request to performpublic final Response sayAndMakeRequest(Request httpRequest)
sayAndMakeRequest in interface RenderMachineCommandspublic TestBrowser getTestBrowser()
public RenderMachine getRenderMachine()
public Url testServerUrl()
sayAndMakeRequest(
Request
.GET()
.url(testServerUrl().path("search").addQueryParameter("q", "toys")));
public void setClassNameForDocTesterOutputFile(String name)
name - alternative name of output fileCopyright © 2015. All Rights Reserved.