|
|
@@ -79,6 +79,38 @@ public class QualityGateDetailsDataTest { |
|
|
|
"}"); |
|
|
|
} |
|
|
|
|
|
|
|
@Test |
|
|
|
public void verify_json_for_condition_on_leak_metric() { |
|
|
|
String value = "actualValue"; |
|
|
|
Condition condition = new Condition(new MetricImpl(1, "new_key1", "name1", Metric.MetricType.STRING), Condition.Operator.GREATER_THAN.getDbValue(), "errorTh"); |
|
|
|
ImmutableList<EvaluatedCondition> evaluatedConditions = ImmutableList.of( |
|
|
|
new EvaluatedCondition(condition, Measure.Level.OK, value), |
|
|
|
new EvaluatedCondition(condition, Measure.Level.ERROR, value)); |
|
|
|
String actualJson = new QualityGateDetailsData(Measure.Level.OK, evaluatedConditions, false).toJson(); |
|
|
|
|
|
|
|
JsonAssert.assertJson(actualJson).isSimilarTo("{" + |
|
|
|
"\"level\":\"OK\"," + |
|
|
|
"\"conditions\":[" + |
|
|
|
" {" + |
|
|
|
" \"metric\":\"new_key1\"," + |
|
|
|
" \"op\":\"GT\"," + |
|
|
|
" \"error\":\"errorTh\"," + |
|
|
|
" \"actual\":\"actualValue\"," + |
|
|
|
" \"period\":1," + |
|
|
|
" \"level\":\"OK\"" + |
|
|
|
" }," + |
|
|
|
" {" + |
|
|
|
" \"metric\":\"new_key1\"," + |
|
|
|
" \"op\":\"GT\"," + |
|
|
|
" \"error\":\"errorTh\"," + |
|
|
|
" \"actual\":\"actualValue\"," + |
|
|
|
" \"period\":1," + |
|
|
|
" \"level\":\"ERROR\"" + |
|
|
|
" }" + |
|
|
|
"]" + |
|
|
|
"}"); |
|
|
|
} |
|
|
|
|
|
|
|
@Test |
|
|
|
public void verify_json_for_small_leak() { |
|
|
|
String actualJson = new QualityGateDetailsData(Measure.Level.OK, Collections.emptyList(), false).toJson(); |