Are you using the latest version of Activiti?
There is an undocumented feature that allows you to mock out service tasks, for example:
<code>
@Test
@Deployment(resources = {"org/activiti/standalone/testing/MockSupportWithActivitiRuleTest.testMockedServiceTaskAnnotation.bpmn20.xml"})
@MockServiceTask(id = "serviceTask", mockedClassName="org.activiti.standalone.testing.helpers.ServiceTaskTestMock")
public void testMockedServiceTaskByIdAnnotation() {
Assert.assertEquals(0, ServiceTaskTestMock.CALL_COUNT.get());
activitiRule.getRuntimeService().startProcessInstanceByKey("mockSupportTest");
Assert.assertEquals(1, ServiceTaskTestMock.CALL_COUNT.get());
}
@Test
@Deployment
@MockServiceTasks({
@MockServiceTask(originalClassName="com.yourcompany.delegate1", mockedClassName="org.activiti.standalone.testing.helpers.ServiceTaskTestMock"),
@MockServiceTask(originalClassName="com.yourcompany.delegate2", mockedClassName="org.activiti.standalone.testing.helpers.ServiceTaskTestMock")
})
public void testMockedServiceTasksAnnotation() {
Assert.assertEquals(0, ServiceTaskTestMock.CALL_COUNT.get());
activitiRule.getRuntimeService().startProcessInstanceByKey("mockSupportTest");
Assert.assertEquals(2, ServiceTaskTestMock.CALL_COUNT.get());
}
</code>