<commit_before>package controllers.disposal_of_vehicle

import play.api.test.{FakeRequest, WithApplication}
import play.api.test.Helpers._
import controllers.disposal_of_vehicle
import mappings.disposal_of_vehicle.SetupTradeDetails._
import org.scalatest.{Matchers, WordSpec}
import helpers.disposal_of_vehicle.BusinessChooseYourAddressPage
import helpers.disposal_of_vehicle.Helper._

class SetUpTradeDetailsControllerSpec extends WordSpec with Matchers {
  "BeforeYouStart - Controller" should {
    "present" in new WithApplication {
      // Arrange
      val request = FakeRequest().withSession()

      // Act
      val result = disposal_of_vehicle.SetUpTradeDetails.present(request)

      // Assert
      status(result) should equal(OK)
    }

    "redirect to next page after the look-up is clicked" in new WithApplication {
      // Arrange
      val request = FakeRequest().withSession()
        .withFormUrlEncodedBody(dealerNameId -> traderBusinessNameValid, dealerPostcodeId -> traderPostcodeValid)

      // Act
      val result = disposal_of_vehicle.SetUpTradeDetails.submit(request)

      // Assert
      status(result) should equal(SEE_OTHER)
      redirectLocation(result) should equal (Some(BusinessChooseYourAddressPage.url))
    }

    "return a bad request if no details are entered" in new WithApplication {
      // Arrange
      val request = FakeRequest().withSession()
        .withFormUrlEncodedBody() //blank form

      // Act
      val result = disposal_of_vehicle.SetUpTradeDetails.submit(request)

      // Assert
      status(result) should equal(BAD_REQUEST)
    }
  }
}<commit_msg>Further tests added to check for empty for submission in SetUpTradeDetailsControllerSpec<commit_after>package controllers.disposal_of_vehicle

import play.api.test.{FakeRequest, WithApplication}
import play.api.test.Helpers._
import controllers.disposal_of_vehicle
import mappings.disposal_of_vehicle.SetupTradeDetails._
import org.scalatest.{Matchers, WordSpec}
import helpers.disposal_of_vehicle.BusinessChooseYourAddressPage
import helpers.disposal_of_vehicle.Helper._

class SetUpTradeDetailsControllerSpec extends WordSpec with Matchers {
  "BeforeYouStart - Controller" should {

    "present" in new WithApplication {
      // Arrange
      val request = FakeRequest().withSession()

      // Act
      val result = disposal_of_vehicle.SetUpTradeDetails.present(request)

      // Assert
      status(result) should equal(OK)
    }

    "redirect to next page when the form is completed successfully" in new WithApplication {
      // Arrange
      val request = FakeRequest().withSession()
        .withFormUrlEncodedBody(dealerNameId -> traderBusinessNameValid, dealerPostcodeId -> traderPostcodeValid)

      // Act
      val result = disposal_of_vehicle.SetUpTradeDetails.submit(request)

      // Assert
      status(result) should equal(SEE_OTHER)
      redirectLocation(result) should equal (Some(BusinessChooseYourAddressPage.url))
    }

    "return a bad request when only dealerName is entered" in new WithApplication {
      // Arrange
      val request = FakeRequest().withSession()
        .withFormUrlEncodedBody(dealerNameId -> traderBusinessNameValid)

      // Act
      val result = disposal_of_vehicle.SetUpTradeDetails.submit(request)

      // Assert
      status(result) should equal(BAD_REQUEST)
    }

    "return a bad request when only dealerPostcode is entered" in new WithApplication {
      // Arrange
      val request = FakeRequest().withSession()
        .withFormUrlEncodedBody(dealerPostcodeId -> traderPostcodeValid)

      // Act
      val result = disposal_of_vehicle.SetUpTradeDetails.submit(request)

      // Assert
      status(result) should equal(BAD_REQUEST)
    }

    "return a bad request when empty strings are entered" in new WithApplication {
      // Arrange
      val request = FakeRequest().withSession()
        .withFormUrlEncodedBody(dealerNameId -> "", dealerPostcodeId -> "")

      // Act
      val result = disposal_of_vehicle.SetUpTradeDetails.submit(request)

      // Assert
      status(result) should equal(BAD_REQUEST)
    }


    "return a bad request if no details are entered" in new WithApplication {
      // Arrange
      val request = FakeRequest().withSession()
        .withFormUrlEncodedBody()

      // Act
      val result = disposal_of_vehicle.SetUpTradeDetails.submit(request)

      // Assert
      status(result) should equal(BAD_REQUEST)
    }
  }
}
{'fraction_non_alphanumeric': 0.07983852881812066, 'fraction_numerical': 0.0, 'mean_word_length': 3.3854473942969516, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, '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': '4672388', 'n_tokens_mistral': 1287, 'n_tokens_neox': 1205, 'n_words': 291}