So I was reading another question under the Wicket tag comparing Apache Wicket and Apache Click. A concise explanation, in my opinion. I am more familiar with the Wicket world t
I prefer to check that in test.
so each test for stateless page overrides
getStatelessWebPage()
which by default returns null.
then in basic test I have generic test that visits all components on page and check whether component is stateless or not
@Test
public void checkForStateless()
{
StatelessWebPage statelessPage = getStatelessWebPage();
if (statelessPage != null)
{
Page page = (Page)statelessPage;
if (!page.isPageStateless())
{
//find the reason
Component statefulComponent = page.visitChildren(Component.class, new StatelessChecker());
if (statefulComponent != null)
{
fail("Stateless page contains stateful component ["
+statefulComponent.getClass().getName()+" : "
+ statefulComponent.getMarkupId() +"]");
}
}
}
}
and
class StatelessChecker implements IVisitor
{
@Override
public void component(Component component, IVisit iVisit)
{
if (!component.isStateless())
{
iVisit.stop(component);
}
}
}