class ContractsGitLoader implements ContractsRetriever {

    protected Path getContractsFolderFromGitRepo() throws IOException {
        Path location = null;
        Git git = null;
        try {
            if (isSet(this.contractsGit.repository())) {

                Path repository = Paths.get(getResolvedValue(this.contractsGit.repository()));

                if (this.gitOperations.isValidGitRepository(repository)) {

                    git = this.gitOperations.openGitRepository(repository);
                    if (this.gitOperations.hasAtLeastOneReference(git.getRepository())) {

                        final PullResult pullResult = executePull(git);

                        if (pullResult.isSuccessful()) {
                            location = moveToCorrectLocation(git);
                        } else {
                            // Merge conflicts
                            throw new IllegalArgumentException(
                                "There are merge conflicts into an existing git repo. Provider should not deal with merge conflicts. Correct them or delete the repo and execute again the test.");
                        }
                    } else {
                        throw new IllegalArgumentException(String.format("Git repository %s was not cloned correctly.",
                                                                         git.getRepository().getDirectory().getAbsolutePath()));
                    }
                } else {
                    logger.log(Level.INFO, String.format(
                        "%s directory is not a git directory or does not exists and it is going to be deleted and cloned",
                        repository));

                    Files.deleteIfExists(repository);
                    Files.createDirectories(repository);
                    git = executeClone(repository);
                    location = moveToCorrectLocation(git);
                }
            } else {
                // Put files in a temp directory
                final Path testGitRepository = Files.createTempDirectory("TestGitRepository");

                logger.log(Level.INFO, String.format("Repository is going to be cloned at %s", testGitRepository));

                git = executeClone(testGitRepository);
                location = moveToCorrectLocation(git);
            }
        } finally {
            if (git != null) {
                git.close();
            }
        }

        return location;
    }

    public  ContractsGitLoader();
    public  ContractsGitLoader(ContractsGit contractsGit);

}