lundi 16 février 2015

java mocking custom objects


public class MainClass {

public void makeCall() {
CustomObject obj = new CustomObject();
obj.testMethod();
}
}


I want to unit test the makeCall(). So i have to mock the CustomObject in the above sample. I am using Mockito as the mock framework.But when i mock the object like mock(CustomObject.class). makeCall() method always call the actual object not the mocked one.Is there anyway to mock the local objects. Please help


Aucun commentaire:

Enregistrer un commentaire