Search in sources :

Example 6 with MockVariableInstanceBuilder

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();
}
Also used : MockVariableInstanceBuilder(org.camunda.bpm.engine.rest.helper.MockVariableInstanceBuilder) VariableInstance(org.camunda.bpm.engine.runtime.VariableInstance) Test(org.junit.Test)

Aggregations

MockVariableInstanceBuilder (org.camunda.bpm.engine.rest.helper.MockVariableInstanceBuilder)6 VariableInstance (org.camunda.bpm.engine.runtime.VariableInstance)6 Test (org.junit.Test)6 MockObjectValue (org.camunda.bpm.engine.rest.helper.MockObjectValue)2 FileValue (org.camunda.bpm.engine.variable.value.FileValue)2 ObjectValue (org.camunda.bpm.engine.variable.value.ObjectValue)2 CoreMatchers.containsString (org.hamcrest.CoreMatchers.containsString)2 Response (com.jayway.restassured.response.Response)1