{
Object actualValue = hc.getTokenContext().getProcessVariableValue(variableName);
if (actualValue != null)
{
String msg = LogUtil.error(getClass(), "Test case assert failed: Expected null value for variable $0, actual value: $1", variableName, actualValue);
throw new EngineException("TestCaseAssertFailed", msg);
}
}
else if ("<notnull>".equals(expectedValue))
{
Object actualValue = hc.getTokenContext().getProcessVariableValue(variableName);
if (actualValue == null)
{
String msg = LogUtil.error(getClass(), "Test case assert failed: Expected non-null value for variable $0, actual value: $1", variableName, actualValue);
throw new EngineException("TestCaseAssertFailed", msg);
}
}
else if ("<present>".equals(expectedValue))
{
if (! hc.getTokenContext().hasProcessVariableValue(variableName))
{
String msg = LogUtil.error(getClass(), "Test case assert failed: Process variable $0 is not present, but should be", variableName);
throw new EngineException("TestCaseAssertFailed", msg);
}
}
else if ("<notpresent>".equals(expectedValue))
{
if (hc.getTokenContext().hasProcessVariableValue(variableName))
{
String msg = LogUtil.error(getClass(), "Test case assert failed: Process variable $0 is present, but should not be", variableName);
throw new EngineException("TestCaseAssertFailed", msg);
}
}
else
{
Object actualValue = hc.getTokenContext().getProcessVariableValue(variableName);
if (! CommonUtil.equalsNull(expectedValue, actualValue))
{
String msg = LogUtil.error(getClass(), "Test case assert failed: Expected value for variable $0: $1, actual value: $2", variableName, expectedValue, actualValue);
throw new EngineException("TestCaseAssertFailed", msg);
}
}
return true;
}