use of org.camunda.bpm.engine.rest.helper.MockVariableInstanceBuilder in project camunda-bpm-platform by camunda.
the class VariableInstanceRestServiceInteractionTest method testGetSingleVariableInstance.
@Test
public void testGetSingleVariableInstance() {
MockVariableInstanceBuilder builder = MockProvider.mockVariableInstance();
VariableInstance 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).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(builder.getTypedValue().getValue())).body("processInstanceId", equalTo(builder.getProcessInstanceId())).body("executionId", equalTo(builder.getExecutionId())).body("caseInstanceId", equalTo(builder.getCaseInstanceId())).body("caseExecutionId", equalTo(builder.getCaseExecutionId())).body("taskId", equalTo(builder.getTaskId())).body("activityInstanceId", equalTo(builder.getActivityInstanceId())).body("tenantId", equalTo(builder.getTenantId())).body("errorMessage", equalTo(builder.getErrorMessage())).when().get(VARIABLE_INSTANCE_URL);
verify(variableInstanceQueryMock, times(1)).disableBinaryFetching();
}
Aggregations