Cast exception during test

Hi there!

I’m having a problem during testing my process.
Here is my code:

TaskService taskService = rule.getTaskService();
Task task = taskService.createTaskQuery().singleResult();
taskService.complete(task.getId(), variables);

Variables is a map full of values to my dmn tables. When I try to unit test it, it gives the following error:
org.camunda.bpm.engine.impl.persistence.entity.TaskEntity cannot be cast to org.camunda.bpm.model.bpmn.instance.Task

Even if i try to cast it explicit, gives this error?
Has anyone met this kind of error before?
How can it be resolved?

thanks for the help

You are looking for the interface org.camunda.bpm.engine.task.Task.


1 Like