jeudi 29 octobre 2015

How do I mock an object of a class with parameterized constructor?

For the code

public class A{
    public A (B b, C c){
    //do something here
    }
}

For testing, I wanted to create a mock object. What I am doing now is

B bmock = mock(B);
C cmock = mock(C);
A aobject = new A(bmock, cmock);

However, this doesn't allow me call verify() on aobject as it is not mocked. How to do that?

Aucun commentaire:

Enregistrer un commentaire