Package org.apache.wicket.util.tester
Class WicketTestCase
- java.lang.Object
-
- org.apache.wicket.util.tester.WicketTestCase
-
public abstract class WicketTestCase extends java.lang.ObjectBase class for tests which require comparing wicket response with a file.To create/replace the expected result file with the new content, define the system property like -Dwicket.replace.expected.results=true
-
-
Field Summary
Fields Modifier and Type Field Description WicketTestertester
-
Constructor Summary
Constructors Constructor Description WicketTestCase()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcommonAfter()voidcommonBefore()protected voidcompareMarkupWithFile(IMarkupFragment markup, java.lang.String filename, java.lang.Class<?> scopeClass)Compare the markup provided with the file contentprotected voidcompareMarkupWithString(IMarkupFragment markup, java.lang.String testMarkup)Compare the markup provided with the Stringprotected voidexecuteBehavior(AbstractAjaxBehavior behavior, java.lang.String filename)protected voidexecuteListener(Component component, java.lang.String filename)protected <T extends Page>
voidexecuteTest(java.lang.Class<T> pageClass, java.lang.String filename)Use-Dwicket.replace.expected.results=trueto automatically replace the expected output file.protected <T extends Page>
voidexecuteTest(java.lang.Class<T> pageClass, org.apache.wicket.request.mapper.parameter.PageParameters parameters, java.lang.String filename)Use-Dwicket.replace.expected.results=trueto automatically replace the expected output file.protected voidexecuteTest(Page page, java.lang.String filename)Use-Dwicket.replace.expected.results=trueto automatically replace the expected output file.java.lang.StringgetBasedir()Returns the current Maven build directory taken from the basedir system property, or null if not setprotected WebApplicationnewApplication()protected WicketTesternewWicketTester(WebApplication app)In case you need to subclass WicketTester and want to be independent on possible changes in setUp().
-
-
-
Field Detail
-
tester
public WicketTester tester
-
-
Method Detail
-
commonBefore
@BeforeEach public void commonBefore()
-
newApplication
protected WebApplication newApplication()
- Returns:
- the application that should be used for the test
-
newWicketTester
protected WicketTester newWicketTester(WebApplication app)
In case you need to subclass WicketTester and want to be independent on possible changes in setUp().- Parameters:
app-- Returns:
- WIcketTester
-
commonAfter
@AfterEach public void commonAfter()
-
executeTest
protected <T extends Page> void executeTest(java.lang.Class<T> pageClass, java.lang.String filename) throws java.lang.Exception
Use-Dwicket.replace.expected.results=trueto automatically replace the expected output file.- Type Parameters:
T-- Parameters:
pageClass-filename-- Throws:
java.lang.Exception
-
executeTest
protected void executeTest(Page page, java.lang.String filename) throws java.lang.Exception
Use-Dwicket.replace.expected.results=trueto automatically replace the expected output file.- Parameters:
page-filename-- Throws:
java.lang.Exception
-
executeTest
protected <T extends Page> void executeTest(java.lang.Class<T> pageClass, org.apache.wicket.request.mapper.parameter.PageParameters parameters, java.lang.String filename) throws java.lang.Exception
Use-Dwicket.replace.expected.results=trueto automatically replace the expected output file.- Type Parameters:
T-- Parameters:
pageClass-parameters-filename-- Throws:
java.lang.Exception
-
executeListener
protected void executeListener(Component component, java.lang.String filename) throws java.lang.Exception
- Parameters:
component-filename-- Throws:
java.lang.Exception
-
executeBehavior
protected void executeBehavior(AbstractAjaxBehavior behavior, java.lang.String filename) throws java.lang.Exception
- Parameters:
behavior-filename-- Throws:
java.lang.Exception
-
getBasedir
public java.lang.String getBasedir()
Returns the current Maven build directory taken from the basedir system property, or null if not set- Returns:
- path with a trailing slash
-
compareMarkupWithFile
protected final void compareMarkupWithFile(IMarkupFragment markup, java.lang.String filename, java.lang.Class<?> scopeClass) throws java.io.IOException
Compare the markup provided with the file content- Parameters:
markup-filename-scopeClass-- Throws:
java.io.IOException
-
compareMarkupWithString
protected final void compareMarkupWithString(IMarkupFragment markup, java.lang.String testMarkup)
Compare the markup provided with the String- Parameters:
markup-testMarkup-
-
-