public void testVariableInstanceRetrievalAsPost() {
String queryVariableName = "aVariableInstanceName";
Map<String, String> queryParameter = new HashMap<String, String>();
queryParameter.put("variableName", queryVariableName);
Response response = given().contentType(POST_JSON_CONTENT_TYPE).body(queryParameter)
.then().expect().statusCode(Status.OK.getStatusCode())
.and()
.body("size()", is(1))
.body("[0].id", equalTo(mockInstanceBuilder.getId()))
.body("[0].name", equalTo(mockInstanceBuilder.getName()))
.body("[0].type", equalTo(VariableTypeHelper.toExpectedValueTypeName(mockInstanceBuilder.getTypedValue().getType())))
.body("[0].value", equalTo(mockInstanceBuilder.getTypedValue().getValue()))
.body("[0].processInstanceId", equalTo(mockInstanceBuilder.getProcessInstanceId()))
.body("[0].executionId", equalTo(mockInstanceBuilder.getExecutionId()))
.body("[0].caseInstanceId", equalTo(mockInstanceBuilder.getCaseInstanceId()))
.body("[0].caseExecutionId", equalTo(mockInstanceBuilder.getCaseExecutionId()))
.body("[0].taskId", equalTo(mockInstanceBuilder.getTaskId()))
.body("[0].activityInstanceId", equalTo(mockInstanceBuilder.getActivityInstanceId()))
.body("[0].errorMessage", equalTo(mockInstanceBuilder.getErrorMessage()))
.body("[0].serializedValue", nullValue())
.when().post(VARIABLE_INSTANCE_QUERY_URL);
// assert query invocation
InOrder inOrder = Mockito.inOrder(mockedQuery);
inOrder.verify(mockedQuery).variableName(queryVariableName);
inOrder.verify(mockedQuery).list();
String content = response.asString();
List<String> variables = from(content).getList("");
Assert.assertEquals("There should be one process definition returned.", 1, variables.size());
Assert.assertNotNull("There should be one process definition returned", variables.get(0));
verify(mockedQuery).disableBinaryFetching();