Hi,

I have tested Testify with a simple sample and manage to make it work:

public class MyPageTest extends TapestryTest{
    private static final TapestryTester SHARED_TESTER = new
TapestryTester("org.apache.tapestry5.tutorial",
            TestModule.class);

    public MyPageTest() {super(SHARED_TESTER);}

    @Override
    protected void setUpForAllTestMethods() throws Exception {
        MockitoAnnotations.initMocks(this);
    }    
}

public class MyTest extends MyPageTest{
    @Test
    public void testElementIsOnPage() {
        Document page = tester.renderPage("index");
        Assert.assertEquals(page.getElementById("123").getChildMarkup(), "this
is 123");
    }
}

public class TestModule {
    public static void bind(ServiceBinder binder) {}
}

above code works, I added following to my AppModule:

public RequestFilter buildUtf8Filter(
          @InjectService("RequestGlobals") final RequestGlobals
requestGlobals) {
      return new RequestFilter() {
          public boolean service(Request request, Response response,
RequestHandler handler)
                  throws IOException {
             
requestGlobals.getHTTPServletRequest().setCharacterEncoding("UTF-8");
              return handler.service(request, response);
          }
      };
  }

And I get this exception all the time, how to take care of this situation in
Testify? thanks.

java.lang.RuntimeException: Exception constructing service 'RequestHandler':
Error invoking service builder method
org.apache.tapestry5.services.TapestryModule.buildRequestHandler(Logger,
List, Dispatcher) (at TapestryModule.java:1236) (for service
'RequestHandler'): Error invoking service contribution method
org.apache.tapestry5.tutorial.services.AppModule.contributeRequestHandler(OrderedConfiguration,
RequestFilter): Unable to locate a single service assignable to type
org.apache.tapestry5.services.RequestFilter with marker annotation(s)
org.apache.tapestry5.ioc.annotations.Local.
 

-- 
View this message in context: 
http://www.nabble.com/T5%3A-how-to-put-Testify-into-real-use--tp26038980p26038980.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


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

Reply via email to