}
@Override
public boolean matches(Object argument)
{
ServerNotification notification = (ServerNotification) argument;
if (exceptionExpected)
{
MessagingException exception = null;
if (notification instanceof PipelineMessageNotification)
{
exception = ((PipelineMessageNotification) notification).getException();
}
else if (notification instanceof AsyncMessageNotification)
{
exception = ((AsyncMessageNotification) notification).getException();
}
return expectedAction == notification.getAction() && exception != null
&& notification.getSource() != null
&& (this.event == null || this.event == notification.getSource());
}
else
{
return expectedAction == notification.getAction() && notification.getSource() != null
&& (this.event == null || this.event == notification.getSource());
}
}