String metric2Key = "palap";
QualityGateConditionDto cond1 = new QualityGateConditionDto().setMetricId(metric1Id);
QualityGateConditionDto cond2 = new QualityGateConditionDto().setMetricId(metric2Id);
Collection<QualityGateConditionDto> conditions = ImmutableList.of(cond1, cond2);
when(conditionDao.selectForQualityGate(qGateId)).thenReturn(conditions);
Metric metric1 = mock(Metric.class);
when(metric1.getKey()).thenReturn(metric1Key);
when(metricFinder.findById((int) metric1Id)).thenReturn(metric1);
Metric metric2 = mock(Metric.class);
when(metric2.getKey()).thenReturn(metric2Key);
when(metricFinder.findById((int) metric2Id)).thenReturn(metric2);
assertThat(qGates.listConditions(qGateId)).isEqualTo(conditions);
Iterator<QualityGateConditionDto> iterator = conditions.iterator();
assertThat(iterator.next().getMetricKey()).isEqualTo(metric1Key);
assertThat(iterator.next().getMetricKey()).isEqualTo(metric2Key);