@Test(expected = IllegalStateException.class) public void toMeasure_for_LEVEL_Metric_ignores_data() { MeasureDto measureDto = new MeasureDto().setAlertStatus(Level.ERROR.name()).setData(SOME_DATA); Optional<Measure> measure = underTest.toMeasure(measureDto, SOME_LEVEL_METRIC); assertThat(measure).isPresent(); measure.get().getStringValue(); }
@Test public void toMeasure_for_LEVEL_Metric_can_have_an_qualityGateStatus() { MeasureDto measureDto = new MeasureDto() .setData(Level.OK.name()) .setAlertStatus(Level.ERROR.name()) .setAlertText(SOME_ALERT_TEXT); Optional<Measure> measure = underTest.toMeasure(measureDto, SOME_LEVEL_METRIC); assertThat(measure).isPresent(); assertThat(measure.get().getValueType()).isEqualTo(Measure.ValueType.LEVEL); assertThat(measure.get().getLevelValue()).isEqualTo(Level.OK); assertThat(measure.get().getQualityGateStatus().getStatus()).isEqualTo(Level.ERROR); assertThat(measure.get().getQualityGateStatus().getText()).isEqualTo(SOME_ALERT_TEXT); }