@Override
   public List<Service> getServiceDefinitions() throws MockRepositoryImportException {
      List<Service> results = new ArrayList<>();

      // Start checking version and comment.
      String version = spec.path("log").path("version").asText();
      if (!VALID_VERSIONS.contains(version)) {
         throw new MockRepositoryImportException(
               "HAR version is not supported. Currently supporting: " + VALID_VERSIONS);
      }
      String comment = spec.path("log").path("comment").asText();
      if (comment == null || comment.length() == 0) {
         throw new MockRepositoryImportException(
               "Expecting a comment in HAR log to specify Microcks service identifier");
      }

      // We can start building something.
      Service service = new Service();
      service.setType(ServiceType.REST);

      // 1st thing: look for comments to get service and version identifiers.
      String[] commentLines = comment.split("\\r?\\n|\\r");
      for (String commentLine : commentLines) {
         if (commentLine.trim().startsWith(MICROCKS_ID_STARTER)) {
            String identifiers = commentLine.trim().substring(MICROCKS_ID_STARTER.length());

            if (identifiers.indexOf(":") != -1) {
               String[] serviceAndVersion = identifiers.split(":");
               service.setName(serviceAndVersion[0].trim());
               service.setVersion(serviceAndVersion[1].trim());
            } else {
               log.error("microcksId comment is malformed. Expecting \'microcksId: <API_name>:<API_version>\'");
               throw new MockRepositoryImportException(
                     "microcksId comment is malformed. Expecting \'microcksId: <API_name>:<API_version>\'");
            }
         } else if (commentLine.trim().startsWith(API_PREFIX_STARTER)) {
            apiPrefix = commentLine.trim().substring(API_PREFIX_STARTER.length()).trim();
            log.info("Found an API prefix to use for shortening URLs: {}", apiPrefix);
         }
      }
      if (service.getName() == null || service.getVersion() == null) {
         log.error("No microcksId: comment found into GraphQL schema to get API name and version");
         throw new MockRepositoryImportException(
               "No microcksId: comment found into GraphQL schema to get API name and version");
      }

      // Inspect requests content to determine the most probable service type.
      Map<ServiceType, Integer> requestsCounters = countRequestsByServiceType(
            spec.path("log").path("entries").elements());
      if ((requestsCounters.get(ServiceType.GRAPHQL) > requestsCounters.get(ServiceType.REST))
            && (requestsCounters.get(ServiceType.GRAPHQL) > requestsCounters.get(ServiceType.SOAP_HTTP))) {
         service.setType(ServiceType.GRAPHQL);
      } else if ((requestsCounters.get(ServiceType.SOAP_HTTP) > requestsCounters.get(ServiceType.REST))
            && (requestsCounters.get(ServiceType.SOAP_HTTP) > requestsCounters.get(ServiceType.GRAPHQL))) {
         service.setType(ServiceType.SOAP_HTTP);
      }

      // Extract service operations.
      service.setOperations(extractOperations(service.getType(), spec.path("log").path("entries").elements()));

      results.add(service);
      return results;
   }
@Test
   void testMissingCommentHARImport() {
      HARImporter importer = null;
      try {
         importer = new HARImporter("target/test-classes/io/github/microcks/util/har/microcks.har");
      } catch (IOException ioe) {
         fail("Exception should not be thrown");
      }
      // Check that basic service properties import fail because of missing comment.
      boolean failure = false;
      List<Service> services = null;
      try {
         services = importer.getServiceDefinitions();
      } catch (MockRepositoryImportException e) {
         failure = true;
         assertNotEquals(-1, e.getMessage().indexOf("Expecting a comment in HAR"));
      }
      assertTrue(failure);
   }