public static MockRepositoryImporter getMockRepositoryImporter(File mockRepository,
         ReferenceResolver referenceResolver) throws IOException {
      MockRepositoryImporter importer = null;

      // Analyse first lines of file content to guess repository type.
      String line = null;
      try (BufferedReader reader = Files.newBufferedReader(mockRepository.toPath(), StandardCharsets.UTF_8)) {
         while ((line = reader.readLine()) != null && importer == null) {
            line = line.trim();
            // Check with basic Postman formats..
            importer = checkPostmanImporters(line, mockRepository);
            // Then try OpenAPI related ones...
            if (importer == null) {
               importer = checkOpenAPIImporters(line, mockRepository, referenceResolver);
            }
            // Then try any other else.
            if (importer == null) {
               importer = checkOtherImporters(line, mockRepository, referenceResolver);
            }
         }
      }

      // Otherwise, default to SoapUI project importer implementation.
      if (importer == null) {
         log.info("Have not found any explicit marker so applying the default SoapUI Project importer...");
         importer = new SoapUIProjectImporter(mockRepository.getPath());
      }

      return importer;
   }
@Test
   void testGetMockRepositoryImporter() {

      // Load a SoapUI file.
      File soapUIProject = new File("../samples/HelloService-soapui-project.xml");
      MockRepositoryImporter importer = null;
      try {
         importer = MockRepositoryImporterFactory.getMockRepositoryImporter(soapUIProject, null);
      } catch (Throwable t) {
         fail("Getting importer for SoapUI should not fail!");
      }
      assertTrue(importer instanceof SoapUIProjectImporter);

      // Load a Postman file.
      File postmanCollection = new File("../samples/PetstoreAPI-collection.json");
      importer = null;
      try {
         importer = MockRepositoryImporterFactory.getMockRepositoryImporter(postmanCollection, null);
      } catch (Throwable t) {
         fail("Getting importer for Postman should not fail!");
      }
      assertTrue(importer instanceof PostmanCollectionImporter);

      // Load a Postman Workspace file.
      File postmanWorkspaceCollection = new File(
            "target/test-classes/io/github/microcks/util/postman/Swagger Petstore.postman_workspace_collection-2.1.json");
      importer = null;
      try {
         importer = MockRepositoryImporterFactory.getMockRepositoryImporter(postmanWorkspaceCollection, null);
      } catch (Throwable t) {
         fail("Getting importer for Postman Workspace should not fail!");
      }
      assertTrue(importer instanceof PostmanWorkspaceCollectionImporter);

      // Load an OpenAPI YAML file.
      importer = null;
      File openAPISpec = new File("target/test-classes/io/github/microcks/util/openapi/cars-openapi.yaml");
      try {
         importer = MockRepositoryImporterFactory.getMockRepositoryImporter(openAPISpec, null);
      } catch (Throwable t) {
         fail("Getting importer for OpenAPI YAML should not fail!");
      }
      assertTrue(importer instanceof OpenAPIImporter);

      // Load an OpenAPI JSON file.
      openAPISpec = new File("target/test-classes/io/github/microcks/util/openapi/cars-openapi.json");
      importer = null;
      try {
         importer = MockRepositoryImporterFactory.getMockRepositoryImporter(openAPISpec, null);
      } catch (Throwable t) {
         fail("Getting importer for OpenAPI JSON should not fail!");
      }
      assertTrue(importer instanceof OpenAPIImporter);

      // Load an OpenAPI JSON oneliner file.
      openAPISpec = new File("target/test-classes/io/github/microcks/util/openapi/openapi-oneliner.json");
      importer = null;
      try {
         importer = MockRepositoryImporterFactory.getMockRepositoryImporter(openAPISpec, null);
      } catch (Throwable t) {
         fail("Getting importer for OpenAPI JSON oneliner should not fail!");
      }
      assertTrue(importer instanceof OpenAPIImporter);

      // Load an AsyncAPI JSON file.
      File asyncAPISpec = new File("target/test-classes/io/github/microcks/util/asyncapi/user-signedup-asyncapi.json");
      importer = null;
      try {
         importer = MockRepositoryImporterFactory.getMockRepositoryImporter(asyncAPISpec, null);
      } catch (Throwable t) {
         fail("Getting importer for AsyncAPI JSON should not fail!");
      }
      assertTrue(importer instanceof AsyncAPIImporter);

      // Load an AsyncAPI JSON oneliner file.
      asyncAPISpec = new File(
            "target/test-classes/io/github/microcks/util/asyncapi/user-signedup-asyncapi-oneliner.json");
      importer = null;
      try {
         importer = MockRepositoryImporterFactory.getMockRepositoryImporter(asyncAPISpec, null);
      } catch (Throwable t) {
         fail("Getting importer for AsyncAPI JSON oneliner should not fail!");
      }
      assertTrue(importer instanceof AsyncAPIImporter);

      // Load an AsyncAPI YAML file.
      asyncAPISpec = new File("target/test-classes/io/github/microcks/util/asyncapi/user-signedup-asyncapi.yaml");
      importer = null;
      try {
         importer = MockRepositoryImporterFactory.getMockRepositoryImporter(asyncAPISpec, null);
      } catch (Throwable t) {
         fail("Getting importer for AsyncAPI YAML should not fail!");
      }
      assertTrue(importer instanceof AsyncAPIImporter);

      // Load an AsyncAPI v3 YAML file.
      asyncAPISpec = new File("target/test-classes/io/github/microcks/util/asyncapi/user-signedup-asyncapi-3.0.yaml");
      importer = null;
      try {
         importer = MockRepositoryImporterFactory.getMockRepositoryImporter(asyncAPISpec, null);
      } catch (Throwable t) {
         fail("Getting importer for AsyncAPI v3 YAML should not fail!");
      }
      assertTrue(importer instanceof AsyncAPI3Importer);

      // Load a Protobuf schema file.
      File protobufSchema = new File("target/test-classes/io/github/microcks/util/grpc/hello-v1.proto");
      importer = null;
      try {
         importer = MockRepositoryImporterFactory.getMockRepositoryImporter(protobufSchema, null);
      } catch (Throwable t) {
         fail("Getting importer for Protobuf should not fail!");
      }
      assertTrue(importer instanceof ProtobufImporter);

      // Load an APIMetadata file.
      File apiMetadata = new File("target/test-classes/io/github/microcks/util/metadata/hello-grpc-v1-metadata.yml");
      importer = null;
      try {
         importer = MockRepositoryImporterFactory.getMockRepositoryImporter(apiMetadata, null);
      } catch (Throwable t) {
         fail("Getting importer for APIMetadata should not fail!");
      }
      assertTrue(importer instanceof MetadataImporter);

      // Load a GraphQL schema file.
      File graphQLSchema = new File("target/test-classes/io/github/microcks/util/graphql/films.graphql");
      importer = null;
      try {
         importer = MockRepositoryImporterFactory.getMockRepositoryImporter(graphQLSchema, null);
      } catch (Throwable t) {
         fail("Getting importer for GraphQL should not fail!");
      }
      assertTrue(importer instanceof GraphQLImporter);

      // Load a Swagger v2 YAML file.
      File swaggerSpec = new File("target/test-classes/io/github/microcks/util/openapi/beer-catalog-api-swagger.yaml");
      importer = null;
      try {
         importer = MockRepositoryImporterFactory.getMockRepositoryImporter(swaggerSpec, null);
      } catch (Throwable t) {
         fail("Getting importer for Swagger v2 YAML should not fail!");
      }
      assertTrue(importer instanceof SwaggerImporter);

      // Load a Swagger v2 JSON file.
      swaggerSpec = new File("target/test-classes/io/github/microcks/util/openapi/beer-catalog-api-swagger.json");
      importer = null;
      try {
         importer = MockRepositoryImporterFactory.getMockRepositoryImporter(swaggerSpec, null);
      } catch (Throwable t) {
         fail("Getting importer for Swagger v2 JSON should not fail!");
      }
      assertTrue(importer instanceof SwaggerImporter);

      // Load a HAR JSON file.
      File harFile = new File("target/test-classes/io/github/microcks/util/har/api-pastries-0.0.1.har");
      importer = null;
      try {
         importer = MockRepositoryImporterFactory.getMockRepositoryImporter(harFile, null);
      } catch (IOException ioe) {
         fail("Getting importer for HAR JSON file should not fail!");
      }
      assertTrue(importer instanceof HARImporter);
   }