Author Login
Post Reply
I have the following question: When we have a local object for a method and we
invoke a constructor for that object, can we catch the invocation to the
constructor and mock the creation of the object?
I know that I can make a mock of the invocation of some method in a class not
depending on the reference but it would not help me. For example if I want to
mock isEmpty() method of some collection object I could not because I can't
calculate the consecutive number of the invocation that is important to me.
Thanks in advance!
Example:
Class A {
void someMethod() {
B ref = new B();
if (ref.doSomething() == 10) {
// I want to get here by mocking ref
}
}
}
Class B {
int doSomething() {
...
}
}
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email