class VerifyMojo extends AbstractMojo {

  @Override
  public void execute() {

    String contractFileType = "yaml";

    switch (SourceType.valueOf(sourceType.toUpperCase())) {
      case CODE:
        try {
          sourceContractPath = FileUtils.createTempDirectory("target/tmp-contract").toFile().getCanonicalPath();
          GenerateUtil.generateContract(project, sourceContractPath, contractFileType, "default");
        } catch (RuntimeException | IOException e) {
          throw new RuntimeException("Failed to generate contract from code", e);
        }

        break;
      case CONTRACT:

        break;
      default:
        throw new RuntimeException("Not support source type " + sourceType);
    }

    try {
      Map<String, byte[]> sourceContractGroup = FileUtils.getFilesGroupByFilename(sourceContractPath);
      Map<String, byte[]> destinationContractGroup = FileUtils.getFilesGroupByFilename(destinationContractPath);

      sourceContractGroup.forEach((contractName, swagger) -> {

        byte[] sourceSwagger = destinationContractGroup.get(contractName);

        ContractComparator contractComparator = new ContractComparator(new String(sourceSwagger), new String(swagger));

        if (!contractComparator.equals()) {
          LOGGER.info("Contract is not matched, difference is as follows");
          LOGGER.info(destinationContractPath + "/" + contractName + " vs " + sourceContractPath + "/" + contractName);
          contractComparator.splitPrintToScreen();
        } else {
          LOGGER.info("Succee, contract verification passed");
        }
      });
    } catch (IOException e) {
      throw new RuntimeException("Failed to verify contract ", e);
    }
  }

}