public abstract class ViewSpec extends SpecHelper
SpecHelper.DynamicBuilder, SpecHelper.ModuleBuilder| Constructor and Description | 
|---|
ViewSpec()  | 
| Modifier and Type | Method and Description | 
|---|---|
void | 
afterTest()  | 
void | 
beforeTest()  | 
protected List<String> | 
contentFor(String name)
This method returns chunks of content that was assigned from a tested template. 
 | 
protected void | 
registerTag(String name,
           FreeMarkerTag tag)
Use to register a tag before the test. 
 | 
protected String | 
render(String templateName)
Renders a template by name 
 | 
protected String | 
render(String templateName,
      Map values)
Renders a template by name 
 | 
protected String | 
render(String templateName,
      String... namesAndValues)
Renders a template by name. 
 | 
protected <T extends AppController> | 
setCurrentController(Class<T> controllerClass)
This method is only needed as a hint to the  
LinkToTag. | 
protected void | 
setInjector(com.google.inject.Injector injector)
Sets injector for tags if they require dependencies. 
 | 
void | 
setTemplateLocation(String templateLocation)
By default the template location is set to  
src/main/webapp/WEB-INF/views. | 
afterEnd, atStart, createInjector, flash, flash, flashExists, injector, session, session, session, sessionBoolean, sessionDouble, sessionFloat, sessionHas, sessionInteger, sessionLong, sessionObject, sessionStringpublic final void beforeTest()
public final void afterTest()
public void setTemplateLocation(String templateLocation)
src/main/webapp/WEB-INF/views.
 However in some cases you want to have test templates that are different
 from runtime templates. In those cases you can override that default
 location with your value,setTemplateLocation in class SpecHelpertemplateLocation - location of your templates relative to the directory
 where test is executed, usually a root of your Maven moduleprotected void setInjector(com.google.inject.Injector injector)
setInjector in class SpecHelperinjector - injector to source dependencies form.protected void registerTag(String name, FreeMarkerTag tag)
registerTag in class SpecHelpername - name of tag as used in a template.tag - tag instanceprotected String render(String templateName)
templateName - name of template to renderprotected String render(String templateName, Map values)
templateName - name of template to rendervalues - values to be passed into templateprotected String render(String templateName, String... namesAndValues)
templateName - name of template to rendernamesAndValues - - list of names and values, where first, third, etc argument is a name and second,
 fourth, etc. argument is a corresponding value.protected <T extends AppController> void setCurrentController(Class<T> controllerClass)
LinkToTag. If the link_to
 tag is used in a template without the controller attribute, it needs a current controller in context
 to generate a proper link. At runtime as well as in controller tests, a controller is always present in context, and
 link_to works as expected. However, since view specs are executed outside of controller execution,
 if you have a link_to in the template you are testing, you will need to provide a clue to your view
 before the test is executed.controllerClass - controller class to aid to the link_to tag to generate a proper link.protected List<String> contentFor(String name)
ContentForTag
 when it is used in a template, example:
 
 
<@content for="title">Book title</@content>
 
 name - name of a content piece as was specified  by the "for" attribute of the "content" tag.Copyright © 2020 JavaLite. All rights reserved.