public Rating getRatingForDensity(double value) {
    return ratingBounds.entrySet().stream()
      .filter(e -> e.getValue().match(value))
      .map(Map.Entry::getKey)
      .findFirst()
      .orElseThrow(() -> new IllegalArgumentException(format("Invalid value '%s'", value)));
  }
@Test
  public void fail_on_invalid_density() {
    assertThatThrownBy(() -> ratingGrid.getRatingForDensity(-1))
      .isInstanceOf(IllegalArgumentException.class)
      .hasMessage("Invalid value '-1.0'");
  }