package org.jboss.test.messagedriven.support;
import javax.jms.Message;
public class CheckMessagePropertyOperation extends Operation
{
protected int msgNo;
protected String property;
protected Object value;
public CheckMessagePropertyOperation(BasicMessageDrivenUnitTest test, int msgNo, String property, Object value)
{
super(test);
this.msgNo = msgNo;
this.property = property;
this.value = value;
}
public void run() throws Exception
{
Message message = (Message) test.getMessages().get(msgNo);
if (message.propertyExists(property) == false)
throw new Exception("For msgNo=" + msgNo + " property does not exist property= " + property + " Expected=" + value + " msg=" + message);
Object actual = message.getObjectProperty(property);
if (value.equals(actual) == false)
throw new Exception("For msgNo=" + msgNo + " property= " + property + " Expected=" + value + " actual=" + actual + " msg=" + message);
}
}