import com.google.common.base.Predicate;
import com.google.common.base.Strings;
import com.google.common.collect.Collections2;
+import org.apache.commons.lang.BooleanUtils;
import org.apache.commons.lang.StringUtils;
import org.apache.ibatis.session.SqlSession;
import org.elasticsearch.common.collect.Lists;
}
private boolean isAlertable(Metric metric) {
- return !metric.isDataType() && !metric.isHidden() && !CoreMetrics.ALERT_STATUS.equals(metric) && ValueType.RATING != metric.getType();
+ return !metric.isDataType() && BooleanUtils.isFalse(metric.isHidden()) && !CoreMetrics.ALERT_STATUS.equals(metric) && ValueType.RATING != metric.getType();
}
private boolean isDefault(QualityGateDto qGate) {
when(dataMetric.isDataType()).thenReturn(true);
Metric hiddenMetric = mock(Metric.class);
when(hiddenMetric.isHidden()).thenReturn(true);
+ Metric nullHiddenMetric = mock(Metric.class);
+ when(nullHiddenMetric.isHidden()).thenReturn(null);
Metric alertMetric = CoreMetrics.ALERT_STATUS;
Metric ratingMetric = mock(Metric.class);
when(ratingMetric.getType()).thenReturn(ValueType.RATING);
Metric classicMetric = mock(Metric.class);
when(classicMetric.getType()).thenReturn(ValueType.BOOL);
when(metricFinder.findAll()).thenReturn(ImmutableList.of(
- dataMetric, hiddenMetric, alertMetric, ratingMetric, classicMetric));
+ dataMetric, hiddenMetric, nullHiddenMetric, alertMetric, ratingMetric, classicMetric));
assertThat(qGates.gateMetrics()).hasSize(1).containsOnly(classicMetric);
}
}