<commit_before>package com.themillhousegroup.gatsby

import org.specs2.mutable.Specification
import com.dividezero.stubby.core.model.{ StubRequest, StubExchange }
import org.specs2.mock.Mockito
import com.themillhousegroup.gatsby.stubby.StubbyServer

class GatsbySimulationSpec extends Specification with Mockito {

  class TestGatsbySimulation(val simulationWideExchanges: Seq[StubExchange]) extends AbstractGatsbySimulation(8888) {
    val mockStubbyServer = mock[StubbyServer]
    val stubbyServer = mockStubbyServer
    val stubbyServers = scala.collection.mutable.Map[Int, StubbyServer]()
  }

  "GatsbySimulation" should {
    "Allow Simulation-wide exchanges to be defined" in {
      val mockExchange = mock[StubExchange]
      val testGatsbySimulation = new TestGatsbySimulation(Seq(mockExchange))

      testGatsbySimulation.before()

      testGatsbySimulation.simulationWideExchanges must haveLength(1)
      //      there was one(mockStubbyServer).addExchange(mockExchange)

    }

    "Allow single exchanges to be added per-request" in {
      val testGatsbySimulation = new TestGatsbySimulation(Nil)

      val mockStubExchange = givenStubExchange("GET", "/bar")

      testGatsbySimulation.addExchange("foo", mockStubExchange) must beTrue

      testGatsbySimulation.addExchange("foo", mockStubExchange) must beFalse
    }

    "Allow multiple exchanges to be added per-request" in {
      val testGatsbySimulation = new TestGatsbySimulation(Nil)<commit_msg>Test updated now we just keep a collection of Stubby instances<commit_after>package com.themillhousegroup.gatsby

import org.specs2.mutable.Specification
import com.dividezero.stubby.core.model.{ StubRequest, StubExchange }
import org.specs2.mock.Mockito
import com.themillhousegroup.gatsby.stubby.StubbyServer

class GatsbySimulationSpec extends Specification with Mockito {

  class TestGatsbySimulation(val simulationWideExchanges: Seq[StubExchange]) extends AbstractGatsbySimulation(8888) {
    val mockStubbyServer = mock[StubbyServer]
    val stubbyServers = scala.collection.mutable.Map[Int, StubbyServer](8888 -> mockStubbyServer)
  }

  "GatsbySimulation" should {
    "Allow Simulation-wide exchanges to be defined" in {
      val mockExchange = mock[StubExchange]
      val testGatsbySimulation = new TestGatsbySimulation(Seq(mockExchange))

      testGatsbySimulation.before()

      testGatsbySimulation.simulationWideExchanges must haveLength(1)
      //      there was one(mockStubbyServer).addExchange(mockExchange)

    }

    "Allow single exchanges to be added per-request" in {
      val testGatsbySimulation = new TestGatsbySimulation(Nil)

      val mockStubExchange = givenStubExchange("GET", "/bar")

      testGatsbySimulation.addExchange("foo", mockStubExchange) must beTrue

      testGatsbySimulation.addExchange("foo", mockStubExchange) must beFalse
    }

    "Allow multiple exchanges to be added per-request" in {
      val testGatsbySimulation = new TestGatsbySimulation(Nil)
{'fraction_non_alphanumeric': 0.07475695608447872, 'fraction_numerical': 0.006034193764666443, 'mean_word_length': 4.7384615384615385, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 4, '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': '1566527', 'n_tokens_mistral': 939, 'n_tokens_neox': 909, 'n_words': 193}