|
Groovy Documentation | |||||||
FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object grails.test.mixin.support.GrailsUnitTestMixin grails.test.mixin.web.ControllerUnitTestMixin grails.test.mixin.web.FiltersUnitTestMixin
class FiltersUnitTestMixin extends ControllerUnitTestMixin
A unit testing mixin to support the testing of Grails filter classes. This mixin provides a FiltersUnitTestMixin.mockFilters method to mock a filters class.
A typical usage pattern involves wrapping a call to controller in a call to the FiltersUnitTestMixin.withFilters method:
def controller = mockController(MyController)
mockFilters(MyFilters)
withFilters(action:"list") {
controller.list()
}
Method Summary | |
---|---|
void
|
clearFilters()
|
CompositeInterceptor
|
getCompositeInterceptor()
|
CompositeInterceptor
|
mockFilters(java.lang.Class filterClass)
Mocks a filter class |
static void
|
setupFilterBeans()
|
java.lang.Object
|
withFilters(java.util.Map arguments, groovy.lang.Closure callable)
Wraps a call to controller in filter execution |
Methods inherited from class ControllerUnitTestMixin | |
---|---|
bindGrailsWebRequest, cleanupGrailsWeb, clearGrailsWebRequest, configureGrailsWeb, getFlash, getModel, getParams, getSession, getView, mockCommandObject, mockController, testFor |
Methods inherited from class java.lang.Object | |
---|---|
java.lang.Object#wait(), java.lang.Object#wait(long, int), java.lang.Object#wait(long), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll() |
Method Detail |
---|
@After void clearFilters()
CompositeInterceptor getCompositeInterceptor()
CompositeInterceptor mockFilters(java.lang.Class filterClass)
filterClass
- The filter class
@BeforeClass static void setupFilterBeans()
java.lang.Object withFilters(java.util.Map arguments, groovy.lang.Closure callable)
arguments
- Named arguments to specify the 'controller' and 'action' to map tocallable
- The closure code that invokes the controller action
Groovy Documentation