Pages

Friday, 29 August 2014

Junit tips and tricks

Since I don't know how your factory method looks like, all I can advise right now is to
  1. Check to see the object is the correct concrete implementation you were looking for:
    IMyInterface fromFactory = factory.create(...);  
    Assert.assertTrue(fromFactory instanceof MyInterfaceImpl1);
  2. You can check if the factory setup the concrete instances with valid instance variables.

No comments:

Post a Comment