<commit_before>package io.magentys.donut.gherkin

import java.io.File

import io.magentys.donut.DonutTestData
import org.scalatest.{FlatSpec, Matchers}

class GeneratorTest extends FlatSpec with Matchers {

  behavior of "Generator"

  it should "should return error if it tries to parse an invalid file" in {
    Generator.createReport("cucumber:src/test/resources/samples-weirdos", projectName = "", projectVersion = "") shouldBe Left("Json could not be parsed for src/test/resources/samples-weirdos/invalid_format.json,")
  }

  it should "throw an exception if cucumber/specflow source directory is not provided" in {
    val sourcePaths = ""
    val exception = intercept[DonutException] {
      Generator.createReport(sourcePaths, projectName = "", projectVersion = "")
    }
    assert(exception.mgs === "Unable to extract the path to cucumber/specflow reports. Please use this format:- cucumber:/my/path/cucumber-reports,/my/path/nunit-reports")
  }

  it should "throw an exception if cucumber/specflow source path is not specified with correct identier 'cucumber:' or 'specflow'" in {
    val sourcePaths = "src/test/resources/samples-1"
    val exception = intercept[DonutException] {
      Generator.createReport(sourcePaths, projectName = "", projectVersion = "")
    }
    assert(exception.mgs === "Unable to extract the path to cucumber/specflow reports. Please use this format:- cucumber:/my/path/cucumber-reports,/my/path/nunit-reports")
  }

  it should "return an error message if cucumber/specflow source directory does not exist" in {
    Generator.createReport("cucumber:src/test/resources/non-existing-dir", projectName = "", projectVersion = "") shouldBe Left("Source directory doesn't exist")
  }

  it should "return an error message if json files not found" in {
    Generator.createReport("cucumber:src/test/resources/samples-empty", projectName = "", projectVersion = "") shouldBe Left("No files found of correct format")
  }

  it should "return report if valid json files are found" in {
    Generator.createReport("cucumber:src/test/resources/samples-1", projectName = "", projectVersion = "") match {
      case Left(e) => fail(e)
      case Right(r) =>
        r should not be null
    }
  }
<commit_msg>Added a missing integration test<commit_after>package io.magentys.donut.gherkin

import java.io.File

import io.magentys.donut.DonutTestData
import org.scalatest.{FlatSpec, Matchers}

class GeneratorTest extends FlatSpec with Matchers {

  behavior of "Generator"

  it should "should return error if it tries to parse an invalid file" in {
    Generator.createReport("cucumber:src/test/resources/samples-weirdos", projectName = "", projectVersion = "") shouldBe Left("Json could not be parsed for src/test/resources/samples-weirdos/invalid_format.json,")
  }

  it should "throw an exception if cucumber/specflow source directory is not provided" in {
    val sourcePaths = ""
    val exception = intercept[DonutException] {
      Generator.createReport(sourcePaths, projectName = "", projectVersion = "")
    }
    assert(exception.mgs === "Unable to extract the path to cucumber/specflow reports. Please use this format:- cucumber:/my/path/cucumber-reports,/my/path/nunit-reports")
  }

  it should "throw an exception if cucumber/specflow source path is not specified with correct identier 'cucumber:' or 'specflow'" in {
    val sourcePaths = "src/test/resources/samples-1"
    val exception = intercept[DonutException] {
      Generator.createReport(sourcePaths, projectName = "", projectVersion = "")
    }
    assert(exception.mgs === "Unable to extract the path to cucumber/specflow reports. Please use this format:- cucumber:/my/path/cucumber-reports,/my/path/nunit-reports")
  }

  it should "return an error message if cucumber/specflow source directory does not exist" in {
    Generator.createReport("cucumber:src/test/resources/non-existing-dir", projectName = "", projectVersion = "") shouldBe Left("Source directory doesn't exist")
  }

  it should "return an error message if json files not found" in {
    Generator.createReport("cucumber:src/test/resources/samples-empty", projectName = "", projectVersion = "") shouldBe Left("No files found of correct format")
  }

  it should "return report if valid cuke json files are found" in {
    Generator.createReport("cucumber:src/test/resources/samples-1", projectName = "", projectVersion = "") match {
      case Left(e) => fail(e)
      case Right(r) =>
        r should not be null
    }
  }

  it should "return report if valid cuke & unit json files are found" in {
    Generator.createReport("cucumber:src/test/resources/cuke-and-unit/cuke,src/test/resources/cuke-and-unit/unit", projectName = "", projectVersion = "") match {
      case Left(e) => fail(e)
      case Right(r) =>
        r should not be null
    }
  }

{'fraction_non_alphanumeric': 0.1093167701863354, 'fraction_numerical': 0.0008281573498964803, 'mean_word_length': 4.074579831932773, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3107391', 'n_tokens_mistral': 1426, 'n_tokens_neox': 1363, 'n_words': 410}