As you mentioned Binding events are instances of PropertyChangeEvent
, just create an instance using PropertyChangeEvent.createUpdateEvent()
and use that with .dispatches()
.
Like so:
mock(person).setter("name").arg(anything())
.dispatches(PropertyChangeEvent.createUpdateEvent(person, "name", oldValue, newValue));
Note however that the oldValue
and newValue
will need to be supplied.
I see merit in making a shortcut for this scenario seeing as binding is heavily used. The only tricky part is keeping the previous value.
If you wanted to tackle implementing this yourself I suggest looking at the Answer
and Decorator
classes and subclasses.