jadex.bdi.testcases.misc.CodecTestPlan Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jadex-applications-bdi Show documentation
Show all versions of jadex-applications-bdi Show documentation
The Jadex BDI applications package contain
several example applications, benchmarks and
testcases using BDI agents.
package jadex.bdi.testcases.misc;
import jadex.base.test.TestReport;
import jadex.bdi.runtime.IMessageEvent;
import jadex.bdi.runtime.Plan;
import jadex.bridge.fipa.SFipa;
/**
* Test if custom message codec works.
*/
public class CodecTestPlan extends Plan
{
/**
* The plan body.
*/
public void body()
{
Object recontent = ((IMessageEvent)getReason()).getParameter(SFipa.CONTENT).getValue();
TestReport tr = new TestReport("#1", "Send and receive message with custom codec.");
// if(content.equals(recontent))
if(recontent instanceof Integer && ((Integer)recontent).intValue()==98)
{
tr.setSucceeded(true);
}
else
{
tr.setReason("Received wrong result: "+recontent);
}
getBeliefbase().getBeliefSet("testcap.reports").addFact(tr);
}
}