private void createProcessInstanceMock() { ProcessInstance mockInstance = MockProvider.createMockInstance(); ProcessInstanceQuery mockInstanceQuery = mock(typeof(ProcessInstanceQuery)); when(mockInstanceQuery.processInstanceId(eq(MockProvider.EXAMPLE_PROCESS_INSTANCE_ID))).thenReturn(mockInstanceQuery); when(mockInstanceQuery.singleResult()).thenReturn(mockInstance); when(mockRuntimeService.createProcessInstanceQuery()).thenReturn(mockInstanceQuery); }