Thread: Mocking response of methods in class under test
Created on: 02/02/10 02:01 AM
Joined: 02/02/10 Posts: 1
Mocking response of methods in class under test
02/02/10 2:01 AM
I have a situation in which the class under test has a private method that is called inline by the method I'm testing. It performs some logic that doesn't add value to the class under test method and I want to control that inline response. For example classUnderTest.testingThisMethod() calls classUnderTest.inlineCallMethod(). It is not a collaborator method. I want to control the response of the inlineCallMethod() by mocking the response. Can the mixin feature via the Reflect package handle this?
I see that java's easymock calls this "partial mocking".
"Sometimes you may need to mock only some methods of a class and keep the normal behavior of others. This usually happens when you want to test a method that calls some others in the same class. So you want to keep the normal behavior of the tested method and mock the others."