Feature request: Mockbox method focus for non-empty mocks

Normally when I use createMock I’m going to test a single function, but that function may call other functions present on the same instance. Is it possible to make it so that you can create a mock that is empty all except for a single specified method? I’m not sure how else to remove or block all other methods to help ensure that if I fail to mock a “sibling” method that I won’t have my test accidentally calling the other real method. Does that make sense? I can try to provide a code example if that would help.

You mean clear all methods?

Luis Majano
CEO
Ortus Solutions, Corp
www.ortussolutions.com
P/F: 1-888-557-8057

I’d like to clear all methods but one - the SUT. That way I ensure that when the test runs it’ll execute only the code being tested. If I forget to mock a function that is called from the one I’m testing then it’s not a nice clean isolated unit test, but more of an accidental integration test. I could create a wrapper for createMock that uses the component metadata to programmatically mock all methods but one I specify to throw an exception… I may end up doing that.