@Test
  public void apply_returns_false_for_LEVEL_measure() {
    Predicate<Measure> underTest =
        BestValueOptimization.from(createMetric(Metric.MetricType.STRING, 36.5d), FILE_COMPONENT);

    assertThat(underTest.apply(newMeasureBuilder().create(Measure.Level.OK))).isFalse();
  }
  @Test
  public void apply_returns_false_if_measure_has_data_for_Boolean_Metric_and_best_value_1() {
    Predicate<Measure> underTest = BestValueOptimization.from(METRIC_BOOLEAN_TRUE, FILE_COMPONENT);

    assertThat(underTest.apply(newMeasureBuilder().create(true, SOME_DATA))).isFalse();
    assertThat(underTest.apply(newMeasureBuilder().create(false, SOME_DATA))).isFalse();
  }
  @Test
  public void apply_returns_false_for_String_measure() {
    Predicate<Measure> underTest =
        BestValueOptimization.from(createMetric(Metric.MetricType.FLOAT, 36.5d), FILE_COMPONENT);

    assertThat(underTest.apply(newMeasureBuilder().create("aaa"))).isFalse();
  }
  @Test
  public void apply_returns_false_if_component_is_not_a_FILE_for_Boolean_Metric_and_best_value_1() {
    Predicate<Measure> underTest =
        BestValueOptimization.from(METRIC_BOOLEAN_TRUE, SOME_NON_FILE_COMPONENT);

    assertThat(underTest.apply(newMeasureBuilder().create(true))).isFalse();
    assertThat(underTest.apply(newMeasureBuilder().create(false))).isFalse();
  }
  @Test
  public void
      apply_returns_false_if_measure_has_anything_else_than_value_for_Boolean_Metric_and_best_value_1() {
    Predicate<Measure> underTest = BestValueOptimization.from(METRIC_BOOLEAN_TRUE, FILE_COMPONENT);

    for (Measure.NewMeasureBuilder builder : builders_of_non_bestValueOptimized_measures()) {
      assertThat(underTest.apply(builder.create(true))).isFalse();
      assertThat(underTest.apply(builder.create(false))).isFalse();
    }
  }
  @Test
  public void verify_value_comparison_for_int_metric() {
    Predicate<Measure> underTest =
        BestValueOptimization.from(createMetric(Metric.MetricType.INT, 10), FILE_COMPONENT);

    assertThat(underTest.apply(newMeasureBuilder().create(10))).isTrue();
    assertThat(underTest.apply(newMeasureBuilder().setVariations(SOME_EMPTY_VARIATIONS).create(10)))
        .isTrue();
    assertThat(underTest.apply(newMeasureBuilder().create(11))).isFalse();
  }
  @Test
  public void apply_returns_true_for_value_false_for_Boolean_Metric_and_best_value_not_1() {
    Predicate<Measure> underTest = BestValueOptimization.from(METRIC_BOOLEAN_FALSE, FILE_COMPONENT);

    assertThat(underTest.apply(newMeasureBuilder().create(true))).isFalse();
    assertThat(underTest.apply(newMeasureBuilder().create(false))).isTrue();
    assertThat(
            underTest.apply(newMeasureBuilder().setVariations(SOME_EMPTY_VARIATIONS).create(false)))
        .isTrue();
  }