Search in sources :

Example 1 with IComponentInstantiationListener

use of org.apache.wicket.application.IComponentInstantiationListener in project wicket by apache.

the class DontStoreNotRenderedPageTestCase method newWicketTester.

@Override
protected WicketTester newWicketTester(WebApplication app) {
    app.getComponentInstantiationListeners().add(new IComponentInstantiationListener() {

        @Override
        public void onInstantiation(Component component) {
            // WICKET-5546 behavior added before Page#init()
            component.add(new Behavior() {
            });
        }
    });
    return new WicketTester(app) {

        @Override
        protected IPageManagerProvider newTestPageManagerProvider() {
            return new IPageManagerProvider() {

                @Override
                public IPageManager apply(IPageManagerContext context) {
                    return new MockPageManager() {

                        @Override
                        public void touchPage(IManageablePage page) {
                            Assert.assertFalse("PageB should not be touched!", page instanceof PageB);
                            super.touchPage(page);
                        }
                    };
                }
            };
        }
    };
}
Also used : MockPageManager(org.apache.wicket.mock.MockPageManager) Behavior(org.apache.wicket.behavior.Behavior) WicketTester(org.apache.wicket.util.tester.WicketTester) Component(org.apache.wicket.Component) IPageManagerProvider(org.apache.wicket.IPageManagerProvider) IManageablePage(org.apache.wicket.page.IManageablePage) IPageManagerContext(org.apache.wicket.page.IPageManagerContext) IComponentInstantiationListener(org.apache.wicket.application.IComponentInstantiationListener)

Aggregations

Component (org.apache.wicket.Component)1 IPageManagerProvider (org.apache.wicket.IPageManagerProvider)1 IComponentInstantiationListener (org.apache.wicket.application.IComponentInstantiationListener)1 Behavior (org.apache.wicket.behavior.Behavior)1 MockPageManager (org.apache.wicket.mock.MockPageManager)1 IManageablePage (org.apache.wicket.page.IManageablePage)1 IPageManagerContext (org.apache.wicket.page.IPageManagerContext)1 WicketTester (org.apache.wicket.util.tester.WicketTester)1