0

I have a dispatcher service which delegates to other services. I am attempting to test dispatching to the email service. (I have not tested the other services)

The integration test on the dispatcher service works fine, reading data from the database to build the email, up until the point it attempts to invoke emailService.send(). I was expecting the EmailService to be injected, but it appears not to be:

class DispatchService {
    EmailService emailService
    ...

What am I missing? All service, domain, and test classes were created using the Grails tools, I'm not doing anything really bizarre or custom. I've googled extensively, but can't seem to find the solution to match this problem.

Thanks!

4

1 回答 1

0

Dammit. Old habits die hard.

Commenting out this line from within the test method fixes the EmailService injection problem.

//DispatchService dispatchService = new DispatchService()
于 2012-05-05T09:45:50.980 回答