private CodeQualityMetric makeMetric() {
   CodeQualityMetric metric = new CodeQualityMetric("critical");
   metric.setFormattedValue("10");
   metric.setStatus(CodeQualityMetricStatus.Ok);
   metric.setStatusMessage("Ok");
   metric.setValue(new Integer(0));
   return metric;
 }
 @Test
 public void securityQualities() throws Exception {
   CodeQuality quality = makeSecurityAnalysis();
   Iterable<CodeQuality> qualities = Arrays.asList(quality);
   DataResponse<Iterable<CodeQuality>> response = new DataResponse<>(qualities, 1);
   CodeQualityMetric metric = makeMetric();
   when(codeQualityService.search(Mockito.any(CodeQualityRequest.class))).thenReturn(response);
   mockMvc
       .perform(get("/quality/security-analysis?componentId=" + ObjectId.get() + "&max=1"))
       .andExpect(status().isOk())
       .andExpect(jsonPath("$result", hasSize(1)))
       .andExpect(jsonPath("$result[0].id", is(quality.getId().toString())))
       .andExpect(
           jsonPath("$result[0].collectorItemId", is(quality.getCollectorItemId().toString())))
       .andExpect(jsonPath("$result[0].timestamp", is(intVal(quality.getTimestamp()))))
       .andExpect(jsonPath("$result[0].name", is(quality.getName())))
       .andExpect(jsonPath("$result[0].url", is(quality.getUrl())))
       .andExpect(jsonPath("$result[0].type", is(quality.getType().toString())))
       .andExpect(jsonPath("$result[0].version", is(quality.getVersion())))
       .andExpect(jsonPath("$result[0].metrics[0].name", is(metric.getName())))
       .andExpect(jsonPath("$result[0].metrics[0].formattedValue", is(metric.getFormattedValue())))
       .andExpect(jsonPath("$result[0].metrics[0].status", is(metric.getStatus().toString())));
 }