measure.setVariation1(model.getVariationValue1());
measure.setVariation2(model.getVariationValue2());
measure.setVariation3(model.getVariationValue3());
+ measure.setVariation4(model.getVariationValue4());
+ measure.setVariation5(model.getVariationValue5());
measure.setUrl(model.getUrl());
measure.setCharacteristic(model.getCharacteristic());
return measure;
}
-}
+}
\ No newline at end of file
!(ResourceUtils.isEntity(resource) && isBestValueMeasure(measure, metric));
}
- private static boolean isBestValueMeasure(Measure measure, Metric metric) {
+ static boolean isBestValueMeasure(Measure measure, Metric metric) {
return measure.getId() == null &&
metric.isOptimizedBestValue() == Boolean.TRUE &&
metric.getBestValue() != null &&
- measure.getValue() != null &
- NumberUtils.compare(metric.getBestValue(), measure.getValue()) == 0 &&
+ (measure.getValue()==null || NumberUtils.compare(metric.getBestValue(), measure.getValue()) == 0) &&
measure.getAlertStatus() == null &&
measure.getDescription() == null &&
measure.getTendency() == null &&
duplicatedLines.setVariation1(-3.0);
assertThat(MeasurePersister.shouldPersistMeasure(file, duplicatedLines), is(true));
+ }
+ @Test
+ public void nullValueAndNullVariationsShouldBeConsideredAsBestValue() {
+ Measure measure = new Measure(CoreMetrics.NEW_VIOLATIONS_KEY);
+ assertThat(MeasurePersister.isBestValueMeasure(measure, CoreMetrics.NEW_VIOLATIONS), is(true));
}
}