private CodeQuality makeSecurityAnalysis() {
   CodeQuality quality = new CodeQuality();
   quality.setId(ObjectId.get());
   quality.setCollectorItemId(ObjectId.get());
   quality.setTimestamp(1);
   quality.setName("MyFortify");
   quality.setType(CodeQualityType.SecurityAnalysis);
   quality.setUrl("http://mycompany.fortify.ssc.com/MyFortify");
   quality.setVersion("dev");
   quality.getMetrics().add(makeMetric());
   return quality;
 }
 private CodeQuality makeCodeQualityStatic() {
   CodeQuality quality = new CodeQuality();
   quality.setId(ObjectId.get());
   quality.setCollectorItemId(ObjectId.get());
   quality.setTimestamp(1);
   quality.setName("MyTest");
   quality.setType(CodeQualityType.StaticAnalysis);
   quality.setUrl("http://mycompany.sonar.com/MyTest");
   quality.setVersion("1.0.0.1");
   quality.getMetrics().add(makeMetric());
   return quality;
 }
 @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())));
 }