
|
If you were logged in you would be able to see more operations.
|
|
|
Unitils
Created: 26/May/09 09:32 PM
Updated: 04/Jun/09 09:56 PM
|
|
| Component/s: |
mock
|
| Affects Version/s: |
2.0,
2.2
|
| Fix Version/s: |
2.3
|
|
|
it would be convenient, and potentially easier to read, if mock objects were automatically 'unwrapped'. This code:
mockParent.returns(mockChild.getMock()).getChild();
could instead be written as:
mockParent.returns(mockChild).getChild();
Since code-under-test would never expect an org.unitils.mock.Mock instance, it would be nice if returns() automatically called getMock() for us.
One fast way to implement this: add overloads in MockObject and the Mock interface:
public T returns(Mock<?> mock) {
return returns(mock.getMock());
}
public T onceReturns(Mock<?> mock) {
return onceReturns(mock.getMock());
}
|
|
Description
|
it would be convenient, and potentially easier to read, if mock objects were automatically 'unwrapped'. This code:
mockParent.returns(mockChild.getMock()).getChild();
could instead be written as:
mockParent.returns(mockChild).getChild();
Since code-under-test would never expect an org.unitils.mock.Mock instance, it would be nice if returns() automatically called getMock() for us.
One fast way to implement this: add overloads in MockObject and the Mock interface:
public T returns(Mock<?> mock) {
return returns(mock.getMock());
}
public T onceReturns(Mock<?> mock) {
return onceReturns(mock.getMock());
} |
Show » |
|