I am trying to inject a service to one component using testifiy's
@ForComponent annotation and Mockito but the component doesn't get the
mocked service injected.

My test looks like this:

     private static final TapestryTester TESTER = new
TapestryTester("com.rinco.security", "rincoSecurity",
"src/main/webapp", RincoCoreModule.class, RincoSecurityModule.class);

        public AbstractRincoSecurityTest() {
                super(TESTER);
        }

      @ForComponents
        @Mock
        UserFactory _userFactory;

      @BeforeMethod
      public void initTests(){
        MockitoAnnotations.initMocks(this);
       }        

        @Test(groups = { "pages" }, dependsOnMethods = { "singupFormRenderTest" 
})
        public void singupFormSubmitTest() {
                Document page = tester.renderPage("SignupTestPage");
                Element form = page.getElementById("form");
                page = tester.submitForm(form, populateSignupParams());
                Assert.assertTrue(StringUtils.contains(page.toString(), 
"IndexPage"));
        }

        private Map<String, String> populateSignupParams() {
                Map<String, String> params = CollectionFactory.newMap();
                params.put("email", "ri...@rinco.com");
                params.put("firstName", "rinco");
                params.put("lastName", "perry");
                params.put("password", "rincopassword");
                params.put("verifyPassword", "rincopassword");
                return params;
        }

The mocked UserFactory is being created but during the execution of
the component is not being injected. am i missing something?

I am using Testng and tapestry 5.1.0.5

Thanks for your help

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org

Reply via email to