MULE-7840: Fixing broken test.

Think we should reuse this logic extracting it to a common place