I just did this: tester.getApplication().addComponentInstantiationListener(new GuiceComponentInjector(tester.getApplication()));
On May 18, 2010, at 2:01 AM, Douglas Ferguson wrote: > I'm not using spring. Would I still use that injector? > > I'm using guice.. > > D/ > > > On May 18, 2010, at 1:46 AM, Per Newgro wrote: > >> Someone seems to change this, but i dodn't found an example how to solve >> it correctly until now. >> >> Kim had the problem some days ago to. Seems that yoiu have to add >> ComponentInstListener to TestApplication to. >> Why this was working before and not anymore - i don't know. >> Here is what he wrote >> >> Okay, >> >> Got my test green:-) >> >> >> Here it is: >> >> package be.thomascook.ui.pages.admin; >> >> import be.thomascook.wicket.component.WicketFilter; >> import org.apache.wicket.spring.injection.annot.SpringComponentInjector; >> import org.apache.wicket.util.tester.WicketTester; >> import org.springframework.beans.factory.annotation.Autowired; >> import org.springframework.context.ApplicationContext; >> import org.springframework.test.context.ContextConfiguration; >> import >> org.springframework.test.context.testng.AbstractTestNGSpringContextTests; >> import >> org.springframework.test.context.testng.AbstractTransactionalTestNGSpringContextTests; >> import org.springframework.transaction.annotation.Transactional; >> import org.testng.annotations.Test; >> >> /** >> * @author Compi >> * @since 10-mei-2010 >> */ >> @ContextConfiguration(locations = { >> "/applicationContext-dao.xml", >> "/applicationContext-service.xml", >> "/applicationContext-database.xml"}) >> @Transactional >> public class UserListPageTest extends >> AbstractTransactionalTestNGSpringContextTests { >> >> @Autowired >> private ApplicationContext applicationContext; >> @Autowired >> protected WicketFilter wicketApplication; >> >> @Test >> public void labelContainsHelloWorld() { >> WicketTester tester=new WicketTester(); >> tester.getApplication().addComponentInstantiationListener(new >> SpringComponentInjector(tester.getApplication(), applicationContext, true )); >> >> >> tester.startPage(UserListPage.class); >> tester.assertNoErrorMessage(); >> tester.assertLabel("title", "Users List"); >> } >> } >> >> >> Kind regards, >> Kim >> >> >> >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org >> For additional commands, e-mail: users-h...@wicket.apache.org >> > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > For additional commands, e-mail: users-h...@wicket.apache.org > --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org