use of org.camunda.spin.SpinRuntimeException in project camunda-bpm-platform by camunda.
the class XmlValueTest method testFailingDeserialization.
@Deployment(resources = ONE_TASK_PROCESS)
public void testFailingDeserialization() {
// given
XmlValue value = xmlValue(brokenXmlString).create();
String processInstanceId = runtimeService.startProcessInstanceByKey(ONE_TASK_PROCESS_KEY).getId();
runtimeService.setVariable(processInstanceId, variableName, value);
try {
// when
runtimeService.getVariable(processInstanceId, variableName);
fail("exception expected");
} catch (ProcessEngineException e) {
// happy path
}
try {
runtimeService.getVariableTyped(processInstanceId, variableName);
fail("exception expected");
} catch (ProcessEngineException e) {
// happy path
}
// However, I can access the serialized value
XmlValue xmlValue = runtimeService.getVariableTyped(processInstanceId, variableName, false);
assertFalse(xmlValue.isDeserialized());
assertEquals(brokenXmlString, xmlValue.getValueSerialized());
// but not the deserialized properties
try {
xmlValue.getValue();
fail("exception expected");
} catch (SpinRuntimeException e) {
}
}
use of org.camunda.spin.SpinRuntimeException in project camunda-bpm-platform by camunda.
the class JsonValueTest method testFailingDeserialization.
@Deployment(resources = ONE_TASK_PROCESS)
public void testFailingDeserialization() {
// given
JsonValue value = jsonValue(brokenJsonString).create();
String processInstanceId = runtimeService.startProcessInstanceByKey(ONE_TASK_PROCESS_KEY).getId();
runtimeService.setVariable(processInstanceId, variableName, value);
try {
// when
runtimeService.getVariable(processInstanceId, variableName);
fail("exception expected");
} catch (ProcessEngineException e) {
// happy path
}
try {
runtimeService.getVariableTyped(processInstanceId, variableName);
fail("exception expected");
} catch (ProcessEngineException e) {
// happy path
}
// However, I can access the serialized value
JsonValue jsonValue = runtimeService.getVariableTyped(processInstanceId, variableName, false);
assertFalse(jsonValue.isDeserialized());
assertEquals(brokenJsonString, jsonValue.getValueSerialized());
// but not the deserialized properties
try {
jsonValue.getValue();
fail("exception expected");
} catch (SpinRuntimeException e) {
}
}
Aggregations