Hi Chiradeep,

I'm about to write a unit test for CS-15609, as you suggested in the review 
thread.
However it seems a little bit heavy weight if follow the guide you posted:
1) About IoC, I had to inject all dependent DAOs/Managers for the class under 
test, even if I want to test one method which needs only one or two DAOs. Does 
it fit the convention to bypass the IoC and directly create dependency I 
needed? suppose I dont need it get configured or started automatically.
2) About mocks/stubs, I know mockito is removed from tree, but without a mock 
utility, it is lengthy to create stub method. Any chance that we can bring it 
back or find a replacement?

following is an example snip with mocks and without injector:

StorageManager storageMgr = mock(StorageManager.class);
doReturn(true).when(storageMgr).storagePoolHasEnoughSpace(Arrays.asList(volA), 
sp1);
_firstFitPlanner._storageMgr = storageMgr;
....
...
_firstFitPlanner.findPotentialDeploymentResources(....)
assertTrue(...)

Regards
Mice

2012/7/27 Chiradeep Vittal <chiradeep.vit...@citrix.com>

    This has always been there. Just surfacing it.

    http://wiki.cloudstack.org/display/COMM/Unit+Testing+101

Reply via email to