Fix flaky tests by adding a custom matcher

- when checking maps of Cardinalities we need to make sure we have a
  internally a tolerance when comparing doubles