dimanche 21 février 2016

Mocking interface method inside method

I have interface with method

public interface EventAdder{
void addEvent(Event e);
}

now I got a class:

public class Container{

//some code here

public EventAdder ea; 

public void refreshEvent(){

//some code which I want to test there;

ea.addEvent(new Event(val1, val2));

}
}

I am using outside test class where I create Container object. I want to test method refreshEvent() without call ea.addEvent in tests. How I can mock/spy or replace it in tests?

Aucun commentaire:

Enregistrer un commentaire