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 density_matching_exact_grid_values() {
    assertThat(ratingGrid.getRatingForDensity(0.1)).isEqualTo(A);
    assertThat(ratingGrid.getRatingForDensity(0.2)).isEqualTo(B);
    assertThat(ratingGrid.getRatingForDensity(0.5)).isEqualTo(C);
    assertThat(ratingGrid.getRatingForDensity(1)).isEqualTo(D);
  }