String variableKey = "aVariableKey";
String variableValue = "aVariableValue";
Map<String, Object> variableJson = VariablesBuilder.getVariableValueMap(variableValue);
doThrow(new BadUserRequestException("expected exception"))
.when(runtimeServiceMock).setVariableLocal(eq(MockProvider.EXAMPLE_EXECUTION_ID), eq(variableKey), any());
given().pathParam("id", MockProvider.EXAMPLE_EXECUTION_ID).pathParam("varId", variableKey)
.contentType(ContentType.JSON).body(variableJson)
.then().expect().statusCode(Status.BAD_REQUEST.getStatusCode())