Please have a look at TestUtils [1]. Methods create(), set() and get() are what you are looking for. For T5.1 see [2].
[1] http://tapestry.apache.org/tapestry5.2-dev/apidocs/org/apache/tapestry5/ioc/test/TestUtils.html [2] http://tapestry.apache.org/tapestry5.1/apidocs/org/apache/tapestry5/ioc/test/TestBase.html On Tue, Jun 8, 2010 at 10:51 PM, Christian Edward Gruber <cgru...@google.com > wrote: > Hey, > > So @Property is beautiful, but sometimes when I'm testing the thin > controller logic that remains I want access to an @Property from within the > test in order to verify that something was done/changed. I've looked at > PageTester, but I don't want to dig into the rendered document, because I'm > really just testing the java logic. But I also don't want to create > accessors for my test objects alone. > > I've looked around and found PageTester, Testify, and tapestry-xpath, > but nothing that I can run the component through that will add > accessors/mutators for the @Property-annotated fields so my tests can access > them. I'm thinking something along the lines of: > > public void testFoo() { > MyComponent foo = UnitTester.manifest(MyComponent.class); > UnitTester.assign(foo, "bar", someBar); > foo.doSomething(); > assertEquals(anotherBar, UnitTester.obtain(foo, "bar")); > } > > ... where MyComponent.bar is a field with @Property. There's really no > need to create an accessor just for this, and certainly no need to render > the component - I don't care about its rendering, just its code. > > Anything that might solve the problem this way? Or any recommendations > from Howard or others on where to start to build something like this myself? > I'm not very familiar with the classloader stuff we do in T5 and the > javassist work... if I am going to do this myself, I'll need some good hints > as to where to start looking. > > cheers, > Christian. > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org > For additional commands, e-mail: users-h...@tapestry.apache.org > > -- Best regards, Igor Drobiazko http://tapestry5.de/blog