History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: UNI-159
Type: Improvement Improvement
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Tim Ducheyne
Reporter: Tim Ducheyne
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Unitils

Add ability to specify default behavior for mocks. (find best match for invocations)

Created: 21/Jul/09 09:56 AM   Updated: 21/Jul/09 10:05 AM
Component/s: mock
Affects Version/s: 2.3
Fix Version/s: 3.0


 Description  « Hide
For example:

        mockObject.returns("value1").testMethod(null, null, null);
        mockObject.returns("value2").testMethod("arg1", null, null);

should return value2 if invoked with "arg1" as first argument value.

This way you could for example specify the default behavior in the before method and then specify more specific behavior in the test methods.

E.g

public class MyTest {

    @Before
    public void setDefaults(){
        mockObject.returns("value1").testMethod(null, null, null);
    }

    @Test
    public void myTest(){
         mockObject.returns("value2").testMethod("arg1", null, null);
         ....
    }
}


 All   Comments   Change History      Sort Order:
There are no comments yet on this issue.