camunda/camunda-bpm-assert

.hasVariables should support Type information

StephenOTT opened this issue · 2 comments

Currently i am doing something like:

def historicVariableInstanceQuery = historyService().createHistoricVariableInstanceQuery().processInstanceId(processInstanceId)

assertThat(historicVariableInstanceQuery.list(), hasItems(
                                                          both(hasProperty("name", equalTo("myJSON"))).and(instanceOf(org.camunda.bpm.engine.impl.persistence.entity.HistoricVariableInstanceEntity.class)),
                                                          both(hasProperty("name", equalTo("mySpinVar"))).and(instanceOf(org.camunda.bpm.engine.impl.persistence.entity.HistoricVariableInstanceEntity.class)),
                                                          ));

and another variation:

def varNameType = historicVariableInstanceQuery.list().collectEntries({
                                                                       [(it.getName().toString()) : (it.getTypeName().toString())]
                                                                            })

This example creates a map of variables Names and their TypeNames

This would not be required if you could do a hasVariables on historic process instances AND you can check the Type of the variable.

This is important when dealing variables such as SPIN JSON where you are ensuring that specific variables are the expected type that other tasks depend on.

Hi Stephen,

thanks for opening this issue.
Could you clarify the behavior you would like to see in an example?
How would you rewrite your workarounds if this feature was available?

Thank you!

Best,
Tobias

Closing this as not specified enough.
Please feel free to open an issue in the Issue Tracker with more details.