@Test
public void testGetSingleVariableInstanceSerialized() {
ObjectValue serializedValue = Variables.serializedObjectValue("a serialized value")
.serializationDataFormat("aDataFormat").objectTypeName("aTypeName").create();
MockHistoricVariableInstanceBuilder builder = MockProvider.mockHistoricVariableInstance().typedValue(serializedValue);
HistoricVariableInstance variableInstanceMock = builder.build();
when(variableInstanceQueryMock.variableId(variableInstanceMock.getId())).thenReturn(variableInstanceQueryMock);
when(variableInstanceQueryMock.disableBinaryFetching()).thenReturn(variableInstanceQueryMock);
when(variableInstanceQueryMock.disableCustomObjectDeserialization()).thenReturn(variableInstanceQueryMock);
when(variableInstanceQueryMock.singleResult()).thenReturn(variableInstanceMock);
given()
.pathParam("id", MockProvider.EXAMPLE_VARIABLE_INSTANCE_ID)
.queryParam("deserializeValue", false)
.then().expect().statusCode(Status.OK.getStatusCode())
.and()
.body("id", equalTo(builder.getId()))
.body("name", equalTo(builder.getName()))
.body("type", equalTo(VariableTypeHelper.toExpectedValueTypeName(builder.getTypedValue().getType())))
.body("value", equalTo("a serialized value"))
.body("valueInfo.serializationDataFormat", equalTo("aDataFormat"))
.body("valueInfo.objectTypeName", equalTo("aTypeName"))
.body("processInstanceId", equalTo(builder.getProcessInstanceId()))
.body("errorMessage", equalTo(builder.getErrorMessage()))
.body("activityInstanceId", equalTo(builder.getActivityInstanceId()))
.when().get(VARIABLE_INSTANCE_URL);
verify(variableInstanceQueryMock, times(1)).disableBinaryFetching();
verify(variableInstanceQueryMock, times(1)).disableCustomObjectDeserialization();
}