<commit_before>package com.softwaremill.thegarden.mongodbtest

import com.github.fakemongo.Fongo
import net.liftweb.mongodb.{DefaultMongoIdentifier, MongoDB}
import org.scalatest.{BeforeAndAfterEach, Suite, BeforeAndAfterAll}

trait FongoSupport extends BeforeAndAfterAll with BeforeAndAfterEach {
  this: Suite =>

  private def newUuid() = java.util.UUID.randomUUID.toString

  private val dbName = newUuid()

  lazy val fongo = new Fongo(newUuid())

  val clearDataBeforeEachTest = false

  override protected def beforeAll() = {
    super.beforeAll()

    val mongo = fongo.getMongo
    MongoDB.defineDb(DefaultMongoIdentifier, mongo, dbName)
  }

  override protected def beforeEach() = {
    if (clearDataBeforeEachTest)
      fongo.dropDatabase(dbName)
  }

  override protected def afterAll() = {<commit_msg>Make FongoSupport.dbName more visible.<commit_after>package com.softwaremill.thegarden.mongodbtest

import com.github.fakemongo.Fongo
import net.liftweb.mongodb.{DefaultMongoIdentifier, MongoDB}
import org.scalatest.{BeforeAndAfterEach, Suite, BeforeAndAfterAll}

trait FongoSupport extends BeforeAndAfterAll with BeforeAndAfterEach {
  this: Suite =>

  private def newUuid() = java.util.UUID.randomUUID.toString

  protected val dbName = newUuid()

  lazy val fongo = new Fongo(newUuid())

  val clearDataBeforeEachTest = false

  override protected def beforeAll() = {
    super.beforeAll()

    val mongo = fongo.getMongo
    MongoDB.defineDb(DefaultMongoIdentifier, mongo, dbName)
  }

  override protected def beforeEach() = {
    if (clearDataBeforeEachTest)
      fongo.dropDatabase(dbName)
  }

  override protected def afterAll() = {
{'fraction_non_alphanumeric': 0.08559373116335142, 'fraction_numerical': 0.0, 'mean_word_length': 4.724137931034483, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '6747721', 'n_tokens_mistral': 533, 'n_tokens_neox': 514, 'n_words': 117}