¿ªÔÆÌåÓý

ctrl + shift + ? for shortcuts
© 2025 Groups.io

Re: [TDD] Howto mock a final object that doesn't offer an interface?


 

It's the tests that have "driven" you to introduce the indirection, so your
argument may be that you've introduced it "just for the test", but what
you've actually done is decoupled the main body of your code from the
specific implementation (something adobe in this case?). I would say this
is nearly always a good thing irrespective of the tests getting you there
or not.

This is one of the things that got me test infected many years ago - I
found the code I ended up producing was so much more flexible and less tied
to infrastructure than it would've been previously.

One could argue that an adapter like a GraphicsView is a more elegant,
but similar artificial construct, that is only introduced to be able to
test the real object. Since I just started, I wanted to know, how this
is handled by experienced TDD-practitioners.

Join [email protected] to automatically receive all group messages.