Search in sources :

Example 1 with XmlValueBuilder

use of org.camunda.spin.plugin.variable.value.builder.XmlValueBuilder in project camunda-bpm-platform by camunda.

the class XmlValueTest method testFailForNonExistingSerializationFormat.

@Deployment(resources = ONE_TASK_PROCESS)
public void testFailForNonExistingSerializationFormat() {
    // given
    XmlValueBuilder builder = xmlValue(xmlString).serializationDataFormat("non existing data format");
    String processInstanceId = runtimeService.startProcessInstanceByKey(ONE_TASK_PROCESS_KEY).getId();
    try {
        // when (1)
        runtimeService.setVariable(processInstanceId, variableName, builder);
        fail("Exception expected");
    } catch (ProcessEngineException e) {
        // then (1)
        assertTextPresent("Cannot find serializer for value", e.getMessage());
    // happy path
    }
    try {
        // when (2)
        runtimeService.setVariable(processInstanceId, variableName, builder.create());
        fail("Exception expected");
    } catch (ProcessEngineException e) {
        // then (2)
        assertTextPresent("Cannot find serializer for value", e.getMessage());
    // happy path
    }
}
Also used : XmlValueBuilder(org.camunda.spin.plugin.variable.value.builder.XmlValueBuilder) ProcessEngineException(org.camunda.bpm.engine.ProcessEngineException) Deployment(org.camunda.bpm.engine.test.Deployment)

Aggregations

ProcessEngineException (org.camunda.bpm.engine.ProcessEngineException)1 Deployment (org.camunda.bpm.engine.test.Deployment)1 XmlValueBuilder (org.camunda.spin.plugin.variable.value.builder.XmlValueBuilder)1