1 of 2
Jan Hudec
  • 18.3k
  • 1
  • 40
  • 63

I would treat it as single unit to test.

As long as you control all inputs from which the Employee object is created, the fact that it is created in the tested object shouldn't matter. You just need a the mock method to return expected result if the content of the argument matches expectation.

Obviously it means you need to provide custom logic for the mock method. Advanced logic often can't be tested with just "for x return y" kind of mocks.

Jan Hudec
  • 18.3k
  • 1
  • 40
  • 63