Possible Duplicate:
What is Object Mocking and when do I need it?
Why create a mock object using
MyObject myOb = Mockito.mock(MyObject.class);
When can just use instead :
MyObject myOb = new MyObject();
public class MyObject(){
private String str;
//getters and setters
}
If above object becomes more complex & it has dependencies to other object, I need to create mock objects for these also. So if all members are required to be set to test an object, why not just create the object itself instead of mocking it using a framework ?