boyarsky (67) [Avatar] Offline
#1
Chapter 3

page 5 - The static method on EmailService really bothers me. I know you are showing DI on the finder. But in an app you'd need to mock out the e-mail services as well to test it.
martijn.verburg (86) [Avatar] Offline
#2
Re: testing with statics
Hi Jeanne,

I think I see what you mean. It would be better to also have an implementation of an EmailService injected into the example. Is that what you're meaning?
boyarsky (67) [Avatar] Offline
#3
Re: testing with statics
Yes. That would be better.
martijn.verburg (86) [Avatar] Offline
#4
Re: testing with statics
I've fixed this in the code sample, but it's made me realise that the code sample isn't as clear cut as it should be as I'm using a main method which probably is confusing matters. I will think about this sample further, there will probably be an updated sample further down the track.

Thanks again,
Martijn