Package org.apache.tapestry5.test
Class TapestryTestCase
- java.lang.Object
-
- org.testng.Assert
-
- org.apache.tapestry5.test.ioc.TestUtils
-
- org.apache.tapestry5.test.ioc.TestBase
-
- org.apache.tapestry5.ioc.test.IOCTestCase
-
- org.apache.tapestry5.test.TapestryTestCase
-
public abstract class TapestryTestCase extends IOCTestCase
Base test case that adds a number of convenience factory and training methods for the public interfaces of Tapestry.
-
-
Constructor Summary
Constructors Constructor Description TapestryTestCase()
-
Method Summary
-
Methods inherited from class org.apache.tapestry5.ioc.test.IOCTestCase
buildRegistry, findMethod, findMethod, findMethod, join, mockAdvisorDef, mockAdvisorDef2, mockAnnotationProvider, mockClassPropertyAdapter, mockConfiguration, mockContributionDef, mockDecoratorDef, mockDecoratorDef2, mockLocation, mockLogger, mockMappedConfiguration, mockMasterObjectProvider, mockMessageFormatter, mockMessages, mockModuleDef, mockModuleDef2, mockObjectCreator, mockObjectLocator, mockObjectProvider, mockOrderedConfiguration, mockPerthreadManager, mockPropertyAccess, mockPropertyAdapter, mockResource, mockRunnable, mockServiceBuilderResources, mockServiceBuilderResources, mockServiceDecorator, mockServiceDef, mockServiceResources, mockServiceResources, mockSymbolSource, mockThreadLocale, mockTypeCoercer, newIntermediateType, stub_contains, stub_isDebugEnabled, touch, train_autobuild, train_coerce, train_contains, train_createInterceptor, train_createObject, train_expandSymbols, train_expandSymbols, train_forFile, train_forLocale, train_format, train_get, train_getAnnotation, train_getLocale, train_getLogger, train_getLogger, train_getMessageFormatter, train_getPath, train_getService, train_getService, train_getServiceId, train_getServiceId, train_getServiceInterface, train_getServiceInterface, train_getTracker, train_isDebugEnabled, train_isTraceEnabled, train_matches, train_matches, train_provide, train_toURL, train_value, train_valueForSymbol
-
Methods inherited from class org.apache.tapestry5.test.ioc.TestBase
discardMockControl, expect, getMocksControl, newCapture, newMock, replay, setAnswer, setThrowable, verify
-
Methods inherited from class org.apache.tapestry5.test.ioc.TestUtils
assertArraysEqual, assertListsEquals, assertListsEquals, assertMessageContains, create, get, set, showLists, unreachable
-
Methods inherited from class org.testng.Assert
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEqualsNoOrder, assertEqualsNoOrder, assertFalse, assertFalse, assertNotEquals, assertNotEquals, assertNotEquals, assertNotEquals, assertNotEquals, assertNotEquals, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, fail, fail, fail
-
-
-
-
Constructor Detail
-
TapestryTestCase
public TapestryTestCase()
-
-
Method Detail
-
createMarkupWriter
protected final MarkupWriter createMarkupWriter()
Creates a new markup writer instance (not a markup writer mock). Output can be directed at the writer, which uses the default (HTML) markup model. The writer's toString() value represents all the collected markup in the writer.
-
mockApplicationStateCreator
protected final ApplicationStateCreator mockApplicationStateCreator()
-
mockApplicationStatePersistenceStrategy
protected final ApplicationStatePersistenceStrategy mockApplicationStatePersistenceStrategy()
-
mockApplicationStatePersistenceStrategySource
protected final ApplicationStatePersistenceStrategySource mockApplicationStatePersistenceStrategySource()
-
mockAssetFactory
protected final AssetFactory mockAssetFactory()
-
mockAssetSource
protected final AssetSource mockAssetSource()
-
mockBinding
protected final Binding mockBinding()
-
mockBindingFactory
protected final BindingFactory mockBindingFactory()
-
mockBindingSource
protected final BindingSource mockBindingSource()
-
mockClasspathAssetAliasManager
protected final ClasspathAssetAliasManager mockClasspathAssetAliasManager()
-
mockComponent
protected final Component mockComponent()
-
mockComponentClassResolver
protected final ComponentClassResolver mockComponentClassResolver()
-
mockComponentEventHandler
protected final ComponentEventCallback mockComponentEventHandler()
-
mockComponentModel
protected final ComponentModel mockComponentModel()
-
mockComponentResources
protected final ComponentResources mockComponentResources()
-
mockContext
protected final Context mockContext()
-
mockEnvironment
protected final Environment mockEnvironment()
-
mockHtml5Support
protected final Html5Support mockHtml5Support()
-
mockFieldValidator
protected final FieldValidator mockFieldValidator()
-
mockFieldValidatorSource
protected FieldValidatorSource mockFieldValidatorSource()
-
mockFieldWithLabel
protected final Field mockFieldWithLabel(String label)
-
mockHeartbeat
protected final Heartbeat mockHeartbeat()
-
mockHttpServletRequest
protected final HttpServletRequest mockHttpServletRequest()
-
mockHttpServletResponse
protected final HttpServletResponse mockHttpServletResponse()
-
mockHttpSession
protected final HttpSession mockHttpSession()
-
mockInject
protected final Inject mockInject()
-
mockMarkupWriter
protected final MarkupWriter mockMarkupWriter()
-
mockMutableComponentModel
protected final MutableComponentModel mockMutableComponentModel()
-
mockParameterModel
protected final ParameterModel mockParameterModel()
-
mockPropertyConduit
protected final PropertyConduit mockPropertyConduit()
-
mockPropertyModel
protected final PropertyModel mockPropertyModel()
-
mockRequest
protected final Request mockRequest()
-
mockRequestHandler
protected final RequestHandler mockRequestHandler()
-
mockResponse
protected final Response mockResponse()
-
mockSession
protected final Session mockSession()
-
mockTranslator
protected final Translator mockTranslator()
-
mockValidationConstraintGenerator
protected final ValidationConstraintGenerator mockValidationConstraintGenerator()
-
mockValidationTracker
protected final ValidationTracker mockValidationTracker()
-
mockValidator
protected final Validator mockValidator()
-
train_buildConstraints
protected final void train_buildConstraints(ValidationConstraintGenerator generator, Class propertyType, AnnotationProvider provider, String... constraints)
-
train_create
protected final <T> void train_create(ApplicationStateCreator<T> creator, T aso)
-
train_createAsset
protected final void train_createAsset(AssetFactory factory, Resource resource, Asset asset)
-
train_createValidator
protected final void train_createValidator(FieldValidatorSource source, Field field, String validatorType, String constraintValue, String overrideId, Messages overrideMessages, Locale locale, FieldValidator result)
-
train_encodeRedirectURL
protected final void train_encodeRedirectURL(Response response, String URI, String encoded)
-
train_encodeURL
protected final void train_encodeURL(Response response, String inputURL, String outputURL)
-
train_exists
protected final <T> void train_exists(ApplicationStatePersistenceStrategy strategy, Class<T> asoClass, boolean exists)
-
train_getAsset
protected final void train_getAsset(AssetSource source, Resource root, String path, Locale locale, Asset asset)
-
train_generateChecksum
protected final void train_generateChecksum(ResourceDigestGenerator generator, URL url, String digest)
-
train_get
protected final <T> void train_get(ApplicationStatePersistenceStrategy strategy, Class<T> asoClass, ApplicationStateCreator<T> creator, T aso)
-
train_get
protected final void train_get(ApplicationStatePersistenceStrategySource source, String strategyName, ApplicationStatePersistenceStrategy strategy)
-
train_getIfExists
protected final <T> void train_getIfExists(ApplicationStatePersistenceStrategy strategy, Class<T> asoClass, T aso)
-
train_getAttribute
protected void train_getAttribute(HttpSession session, String attributeName, Object value)
-
train_getAttribute
protected final void train_getAttribute(Session session, String name, Object attribute)
-
train_getAttributeNames
protected final void train_getAttributeNames(Session session, String prefix, String... names)
-
train_getBaseResource
protected final void train_getBaseResource(ComponentModel model, Resource resource)
-
train_getClasspathAsset
protected final void train_getClasspathAsset(AssetSource source, String path, Asset asset)
-
train_getClasspathAsset
protected final void train_getClasspathAsset(AssetSource source, String path, Locale locale, Asset asset)
-
train_getCompleteId
protected final void train_getCompleteId(ComponentResourcesCommon resources, String completeId)
-
train_getComponent
protected final void train_getComponent(ComponentResources resources, Component component)
-
train_getComponentClassName
protected final void train_getComponentClassName(ComponentModel model, String className)
-
train_getComponentResources
protected final void train_getComponentResources(Component component, ComponentResources resources)
-
train_getConduit
protected final void train_getConduit(PropertyModel model, PropertyConduit conduit)
-
train_getConstraintType
protected <C,T> void train_getConstraintType(Validator<C,T> validator, Class<C> constraintType)
-
train_getContainer
protected final void train_getContainer(ComponentResources resources, Component container)
-
train_getContainerMessages
protected final void train_getContainerMessages(ComponentResources resources, Messages containerMessages)
-
train_getContainerResources
protected final void train_getContainerResources(ComponentResources resources, ComponentResources containerResources)
-
train_getDateHeader
protected final void train_getDateHeader(Request request, String name, long value)
-
train_getFieldPersistenceStrategy
protected final void train_getFieldPersistenceStrategy(ComponentModel model, String fieldName, String fieldStrategy)
-
train_getId
protected final void train_getId(ComponentResources resources, String id)
-
train_getLabel
protected final void train_getLabel(Field field, String label)
-
train_getLocale
protected final void train_getLocale(ComponentResourcesCommon resources, Locale locale)
-
train_getLocale
protected final void train_getLocale(Request request, Locale locale)
-
train_getMessageKey
protected void train_getMessageKey(Validator validator, String messageKey)
-
train_getMessages
protected final void train_getMessages(ComponentResources resources, Messages messages)
-
train_getMeta
protected final void train_getMeta(ComponentModel model, String key, String value)
-
train_getOutputStream
protected final void train_getOutputStream(HttpServletResponse response, ServletOutputStream stream)
-
train_getPage
protected final void train_getPage(ComponentResources resources, Component page)
-
train_getParameterModel
protected final void train_getParameterModel(ComponentModel model, String parameterName, ParameterModel parameterModel)
-
train_getParameterNames
protected final void train_getParameterNames(ComponentModel model, String... names)
-
train_getParentModel
protected final void train_getParentModel(ComponentModel model, ComponentModel parentModel)
-
train_getPath
protected final void train_getPath(Request request, String path)
-
train_getPersistentFieldNames
protected final void train_getPersistentFieldNames(ComponentModel model, String... names)
-
train_getRootResource
protected final void train_getRootResource(AssetFactory factory, Resource rootResource)
-
train_getSession
protected final void train_getSession(HttpServletRequest request, boolean create, HttpSession session)
-
train_getSession
protected void train_getSession(Request request, boolean create, Session session)
-
train_getSupportsInformalParameters
protected final void train_getSupportsInformalParameters(ComponentModel model, boolean supports)
-
train_getValueType
protected final void train_getValueType(Validator validator, Class valueType)
-
train_handleResult
protected final void train_handleResult(ComponentEventCallback handler, Object result, boolean abort)
-
train_inError
protected final void train_inError(ValidationTracker tracker, Field field, boolean inError)
-
train_isRequired
protected final void train_isRequired(Validator validator, boolean isRequired)
-
train_isInvariant
protected final void train_isInvariant(Binding binding, boolean isInvariant)
-
train_isRequired
protected final void train_isRequired(ParameterModel model, boolean isRequired)
-
train_isRootClass
protected final void train_isRootClass(MutableComponentModel model, boolean isRootClass)
-
train_name
protected final void train_name(Parameter parameter, String name)
-
train_newBinding
protected final void train_newBinding(BindingFactory factory, String description, ComponentResources container, ComponentResources component, String expression, Location l, Binding binding)
-
train_newBinding
protected void train_newBinding(BindingSource bindingSource, String description, ComponentResources componentResources, String defaultBindingPrefix, String expression, Binding binding)
-
train_peek
protected final <T> void train_peek(Environment env, Class<T> type, T value)
-
train_peekRequired
protected final <T> void train_peekRequired(Environment env, Class<T> type, T value)
-
train_renderInformalParameters
protected final void train_renderInformalParameters(ComponentResources resources, MarkupWriter writer, Object... informals)
-
train_service
protected final void train_service(RequestHandler handler, Request request, Response response, boolean result) throws IOException
- Throws:
IOException
-
train_setContentLength
protected final void train_setContentLength(HttpServletResponse response, int length)
-
train_setContentType
protected final void train_setContentType(HttpServletResponse response, String contentType)
-
train_setDateHeader
protected final void train_setDateHeader(HttpServletResponse response, String headerName, long date)
-
train_toClientURL
protected final void train_toClientURL(Asset asset, String URL)
Deprecated.Deprecated in 5.4 with no replacement.
-
train_toRedirectURI
protected final void train_toRedirectURI(Link link, String URI)
-
train_value
protected final void train_value(Id annotation, String value)
-
train_value
protected final void train_value(Path annotation, String value)
-
train_getBoundType
protected final void train_getBoundType(ComponentResources resources, String parameterName, Class type)
-
mockBeanModel
protected final BeanModel mockBeanModel()
-
mockBeanModelSource
protected final BeanModelSource mockBeanModelSource()
-
train_getLocation
public final void train_getLocation(Locatable locatable, Location location)
-
train_getResource
public final void train_getResource(Location location, Resource resource)
-
train_getLine
public final void train_getLine(Location location, int line)
-
train_getParameter
protected final void train_getParameter(Request request, String elementName, String value)
-
train_getPageName
protected final void train_getPageName(ComponentResourcesCommon resources, String pageName)
-
mockFormSupport
protected final FormSupport mockFormSupport()
-
messagesFor
protected final Messages messagesFor(Class componentClass) throws IOException
Provides access to component messages, suitable for testing. Reads the associated .properties file for the class (NOT any localization of it). Only the messages directly in the .properties file is available.- Parameters:
componentClass
- component class whose messages are needed *- Returns:
- the Messages instance
- Throws:
IOException
-
mockFieldValidationSupport
protected final FieldValidationSupport mockFieldValidationSupport()
-
train_getInheritInformalParameters
protected final void train_getInheritInformalParameters(EmbeddedComponentModel model, boolean inherits)
-
mockApplicationStateManager
protected final ApplicationStateManager mockApplicationStateManager()
-
train_get
protected final <T> void train_get(ApplicationStateManager manager, Class<T> asoClass, T aso)
-
train_getInput
protected final void train_getInput(ValidationTracker tracker, Field field, String input)
-
train_isXHR
protected final void train_isXHR(Request request, boolean isXHR)
-
train_getPathInfo
protected void train_getPathInfo(HttpServletRequest request, String pathInfo)
-
train_service
protected final void train_service(HttpServletRequestHandler handler, HttpServletRequest request, HttpServletResponse response, boolean result) throws IOException
- Throws:
IOException
-
train_getServletPath
protected final void train_getServletPath(HttpServletRequest request, String path)
-
mockHttpServletRequestHandler
protected final HttpServletRequestHandler mockHttpServletRequestHandler()
-
mockNullFieldStrategy
protected final NullFieldStrategy mockNullFieldStrategy()
-
mockValueEncoderSource
protected final ValueEncoderSource mockValueEncoderSource()
-
mockValueEncoder
protected final ValueEncoder mockValueEncoder()
-
train_toClient
protected final void train_toClient(ValueEncoder valueEncoder, Object value, String encoded)
-
train_getValueEncoder
protected final void train_getValueEncoder(ValueEncoderSource source, Class type, ValueEncoder valueEncoder)
-
train_toValue
protected final void train_toValue(ValueEncoder valueEncoder, String clientValue, Object value)
-
train_findMeta
protected <T> void train_findMeta(MetaDataLocator locator, String key, ComponentResources resources, Class<T> expectedType, T value)
-
mockMetaDataLocator
protected MetaDataLocator mockMetaDataLocator()
-
train_isSecure
protected final void train_isSecure(Request request, boolean isSecure)
-
train_getBaseURL
protected final void train_getBaseURL(BaseURLSource baseURLSource, boolean secure, String baseURL)
-
mockBaseURLSource
protected final BaseURLSource mockBaseURLSource()
-
train_getAttribute
protected final void train_getAttribute(Request request, String attibuteName, Object value)
-
train_getBlockParameter
protected final void train_getBlockParameter(ComponentResources resources, String name, Block block)
-
mockPropertyOverrides
protected final PropertyOverrides mockPropertyOverrides()
-
train_getOverrideBlock
protected void train_getOverrideBlock(PropertyOverrides overrides, String name, Block block)
-
train_getOverrideMessages
protected final void train_getOverrideMessages(PropertyOverrides overrides, Messages messages)
-
train_isDisabled
protected final void train_isDisabled(Field field, boolean disabled)
-
mockValidationDecorator
protected final ValidationDecorator mockValidationDecorator()
-
train_isRequired
protected final void train_isRequired(Field field, boolean required)
-
train_getClientId
protected final void train_getClientId(ClientElement element, String clientId)
-
mockFieldTranslator
protected final FieldTranslator mockFieldTranslator()
-
mockTranslator
protected final Translator mockTranslator(String name, Class type)
-
train_getName
protected final void train_getName(Translator translator, String name)
-
train_getType
protected final void train_getType(Translator translator, Class type)
-
train_createDefaultTranslator
protected final void train_createDefaultTranslator(FieldTranslatorSource source, ComponentResources resources, String parameterName, FieldTranslator translator)
-
mockTranslatorSource
protected final TranslatorSource mockTranslatorSource()
-
train_get
protected final void train_get(TranslatorSource translatorSource, String name, Translator translator)
-
train_getMessageKey
protected final void train_getMessageKey(Translator translator, String messageKey)
-
train_findByType
protected final void train_findByType(TranslatorSource ts, Class propertyType, Translator translator)
-
train_toURI
protected final void train_toURI(Link link, String URI)
-
train_createEditModel
protected final void train_createEditModel(BeanModelSource source, Class beanClass, Messages messages, BeanModel model)
-
mockComponentEventResultProcessor
protected final ComponentEventResultProcessor mockComponentEventResultProcessor()
-
train_getFormComponentId
protected final void train_getFormComponentId(FormSupport formSupport, String componentId)
-
train_getFormValidationId
protected final void train_getFormValidationId(FormSupport formSupport, String validationId)
-
train_isAllowNull
protected final void train_isAllowNull(ParameterModel model, boolean allowNull)
-
train_isInvalidated
protected final void train_isInvalidated(Session session, boolean invalidated)
-
mockComponentEventRequestHandler
protected final ComponentEventRequestHandler mockComponentEventRequestHandler()
-
mockComponentRequestHandler
protected final ComponentRequestHandler mockComponentRequestHandler()
-
mockRequestGlobals
protected final RequestGlobals mockRequestGlobals()
- Since:
- 5.2.0
-
mockPageRenderLinkSource
protected final PageRenderLinkSource mockPageRenderLinkSource()
-
mockJavaScriptSupport
protected final JavaScriptSupport mockJavaScriptSupport()
-
-