public class TapestryTester
extends org.apache.tapestry5.test.PageTester
Constructor and Description |
---|
TapestryTester(String appPackage,
Class<?>... moduleClasses) |
TapestryTester(String appPackage,
String appName,
String contextPath,
Class<?>... moduleClasses) |
Modifier and Type | Method and Description |
---|---|
<T> T |
autobuild(Class<T> clazz)
Autobuilds a class by finding the public constructor with the most parameters.
|
void |
collectForComponentsFrom(Object object)
Searches for fields in the object annotated with
ForComponents and registers them in
the component injection pipeline so that they will be the preferred objects to inject into
components and pages during this test. |
void |
endTest()
Call this method to mark the end of a test (for example in the test's tearDown() method).
|
<T> T |
getService(String id,
Class<T> serviceInterface)
Obtains a service via its unique service id.
|
void |
injectInto(Object object)
Process the
Inject annotation on fields in the given object - those fields will be
given values found in this tester's IOC container. |
org.apache.tapestry5.internal.test.TestableResponse |
renderResponse(String path)
Processes a request for the specified path and returns the response generated.
|
clickLink, clickLinkAndReturnResponse, clickSubmit, clickSubmitAndReturnResponse, getRegistry, getService, provideExtraModuleDefs, renderPage, renderPageAndReturnResponse, setPreferedLanguage, shutdown, submitForm, submitFormAndReturnResponse
public TapestryTester(String appPackage, String appName, String contextPath, Class<?>... moduleClasses)
public <T> T getService(String id, Class<T> serviceInterface)
T
- id
- unique Service id used to locate the service object (may contain symbols, which
will be expanded), case is ignored (not null)serviceInterface
- the interface implemented by the service (or an interface extended by the service
interface) (not null)RuntimeException
- if the service is not defined, or if an error occurs instantiating itpublic <T> T autobuild(Class<T> clazz)
T
- clazz
- the type of object to instantiate (not null)RuntimeException
- if the autobuild failsMasterObjectProvider
public void endTest()
TestifyConstants.PERTEST
scope.public void injectInto(Object object)
Inject
annotation on fields in the given object - those fields will be
given values found in this tester's IOC container. Use Service
on the field as well
if you need to find a service by id.object
- the object to process (not null)public void collectForComponentsFrom(Object object)
ForComponents
and registers them in
the component injection pipeline so that they will be the preferred objects to inject into
components and pages during this test. These objects are removed from the pipeline
when endTest()
is called.object
- the object to process (not null)public org.apache.tapestry5.internal.test.TestableResponse renderResponse(String path)
PageTester.renderPage(String)
is what you want. Note that
unlike PageTester.renderPage(String)
, this does not follow redirects - instead the redirect response
is returned.path
- the path for the request; must begin with a "/" character (not null)Copyright © 2009-2012. All Rights Reserved.