I'm new to testing in Grails, so I'm not sure if I'm taking the correct approach. I am trying to unit test a service (call it FooService) that has an instance of another class (call it Bar) as a property. Basically something like:
class FooService {
Bar bar
void afterPropertiesSet() {
bar = new Bar()
}
}
So, I'm trying to test the afterPropertiesSet method, and as I understand it, the correct practice for unit tests is to mock outside classes. So, how, in FooServiceTests extends GrailsUnitTestCase, do I mock the Bar constructor?
Thanks