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)
RenderMachineCommands
say
in interface RenderMachineCommands
textAsParagraph
- A text that may contain html tags like "This is my
bold
text".public final void sayNextSection(String textAsH1)
RenderMachineCommands
sayNextSection
in interface RenderMachineCommands
textAsH1
- A text that may contain html tags like "This is my
headline text".public final void sayRaw(String rawHtml)
RenderMachineCommands
sayRaw
in interface RenderMachineCommands
rawHtml
- 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 RenderMachineCommands
public final <T> void sayAndAssertThat(String message, T actual, org.hamcrest.Matcher<? super T> matcher)
sayAndAssertThat
in interface RenderMachineCommands
public final List<org.apache.http.cookie.Cookie> getCookies()
getCookies
in interface TestBrowser
public final List<org.apache.http.cookie.Cookie> sayAndGetCookies()
sayAndGetCookies
in interface RenderMachineCommands
public final org.apache.http.cookie.Cookie getCookieWithName(String name)
TestBrowser
getCookieWithName
in interface TestBrowser
name
- Name of the cookiepublic final org.apache.http.cookie.Cookie sayAndGetCookieWithName(String name)
sayAndGetCookieWithName
in interface RenderMachineCommands
public final void clearCookies()
TestBrowser
clearCookies
in interface TestBrowser
public final Response makeRequest(Request httpRequest)
TestBrowser
makeRequest
in interface TestBrowser
httpRequest
- The request to performpublic final Response sayAndMakeRequest(Request httpRequest)
sayAndMakeRequest
in interface RenderMachineCommands
public 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.