Hi.

Interesting post. I thought I'd just mention that it is quite easy to
test the example you gave. Simply mock out the PizzaFactory with
jmockit.

Would look something like this:

new Expectation()
{
  PizzaFactory pizzaFactory;
  {
    PizzaFactory.createPizza(any);
    result = aPizza; // could be another mock if I want
  }
}

I still like the guice way better but it is possible to test static
factories as well assuming you're able to use jmockit in your project.

/Kaj


On Feb 14, 12:09 am, Kartik Kumar <[email protected]> wrote:
> Hi All,
>
> I have been working on slowly integrating Guice in our project that
> leverages JPF to buid web application. So far, the results have been more
> than encouraging. Our code is now more testable and faster. More bugs are
> being caught during development cycle. To replace a static factory
> implementation used repeatedly in our code, I leveraged multibindings which
> made id easier to look up strategy implementations based on key-value pairs.
> I just finished writing a blog post about 
> ithttp://kartik-krishnanand.blogspot.com/2010/02/factory-implementation...
>
> Any feedback any one may have is appreciated.
>
> Thanks,
>
> Kartik

-- 
You received this message because you are subscribed to the Google Groups 
"google-guice" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-guice?hl=en.

Reply via email to