1. Copy and paste com.google.guiceberry.junit4.GuiceBerryRule source
code to your own "MyGuiceBerryRule"
2. in the apply method, store "FrameworkMethod method" (and maybe you
need "Object target" as well) in a thread local (or just a plain
static, if you don't know how to do thread locals, or don't feel like
learning)
3. create an @TestScoped binding from FrameworkMethod to the thread
local (or static) you created in #2
4. change your test to use your MyGuiceBerryRule instead of the one
shipped with GuiceBerry
5. Create and bind a TestWrapper to your GuiceBerry env, have
FrameworkMethod injected into it. Have it read the frameworkmethod's
annotations to look for @PathToModel and populate your Model with the
data from that path.
Peace,
Z
> --
> You received this message because you are subscribed to the Google Groups "guiceberry-users" group.
> To post to this group, send email to guiceber...@googlegroups.com.
> To unsubscribe from this group, send email to guiceberry-use...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/guiceberry-users?hl=en.
>
>
Create that binding in your guiceberry env (or any module installed by it).
> Also, how do I create a TestWrapper without losing what
> is in TestCaseScaffolding?
I don't know how TestCaseScaffolding came into the conversation, it
has nothing to do with TestWrapper. See the tutorial, there's one that
covers TestWrappers. What you will need is something like this in your
GuiceBerry env:
@Provides
@TestScoped
TestWrapper testWrapper(final FrameworkMethod currentlyRunningTest) {
return new TestWrapper() {
public void toRunBeforeTest() {
// read annotations and stuff from currentlyRunningTest, and
populate the test object here.