|
From: <rin...@me...> - 2001-11-15 07:52:58
|
> I've been looking at this class. Have you actually used it > for multiple events? The reason I ask is that the value > expectation values can only accept a single value each, > although they can receive it multiple times. I have used this class for multiple events, but the only thing I verify on the mock listener at that moment is the number of events received, not the actual data of each event. > Depending on your requirements, my inclination would be to > define an EventMatch class, that implements equals() on > whatever you think is interesting, and set a list of expected > EventMatches in the Listener. Tell me if my thoughts match yours: the MockPropertyChangeListener maintains a list of EventMatch objects, in the order I expect each event. When I add an EventMatch object to the mock listener, the EventMatch object contains a fully configured PropertyChangeEvent as the expected event. When the propertyChangeEvent on the mock listener is invoked, it takes the actual event and pushes it to the EventMatch object, increments the eventCount expectation. A subsequent call will push the actual event to the next EventMatch object in the list. Verification of the mock listener also invokes the verificiation on the EventMatch objects. If this is your idea, can't a similar thing be done with an ExpectationCollection? Initially pushing the expected PropertyChangeEvent objects as expected values and then collecting the actual values? Ringo |