Search in sources :

Example 1 with ApplicationContextMock

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

the class AbstractWicketTest method initializeWicketTester.

@Before
public void initializeWicketTester() throws Exception {
    initMocks(this);
    ApplicationContextMock appctx = initializeApplicationContext();
    TestShopApplication application = new TestShopApplication(appctx);
    wicketTester = new WicketTester(application);
}
Also used : ApplicationContextMock(org.apache.wicket.spring.test.ApplicationContextMock) TestShopApplication(io.github.zutherb.appstash.shop.ui.application.TestShopApplication) WicketTester(org.apache.wicket.util.tester.WicketTester) Before(org.junit.Before)

Example 2 with ApplicationContextMock

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

the class NavigationProviderImplTest method tearDown.

@After
public void tearDown() {
    NavigationProvider navigationProvider = new NavigationProviderImpl(new ApplicationContextMock(), authenticationService);
    navigationProvider.setClassPathToScan("io.github.zutherb.appstash.shop.ui.page");
}
Also used : ApplicationContextMock(org.apache.wicket.spring.test.ApplicationContextMock) After(org.junit.After)

Example 3 with ApplicationContextMock

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

the class NavigationProviderImplTest method testRealNavigation.

@Test
public void testRealNavigation() {
    ApplicationContextMock applicationContext = new ApplicationContextMock();
    applicationContext.putBean("cart", mock(Cart.class));
    applicationContext.putBean("authenticationService", mock(AuthenticationService.class));
    NavigationProvider navigationProvider = new NavigationProviderImpl(applicationContext, authenticationService);
    Navigation realNavigation = navigationProvider.getNavigation();
    assertNotNull(realNavigation);
    assertTrue("Main Navigation must not empty", !realNavigation.getMainNavigationGroup().getNavigationEntries().isEmpty());
}
Also used : ApplicationContextMock(org.apache.wicket.spring.test.ApplicationContextMock) AuthenticationService(io.github.zutherb.appstash.shop.service.authentication.api.AuthenticationService) Cart(io.github.zutherb.appstash.shop.service.cart.api.Cart) Test(org.junit.Test)

Example 4 with ApplicationContextMock

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

the class NavigationProviderImplTest method setup.

@Before
public void setup() {
    initMocks(this);
    when(authenticationService.isAuthorized()).thenReturn(true);
    when(authenticationService.isAuthorized(anyString())).thenReturn(true);
    ApplicationContextMock applicationContext = new ApplicationContextMock();
    applicationContext.putBean("authenticationService", authenticationService);
    applicationContext.putBean("cart", cart);
    NavigationProvider navigationProvider = new NavigationProviderImpl(applicationContext, authenticationService);
    navigation = navigationProvider.getNavigation();
}
Also used : ApplicationContextMock(org.apache.wicket.spring.test.ApplicationContextMock) Before(org.junit.Before)

Example 5 with ApplicationContextMock

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

the class SpringBeanLocatorTest method before.

/**
 */
@Before
public void before() {
    ctx = new ApplicationContextMock();
    ctxLocator = new SpringContextLocatorMock(ctx);
}
Also used : ApplicationContextMock(org.apache.wicket.spring.test.ApplicationContextMock) SpringContextLocatorMock(org.apache.wicket.spring.test.SpringContextLocatorMock) Before(org.junit.Before)

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