Test interface implementation
Posted
by
Michael
on Programmers
See other posts from Programmers
or by Michael
Published on 2011-06-30T15:56:56Z
Indexed on
2011/06/30
16:30 UTC
Read the original article
Hit count: 440
I have a interface in our code base that I would like to be able to mock out for unit testing. I am writing a test implementation to allow the individual tests to be able to override the specific methods they are concerned with rather than implementing every method.
I've run into a quandary over how the test implementation should behave if the test fails to override a method used by the method under test. Should I return a "non-value" (0, null) in the test implementation or throw a UnsupportedOperationException to explicitly fail the test?
© Programmers or respective owner