Search in sources :

Example 6 with ApplicationContextMock

use of org.apache.wicket.spring.test.ApplicationContextMock in project wicket by apache.

the class AnnotatedFieldInBehaviorPage method before.

/**
 * @throws Exception
 */
@Before
public void before() throws Exception {
    tester = new WicketTester();
    ctx = new ApplicationContextMock();
    SpringComponentInjector springInjector = new SpringComponentInjector(tester.getApplication(), ctx);
    tester.getApplication().getComponentInstantiationListeners().add(springInjector);
}
Also used : ApplicationContextMock(org.apache.wicket.spring.test.ApplicationContextMock) WicketTester(org.apache.wicket.util.tester.WicketTester) Before(org.junit.Before)

Example 7 with ApplicationContextMock

use of org.apache.wicket.spring.test.ApplicationContextMock in project the-app by devops-dojo.

the class AbstractWicketTest method initializeApplicationContext.

private ApplicationContextMock initializeApplicationContext() {
    Navigation navigationMock = createNavigationMock();
    when(navigationProvider.getNavigation()).thenReturn(navigationMock);
    ApplicationContextMock appctx = new ApplicationContextMock();
    appctx.putBean("authenticationService", authenticationService);
    appctx.putBean("cart", cart);
    appctx.putBean("checkout", checkout);
    appctx.putBean("productRepository", productRepository);
    appctx.putBean("productService", productService);
    appctx.putBean("frequentlyBoughtWithProductsRecommendationService", recommendationService);
    appctx.putBean("restTemplate", restTemplate);
    appctx.putBean("fakeAuthenticationService", fakeAuthenticationService);
    appctx.putBean("navigationProvider", navigationProvider);
    appctx.putBean("userService", userService);
    appctx.putBean("featureTooglesBean", featureTooglesBean);
    appctx.putBean("designSelector", designSelectorBean);
    appctx.putBean("dozerMapper", createDozerMapper());
    return appctx;
}
Also used : ApplicationContextMock(org.apache.wicket.spring.test.ApplicationContextMock) Navigation(io.github.zutherb.appstash.shop.ui.navigation.Navigation)

Aggregations

ApplicationContextMock (org.apache.wicket.spring.test.ApplicationContextMock)7 Before (org.junit.Before)4 WicketTester (org.apache.wicket.util.tester.WicketTester)2 AuthenticationService (io.github.zutherb.appstash.shop.service.authentication.api.AuthenticationService)1 Cart (io.github.zutherb.appstash.shop.service.cart.api.Cart)1 TestShopApplication (io.github.zutherb.appstash.shop.ui.application.TestShopApplication)1 Navigation (io.github.zutherb.appstash.shop.ui.navigation.Navigation)1 SpringContextLocatorMock (org.apache.wicket.spring.test.SpringContextLocatorMock)1 After (org.junit.After)1 Test (org.junit.Test)1