I want to write unit tests for the following class:
public class Target() {
private final Member member = new Member();
public Target() {
}
}
I want to initialize this Target class with a mocked instance of Member, as it is not feasible to instantiate Member during testing. Is that possible with any framework?
EDIT:
I do not want to mock Target class. I intend to mock Member class at the time of initialization.
Object method() {
member.differentMethod();
//Logic which I want to test
}
Please suggest how to mock this call to the method of Member class.
Aucun commentaire:
Enregistrer un commentaire