Skip to content

Commit

Permalink
Unwrap variable instance list of values for contains element check
Browse files Browse the repository at this point in the history
  • Loading branch information
igdianov committed Nov 16, 2024
1 parent 6bf785a commit c725f8a
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
import org.activiti.cloud.acc.shared.service.BaseService;
import org.activiti.cloud.api.model.shared.CloudVariableInstance;
import org.activiti.cloud.api.process.model.CloudProcessInstance;
import org.assertj.core.api.InstanceOfAssertFactories;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.hateoas.PagedModel;
Expand Down Expand Up @@ -128,8 +129,12 @@ public void checkProcessInstanceHasVariableValue(
.stream()
.filter(it -> it.getName().equals(variableName))
.map(CloudVariableInstance::getValue)
.toList()
.map(value -> value instanceof List<?> listOfValues ? listOfValues : List.of(value))
.findFirst()
)
.isNotEmpty()
.get()
.asInstanceOf(InstanceOfAssertFactories.LIST)
.containsExactlyInAnyOrderElementsOf(
variableValue instanceof List<?> variableValues ? variableValues : List.of(variableValue)
);
Expand Down

0 comments on commit c725f8a

Please sign in to comment.