<commit_before>package com.thoughtworks.pact.verify.junit


import scala.xml.Elem

/**
  * Created by xfwu on 12/07/2017.
  */
object JunitReport {

  def dumpJUnitReport(reportDirPath: String, testSuitesSeq: Seq[TestSuites]): Unit = {
    testSuitesSeq.map(tss => dumpJUnitReport(reportDirPath, tss))
  }

  private def dumpJUnitReport(dir: String, testSuites: TestSuites): Unit = {
    val report = generateJUnitTestSuitesReport(testSuites)
    xml.XML.save(s"$dir/${testSuites.name}.xml", report, "UTF-8", true)
  }

  private def generateJUnitTestSuitesReport(testSuites: TestSuites): Elem = {
    <testsuites disabled=" " errors={testSuites.errors.toString} failures={testSuites.failures.toString} name={testSuites.name} tests=" " time={testSuites.time}>
      {testSuites.testSuites.map(generateJUnitTestSuiteReport)}
    </testsuites>
  }

  private def generateJUnitTestSuiteReport(testSuite: TestSuite): Elem = {
    <testsuite disabled=" " errors={testSuite.errors.toString} failures={testSuite.failures.toString} hostname=" " id=" " name={testSuite.name} package=" " skipped=" " tests={testSuite.tests.toString} time={testSuite.time.toString} timestamp={testSuite.timestamp}>
      {testSuite.cases.map(generateJUnitTestCaseReport)}
    </testsuite>
  }

  private def generateJUnitTestCaseReport(testCase: TestCase): Elem = {
    <testcase assertions=" " classname={testCase.className} name={testCase.name} status=" " time={testCase.time.toString}>
      {testCase.error.map(err => <error type={err.typ}>
      {err.message}
    </error>).getOrElse(xml.Null)}{testCase.failure.map(fail => <failure type={fail.typ}>
      {fail.message}
    </failure>).getOrElse(xml.Null)}
    </testcase>
  }
}
<commit_msg>fix report test case status<commit_after>package com.thoughtworks.pact.verify.junit


import scala.xml.Elem

/**
  * Created by xfwu on 12/07/2017.
  */
object JunitReport {

  def dumpJUnitReport(reportDirPath: String, testSuitesSeq: Seq[TestSuites]): Unit = {
    testSuitesSeq.map(tss => dumpJUnitReport(reportDirPath, tss))
  }

  private def dumpJUnitReport(dir: String, testSuites: TestSuites): Unit = {
    val report = generateJUnitTestSuitesReport(testSuites)
    xml.XML.save(s"$dir/${testSuites.name}.xml", report, "UTF-8", true)
  }

  private def generateJUnitTestSuitesReport(testSuites: TestSuites): Elem = {
    <testsuites disabled=" " errors={testSuites.errors.toString} failures={testSuites.failures.toString} name={testSuites.name} tests=" " time={testSuites.time}>
      {testSuites.testSuites.map(generateJUnitTestSuiteReport)}
    </testsuites>
  }

  private def generateJUnitTestSuiteReport(testSuite: TestSuite): Elem = {
    <testsuite disabled=" " errors={testSuite.errors.toString} failures={testSuite.failures.toString} hostname=" " id=" " name={testSuite.name} package=" " skipped=" " tests={testSuite.tests.toString} time={testSuite.time.toString} timestamp={testSuite.timestamp}>
      {testSuite.cases.map(generateJUnitTestCaseReport)}
    </testsuite>
  }

  private def generateJUnitTestCaseReport(testCase: TestCase): Elem = {
    <testcase assertions={testCase.assertions} classname={testCase.className} name={testCase.name} status={testCase.status} time={testCase.time.toString}>
      {testCase.error.map(err => <error type={err.typ}>
      {err.message}
    </error>).getOrElse(xml.Null)}{testCase.failure.map(fail => <failure type={fail.typ}>
      {fail.message}
    </failure>).getOrElse(xml.Null)}
    </testcase>
  }
}

{'fraction_non_alphanumeric': 0.1452353616532721, 'fraction_numerical': 0.005166475315729047, 'mean_word_length': 5.0398613518197575, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 29, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 10}, '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': '5396537', 'n_tokens_mistral': 1156, 'n_tokens_neox': 1151, 'n_words': 180}