try this

WicketTester test = new WicketTester();
test.add(new SpringComponentInjector());

-igor



On 1/5/07, tooy li(Gmail) <[EMAIL PROTECTED]> wrote:

hi,all
I try the annoation unit test to the page, but I find it cannot work with
injection.
below is my code

  ColumnInfo example = new ColumnInfo();

  MockControl daoCtrl = MockControl
    .createControl(ColumnManagerServiceI.class);
  ColumnManagerServiceI dao = (ColumnManagerServiceI) daoCtrl.getMock();

  daoCtrl.expectAndReturn(dao.selectCount(example), 20);
  daoCtrl.replay();

  AnnotApplicationContextMock appctx = new AnnotApplicationContextMock();
  appctx.putBean("ColumnMangerService", dao);

  WicketTester test = new WicketTester();
  test.startPage(new ListColumnInfoPage(new DummyHomePage(), "test"));
  test.assertRenderedPage(ListColumnInfoPage.class);
  daoCtrl.verify();

there is a SpringBean in the ListColumnInfoPage, it can work well in the
true environment. is some people can help me ?
i just think it's should to injection the mockContext in some place, so i
try to add the my appliction into the construtor of WicketTester , it throw
a error about cannot find the applicationcontext of spring.

i think i only can insert the  the object into the page before test it :(


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share
your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user



-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to