> Hi Mats, Hi!
>> I then have a subclass with the JUnit 4 test: >> >> public class GamesLauncherTest extends AbstractPageTest { >> >> @ForComponents @Mock >> private XyzManager xyzManager; >> >> @Mock >> private XyzConfig xyzConfig; >> >> >> What I get is runtime exceptions, such as this: >> >> Caused by: java.lang.RuntimeException: Service id 'xyzConfig' is >> not defined by any module. Defined services: AccessDecisionManager, >> ... VirtualAssetStreamer. > > Something is trying to look up a service with id "xyzConfig" - using that > id. I assume you have something like this in your page: > > @Inject > @Service("xyzConfig") > private XyzConfig config; > > If that's true then it might simply be that you haven't got a > @ForComponents annotation on your xyzConfig mock. Also, if you name the > service (using the @Service annotation) then you need to name it in the > @ForComponents too: > > public class GamesLauncherTest extends AbstractPageTest { > > @ForComponents @Mock > private XyzManager xyzManager; > > @ForComponents("xyzConfig") @Mock > private XyzConfig xyzConfig; OK, I'll try that. >> We define our services in spring XML files, and @Inject them into our >> pages, and this worries me quite a bit, since I can't see any examples >> where Spring XML wiring has been mocked. > > If you are faking/mocking the services then there's no problem. However, > Testify and Tapestry's PageTester don't work with the tapestry-spring > integration so you can't rely on the real spring services for (for > example) integration tests. Actually, I don't want the Spring wiring at all. I hope to be able to use Mockito mocks all the way. Mats --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org