@Override
 public String analyze(Iterable<Mutation> mutations, HtmlReport report) {
   List<String> lines = new ArrayList<String>();
   for (Mutation mutation : mutations) {
     if (mutation.isKilled()) {
       MutationTestResult result = mutation.getMutationResult();
       Set<TestMessage> detecting = new HashSet<TestMessage>();
       Collection<TestMessage> failures = result.getFailures();
       detecting.addAll(failures);
       Collection<TestMessage> errors = result.getErrors();
       detecting.addAll(errors);
       String tests = getIds(detecting);
       String line = mutation.getId() + "," + tests;
       lines.add(line);
     }
   }
   Set<Entry<String, Integer>> entrySet = testsIds.entrySet();
   lines.add("Ids");
   for (Entry<String, Integer> entry : entrySet) {
     lines.add(entry.getKey() + "," + entry.getValue());
   }
   try {
     FileUtils.writeLines(new File("detectedByTest.csv"), lines);
   } catch (IOException e) {
     e.printStackTrace();
   }
   return Joiner.on("\n").join(lines);
 }
 /**
  * Removes the mutations that have a result from the given list of mutations.
  *
  * @param mutations the list of mutations to be filtered.
  */
 private static void filterMutationsWithResult(List<Mutation> mutations) {
   if (mutations != null) {
     // make sure that we have not got any mutations that have already an
     // result
     Session session = HibernateUtil.getSessionFactory().openSession();
     Transaction tx = session.beginTransaction();
     List<Mutation> toRemove = new ArrayList<Mutation>();
     for (Mutation m : mutations) {
       session.load(m, m.getId());
       if (m.getMutationResult() != null) {
         logger.debug("Found mutation that already has a mutation result " + m);
         toRemove.add(m);
       }
     }
     mutations.removeAll(toRemove);
     tx.commit();
     session.close();
   }
 }