The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

bckpwrld (4) [Avatar] Offline
#1
hi

page 63:

"Use Property Injection when you want to signify that dependency of the class under test is optional or if dependency has a default instance created that doesn't create any problems during the test"

a) Which implementation would you consider to have an optional dependency? One where class under test has a default dependency ( which will be used if client doesn't supply a new dependency ) or also one where class under test doesn't have default dependency, but client is still not required to supply one?

b) If class under test has a default dependency that creates problems during the test, then I assume we shouldn't use property injection, but instead should use constructor injection ( since in order for this test to work correctly, client must always inject a fake ) ?

thank you