<commit_before>package services.fakes

import services.{VehicleLookupService, LoginWebService}
import models.domain.disposal_of_vehicle.{VehicleDetailsModel, VehicleDetailsResponse, VehicleLookupFormModel, AddressViewModel}
import models.domain.change_of_address.{LoginConfirmationModel, LoginResponse, LoginPageModel}
import scala.concurrent.{ExecutionContext, Future}
import ExecutionContext.Implicits.global

class FakeVehicleLookupService extends VehicleLookupService {
  val successMessage = "Fake Web Lookup Service - Good response"
  val failMessage = "Fake Web Dispose Service - Bad response"
  val vehicleLookupFormModelSuccess =
    VehicleDetailsResponse(true, message = successMessage, vehicleDetailsModel =
    VehicleDetailsModel(vehicleMake = "Alfa Romeo", vehicleModel = "Alfasud ti", keeperName =
      "Mr Success", keeperAddress = AddressViewModel(uprn = Some(10123456789L), address = Seq("line1", "line2", "line2"))))
  val vehicleLookupFormModelFailure =
    VehicleDetailsResponse(false, message = failMessage, vehicleDetailsModel =
      VehicleDetailsModel(vehicleMake = "Alfa Romeo", vehicleModel = "Alfasud ti", keeperName =
        "Mr Fail", keeperAddress = AddressViewModel(uprn = Some(10123456789L), address = Seq("line1", "line2", "line2"))))

  override def invoke(cmd: VehicleLookupFormModel): Future[VehicleDetailsResponse] = Future {
    if (cmd.referenceNumber == "9" * 11) vehicleLookupFormModelFailure
    else vehicleLookupFormModelSuccess
  }
}<commit_msg>Refactored FakeVehicleLookupService to use a method to create the VehicleLookupFormModel<commit_after>package services.fakes

import services.{VehicleLookupService, LoginWebService}
import models.domain.disposal_of_vehicle.{VehicleDetailsModel, VehicleDetailsResponse, VehicleLookupFormModel, AddressViewModel}
import models.domain.change_of_address.{LoginConfirmationModel, LoginResponse, LoginPageModel}
import scala.concurrent.{ExecutionContext, Future}
import ExecutionContext.Implicits.global

class FakeVehicleLookupService extends VehicleLookupService {
  val successMessage = "Fake Web Lookup Service - Good response"
  val failMessage = "Fake Web Dispose Service - Bad response"

  def generateVehicleLookupFormModel(statusReturned: Boolean = false, messageReturned: String) =
    VehicleDetailsResponse(statusReturned, message = messageReturned, vehicleDetailsModel =
    VehicleDetailsModel(vehicleMake = "Alfa Romeo", vehicleModel = "Alfasud ti", keeperName =
      "<NAME>", keeperAddress = AddressViewModel(uprn = Some(10123456789L), address = Seq("line1", "line2", "line2"))))

  override def invoke(cmd: VehicleLookupFormModel): Future[VehicleDetailsResponse] = Future {
    if (cmd.referenceNumber == "9" * 11) generateVehicleLookupFormModel(false, failMessage)
    else generateVehicleLookupFormModel(true, successMessage)
  }
}
{'fraction_non_alphanumeric': 0.08620689655172414, 'fraction_numerical': 0.01688951442646024, 'mean_word_length': 7.031073446327683, 'pattern_counts': {'":': 0, '<': 4, '<?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': '5811', 'n_tokens_mistral': 808, 'n_tokens_neox': 778, 'n_words': 184}