Hi,
I would like to mock a view implementation of the MVC design pattern
. I have implemented the MVP
(another MVC
variation), and would like to test if the certain methods in the view get called correctly by the controller when a state change happens on the model. The following shows the sequence of method calls on the model
, controller
and view
.
Model:
model.setProperty("newProperty");
Controller:
@Override public void propertyChange(PropertyChangeEvent evt) { for (View view : views) { view.modelPropertyChange(evt); } }
View: This result to the view being called as like:
@Override public void modelPropertyChange(PropertyChangeEvent evt) { if ("Property".equals(evt.getPropertyName())) { updateView(); } }
Question: How do verify(using EasyMock
in the JUnit
test), the expected order of method(with valid argument(s)) execution? I expect view.modelPropertyChange(evt)
to get called and the expect view.isViewUpdated()
to return true
on the view
object. How do I say that in my JUnit test? Please help!