From 4a69de85cb443705f6244f6d8abf018557f3b4b1 Mon Sep 17 00:00:00 2001 From: Paul Hodgson Date: Mon, 2 Nov 2020 15:58:43 +0000 Subject: [PATCH] [MIBM-145][ph] add VehicleSizePageSpec (#93) * [MIBM-145][ph] add VehicleSizePageSpec * [MIBM-145] tidy BasePageSpec --- .../views/GoodsInVehicleView.scala.html | 2 +- .../views/VehicleSizeView.scala.html | 2 +- .../CoreTestData.scala | 7 +++- .../pagespecs/AgentDetailsPageSpec.scala | 3 +- .../pagespecs/BasePageSpec.scala | 24 +---------- .../pagespecs/CheckYourAnswersPageSpec.scala | 7 ++-- .../pagespecs/CustomsAgentPageSpec.scala | 5 ++- .../pagespecs/EoriNumberPageSpec.scala | 5 ++- .../ExciseAndRestrictedGoodsPageSpec.scala | 13 +++--- .../pagespecs/GoodsDestinationPageSpec.scala | 3 +- .../pagespecs/GoodsInVehiclePageSpec.scala | 41 +++++++++++++++++++ .../pagespecs/GoodsRemovedPageSpec.scala | 3 +- .../GoodsRouteDestinationPageSpec.scala | 5 ++- .../pagespecs/GoodsVatRatePageSpec.scala | 3 +- .../pagespecs/InvoiceNumberPageSpec.scala | 3 +- .../pagespecs/JourneyDetailsPageSpec.scala | 5 ++- .../PaymentCalculationPageSpec.scala | 3 +- .../pagespecs/PurchaseDetailsPageSpec.scala | 3 +- .../pagespecs/RemoveGoodsPageSpec.scala | 5 ++- .../pagespecs/ReviewGoodsPageSpec.scala | 21 +++++----- .../SearchGoodsCountryPageSpec.scala | 3 +- .../pagespecs/SearchGoodsPageSpec.scala | 3 +- .../pagespecs/TravellerDetailsPageSpec.scala | 3 +- .../ValueWeightOfGoodsPageSpec.scala | 3 +- .../VehicleRegistrationNumberPageSpec.scala | 3 +- .../pagespecs/VehicleSizePageSpec.scala | 41 +++++++++++++++++++ .../pagespecs/pages/CustomsAgentPage.scala | 1 - .../pagespecs/pages/GoodsInVehiclePage.scala | 1 + .../pagespecs/pages/VehicleSizePage.scala | 22 ++++++++++ 29 files changed, 174 insertions(+), 69 deletions(-) create mode 100644 test/uk/gov/hmrc/merchandiseinbaggagefrontend/pagespecs/GoodsInVehiclePageSpec.scala create mode 100644 test/uk/gov/hmrc/merchandiseinbaggagefrontend/pagespecs/VehicleSizePageSpec.scala create mode 100644 test/uk/gov/hmrc/merchandiseinbaggagefrontend/pagespecs/pages/VehicleSizePage.scala diff --git a/app/uk/gov/hmrc/merchandiseinbaggagefrontend/views/GoodsInVehicleView.scala.html b/app/uk/gov/hmrc/merchandiseinbaggagefrontend/views/GoodsInVehicleView.scala.html index 856cf1dd5..4f385333f 100644 --- a/app/uk/gov/hmrc/merchandiseinbaggagefrontend/views/GoodsInVehicleView.scala.html +++ b/app/uk/gov/hmrc/merchandiseinbaggagefrontend/views/GoodsInVehicleView.scala.html @@ -38,6 +38,6 @@ legendAsHeading = true ) - @button("site.continue") + @button("site.continue", name=Some("continue")) } } \ No newline at end of file diff --git a/app/uk/gov/hmrc/merchandiseinbaggagefrontend/views/VehicleSizeView.scala.html b/app/uk/gov/hmrc/merchandiseinbaggagefrontend/views/VehicleSizeView.scala.html index f37d246ec..63f452650 100644 --- a/app/uk/gov/hmrc/merchandiseinbaggagefrontend/views/VehicleSizeView.scala.html +++ b/app/uk/gov/hmrc/merchandiseinbaggagefrontend/views/VehicleSizeView.scala.html @@ -39,6 +39,6 @@ legendAsHeading = true ) - @button("site.continue") + @button("site.continue", name=Some("continue")) } } \ No newline at end of file diff --git a/test/uk/gov/hmrc/merchandiseinbaggagefrontend/CoreTestData.scala b/test/uk/gov/hmrc/merchandiseinbaggagefrontend/CoreTestData.scala index 09c801c56..6408e6970 100644 --- a/test/uk/gov/hmrc/merchandiseinbaggagefrontend/CoreTestData.scala +++ b/test/uk/gov/hmrc/merchandiseinbaggagefrontend/CoreTestData.scala @@ -21,6 +21,8 @@ import java.time.LocalDate import uk.gov.hmrc.merchandiseinbaggagefrontend.controllers.testonly.TestOnlyController import uk.gov.hmrc.merchandiseinbaggagefrontend.model.api._ import uk.gov.hmrc.merchandiseinbaggagefrontend.model.calculation.CalculationResult +import uk.gov.hmrc.merchandiseinbaggagefrontend.model.core.DeclarationType.Import +import uk.gov.hmrc.merchandiseinbaggagefrontend.model.core.GoodsDestinations.GreatBritain import uk.gov.hmrc.merchandiseinbaggagefrontend.model.core.GoodsVatRates.Twenty import uk.gov.hmrc.merchandiseinbaggagefrontend.model.core.Ports.{Dover, Heathrow} import uk.gov.hmrc.merchandiseinbaggagefrontend.model.core.YesNo.No @@ -37,7 +39,10 @@ trait CoreTestData { val sessionId: SessionId = SessionId() - val startedImportJourney: DeclarationJourney = DeclarationJourney(sessionId, DeclarationType.Import) + val startedImportJourney: DeclarationJourney = DeclarationJourney(sessionId, Import) + + val startedImportToGreatBritainJourney: DeclarationJourney = + startedImportJourney.copy(maybeGoodsDestination = Some(GreatBritain)) val completedGoodsEntry: GoodsEntry = TestOnlyController.completedGoodsEntry diff --git a/test/uk/gov/hmrc/merchandiseinbaggagefrontend/pagespecs/AgentDetailsPageSpec.scala b/test/uk/gov/hmrc/merchandiseinbaggagefrontend/pagespecs/AgentDetailsPageSpec.scala index 620434dc9..fde3f8b81 100644 --- a/test/uk/gov/hmrc/merchandiseinbaggagefrontend/pagespecs/AgentDetailsPageSpec.scala +++ b/test/uk/gov/hmrc/merchandiseinbaggagefrontend/pagespecs/AgentDetailsPageSpec.scala @@ -16,12 +16,13 @@ package uk.gov.hmrc.merchandiseinbaggagefrontend.pagespecs +import com.softwaremill.macwire.wire import uk.gov.hmrc.merchandiseinbaggagefrontend.model.core.DeclarationJourney import uk.gov.hmrc.merchandiseinbaggagefrontend.pagespecs.pages.AgentDetailsPage import uk.gov.hmrc.merchandiseinbaggagefrontend.pagespecs.pages.AgentDetailsPage._ class AgentDetailsPageSpec extends DeclarationDataCapturePageSpec[String, AgentDetailsPage] { - override lazy val page: AgentDetailsPage = agentDetailsPage + override lazy val page: AgentDetailsPage = wire[AgentDetailsPage] "the page" should { behave like aPageWhichRequiresADeclarationJourney(path) diff --git a/test/uk/gov/hmrc/merchandiseinbaggagefrontend/pagespecs/BasePageSpec.scala b/test/uk/gov/hmrc/merchandiseinbaggagefrontend/pagespecs/BasePageSpec.scala index 9c444429f..9a9043bc9 100644 --- a/test/uk/gov/hmrc/merchandiseinbaggagefrontend/pagespecs/BasePageSpec.scala +++ b/test/uk/gov/hmrc/merchandiseinbaggagefrontend/pagespecs/BasePageSpec.scala @@ -19,8 +19,8 @@ package uk.gov.hmrc.merchandiseinbaggagefrontend.pagespecs import com.softwaremill.macwire.wire import org.openqa.selenium.htmlunit.HtmlUnitDriver import org.scalatestplus.selenium.WebBrowser -import uk.gov.hmrc.merchandiseinbaggagefrontend.model.core.{DeclarationJourney, GoodsDestination, GoodsVatRate, YesNo} -import uk.gov.hmrc.merchandiseinbaggagefrontend.pagespecs.pages.{RadioButtonPage, TravellerDetailsPage, _} +import uk.gov.hmrc.merchandiseinbaggagefrontend.model.core.DeclarationJourney +import uk.gov.hmrc.merchandiseinbaggagefrontend.pagespecs.pages._ import uk.gov.hmrc.merchandiseinbaggagefrontend.{BaseSpecWithApplication, CoreTestData, WireMockSupport} trait BasePageSpec[P <: BasePage] extends BaseSpecWithApplication with WireMockSupport with CoreTestData { @@ -40,26 +40,6 @@ trait BasePageSpec[P <: BasePage] extends BaseSpecWithApplication with WireMockS lazy val testOnlyDeclarationJourneyPage: TestOnlyDeclarationJourneyPage = wire[TestOnlyDeclarationJourneyPage] lazy val startImportPage: StartImportPage = wire[StartImportPage] lazy val startExportPage: StartExportPage = wire[StartExportPage] - lazy val exciseAndRestrictedGoodsPage: RadioButtonPage[YesNo] = wire[RadioButtonPage[YesNo]] - lazy val goodsDestinationPage: RadioButtonPage[GoodsDestination] = wire[RadioButtonPage[GoodsDestination]] - lazy val goodsRouteDestinationPage: RadioButtonPage[YesNo] = wire[RadioButtonPage[YesNo]] - lazy val valueWeightOfGoodsPage: RadioButtonPage[YesNo] = wire[RadioButtonPage[YesNo]] - lazy val searchGoodsPage: SearchGoodsPage = wire[SearchGoodsPage] - lazy val goodsVatRatePage: RadioButtonPage[GoodsVatRate] = wire[RadioButtonPage[GoodsVatRate]] - lazy val searchGoodsCountryPage: SearchGoodsCountryPage = wire[SearchGoodsCountryPage] - lazy val purchaseDetailsPage: PurchaseDetailsPage = wire[PurchaseDetailsPage] - lazy val invoiceNumberPage: InvoiceNumberPage = wire[InvoiceNumberPage] - lazy val reviewGoodsPage: ReviewGoodsPage = wire[ReviewGoodsPage] - lazy val removeGoodsPage: RadioButtonPage[YesNo] = wire[RadioButtonPage[YesNo]] - lazy val goodsRemovedPage: GoodsRemovedPage = wire[GoodsRemovedPage] - lazy val agentDetailsPage: AgentDetailsPage = wire[AgentDetailsPage] - lazy val paymentCalculationPage: PaymentCalculationPage = wire[PaymentCalculationPage] - lazy val eoriNumberPage: EoriNumberPage = wire[EoriNumberPage] - lazy val travellerDetailsPage: TravellerDetailsPage = wire[TravellerDetailsPage] - lazy val journeyDetailsPage: JourneyDetailsPage = wire[JourneyDetailsPage] - lazy val vehicleRegistrationNumberPage: VehicleRegistrationNumberPage = wire[VehicleRegistrationNumberPage] - lazy val checkYourAnswersPage: CheckYourAnswersPage = wire[CheckYourAnswersPage] - lazy val customsAgentPage: RadioButtonPage[YesNo] = wire[RadioButtonPage[YesNo]] def givenAnImportJourneyIsStarted(): Unit = { open(StartImportPage.path) diff --git a/test/uk/gov/hmrc/merchandiseinbaggagefrontend/pagespecs/CheckYourAnswersPageSpec.scala b/test/uk/gov/hmrc/merchandiseinbaggagefrontend/pagespecs/CheckYourAnswersPageSpec.scala index f71fb1ee4..52a77c218 100644 --- a/test/uk/gov/hmrc/merchandiseinbaggagefrontend/pagespecs/CheckYourAnswersPageSpec.scala +++ b/test/uk/gov/hmrc/merchandiseinbaggagefrontend/pagespecs/CheckYourAnswersPageSpec.scala @@ -16,12 +16,13 @@ package uk.gov.hmrc.merchandiseinbaggagefrontend.pagespecs +import com.softwaremill.macwire.wire import uk.gov.hmrc.merchandiseinbaggagefrontend.pagespecs.pages.CheckYourAnswersPage._ import uk.gov.hmrc.merchandiseinbaggagefrontend.pagespecs.pages.{CheckYourAnswersPage, InvalidRequestPage} import uk.gov.hmrc.merchandiseinbaggagefrontend.stubs.PayApiStub._ class CheckYourAnswersPageSpec extends BasePageSpec[CheckYourAnswersPage] with TaxCalculation{ - override lazy val page: CheckYourAnswersPage = checkYourAnswersPage + override lazy val page: CheckYourAnswersPage = wire[CheckYourAnswersPage] "the page" should { behave like aPageWhichRequiresADeclarationJourney(path) @@ -33,8 +34,8 @@ class CheckYourAnswersPageSpec extends BasePageSpec[CheckYourAnswersPage] with T open(path) - checkYourAnswersPage.mustRenderBasicContent(path, title) - checkYourAnswersPage.mustRenderDetail(declaration, taxDue.totalTaxDue) + page.mustRenderBasicContent(path, title) + page.mustRenderDetail(declaration, taxDue.totalTaxDue) } "the declaration is complete but sparse" in { diff --git a/test/uk/gov/hmrc/merchandiseinbaggagefrontend/pagespecs/CustomsAgentPageSpec.scala b/test/uk/gov/hmrc/merchandiseinbaggagefrontend/pagespecs/CustomsAgentPageSpec.scala index 4510390b8..c7d614a0b 100644 --- a/test/uk/gov/hmrc/merchandiseinbaggagefrontend/pagespecs/CustomsAgentPageSpec.scala +++ b/test/uk/gov/hmrc/merchandiseinbaggagefrontend/pagespecs/CustomsAgentPageSpec.scala @@ -16,6 +16,7 @@ package uk.gov.hmrc.merchandiseinbaggagefrontend.pagespecs +import com.softwaremill.macwire.wire import uk.gov.hmrc.merchandiseinbaggagefrontend.CoreTestData import uk.gov.hmrc.merchandiseinbaggagefrontend.model.core.YesNo.{No, Yes} import uk.gov.hmrc.merchandiseinbaggagefrontend.model.core.{DeclarationJourney, YesNo} @@ -23,7 +24,7 @@ import uk.gov.hmrc.merchandiseinbaggagefrontend.pagespecs.pages.CustomsAgentPage import uk.gov.hmrc.merchandiseinbaggagefrontend.pagespecs.pages.{AgentDetailsPage, EoriNumberPage, RadioButtonPage} class CustomsAgentPageSpec extends DeclarationDataCapturePageSpec[YesNo, RadioButtonPage[YesNo]] with CoreTestData { - override lazy val page: RadioButtonPage[YesNo] = customsAgentPage + override lazy val page: RadioButtonPage[YesNo] = wire[RadioButtonPage[YesNo]] "the page" should { @@ -36,7 +37,7 @@ class CustomsAgentPageSpec extends DeclarationDataCapturePageSpec[YesNo, RadioBu givenADeclarationJourney(completedDeclarationJourney.copy(maybeIsACustomsAgent = None)) open(path) - customsAgentPage.mustRenderBasicContent(path, title) + page.mustRenderBasicContent(path, title) } } } diff --git a/test/uk/gov/hmrc/merchandiseinbaggagefrontend/pagespecs/EoriNumberPageSpec.scala b/test/uk/gov/hmrc/merchandiseinbaggagefrontend/pagespecs/EoriNumberPageSpec.scala index 588cc5b3a..f86cb1375 100644 --- a/test/uk/gov/hmrc/merchandiseinbaggagefrontend/pagespecs/EoriNumberPageSpec.scala +++ b/test/uk/gov/hmrc/merchandiseinbaggagefrontend/pagespecs/EoriNumberPageSpec.scala @@ -16,13 +16,14 @@ package uk.gov.hmrc.merchandiseinbaggagefrontend.pagespecs +import com.softwaremill.macwire.wire import uk.gov.hmrc.merchandiseinbaggagefrontend.model.core.YesNo.{No, Yes} import uk.gov.hmrc.merchandiseinbaggagefrontend.model.core.{DeclarationJourney, Eori} -import uk.gov.hmrc.merchandiseinbaggagefrontend.pagespecs.pages.{EoriNumberPage, TravellerDetailsPage} import uk.gov.hmrc.merchandiseinbaggagefrontend.pagespecs.pages.EoriNumberPage._ +import uk.gov.hmrc.merchandiseinbaggagefrontend.pagespecs.pages.{EoriNumberPage, TravellerDetailsPage} class EoriNumberPageSpec extends DeclarationDataCapturePageSpec[Eori, EoriNumberPage] { - override lazy val page: EoriNumberPage = eoriNumberPage + override lazy val page: EoriNumberPage = wire[EoriNumberPage] private val eori = Eori("GB123467800000") diff --git a/test/uk/gov/hmrc/merchandiseinbaggagefrontend/pagespecs/ExciseAndRestrictedGoodsPageSpec.scala b/test/uk/gov/hmrc/merchandiseinbaggagefrontend/pagespecs/ExciseAndRestrictedGoodsPageSpec.scala index 8ccafa620..a51f72f7c 100644 --- a/test/uk/gov/hmrc/merchandiseinbaggagefrontend/pagespecs/ExciseAndRestrictedGoodsPageSpec.scala +++ b/test/uk/gov/hmrc/merchandiseinbaggagefrontend/pagespecs/ExciseAndRestrictedGoodsPageSpec.scala @@ -16,27 +16,24 @@ package uk.gov.hmrc.merchandiseinbaggagefrontend.pagespecs -import uk.gov.hmrc.merchandiseinbaggagefrontend.model.core.GoodsDestinations.GreatBritain +import com.softwaremill.macwire.wire import uk.gov.hmrc.merchandiseinbaggagefrontend.model.core.YesNo.{No, Yes} import uk.gov.hmrc.merchandiseinbaggagefrontend.model.core.{DeclarationJourney, YesNo} import uk.gov.hmrc.merchandiseinbaggagefrontend.pagespecs.pages.ExciseAndRestrictedGoodsPage._ import uk.gov.hmrc.merchandiseinbaggagefrontend.pagespecs.pages.{CannotUseServicePage, RadioButtonPage, ValueWeightOfGoodsPage} class ExciseAndRestrictedGoodsPageSpec extends DeclarationDataCapturePageSpec[YesNo, RadioButtonPage[YesNo]] { - override lazy val page: RadioButtonPage[YesNo] = exciseAndRestrictedGoodsPage + override lazy val page: RadioButtonPage[YesNo] = wire[RadioButtonPage[YesNo]] - private def setup(): Unit = - givenADeclarationJourney(startedImportJourney.copy( - maybeGoodsDestination = Some(GreatBritain) - )) + private def setup(): Unit = givenADeclarationJourney(startedImportToGreatBritainJourney) "the excise and restricted goods page" should { behave like aPageWhichRenders(path, givenAnImportJourneyIsStarted(), importTitle) behave like aPageWhichRenders(path, givenAnExportJourneyIsStarted(), exportTitle) behave like aPageWhichDisplaysPreviouslyEnteredAnswers(path) behave like aPageWhichRequiresADeclarationJourney(path) - behave like aDataCapturePageWithConditionalRouting(path, setup, No, ValueWeightOfGoodsPage.path) - behave like aDataCapturePageWithConditionalRouting(path, setup, Yes, CannotUseServicePage.path) + behave like aDataCapturePageWithConditionalRouting(path, setup(), No, ValueWeightOfGoodsPage.path) + behave like aDataCapturePageWithConditionalRouting(path, setup(), Yes, CannotUseServicePage.path) } override def extractFormDataFrom(declarationJourney: DeclarationJourney): Option[YesNo] = diff --git a/test/uk/gov/hmrc/merchandiseinbaggagefrontend/pagespecs/GoodsDestinationPageSpec.scala b/test/uk/gov/hmrc/merchandiseinbaggagefrontend/pagespecs/GoodsDestinationPageSpec.scala index 559bb8ff9..e436f74cf 100644 --- a/test/uk/gov/hmrc/merchandiseinbaggagefrontend/pagespecs/GoodsDestinationPageSpec.scala +++ b/test/uk/gov/hmrc/merchandiseinbaggagefrontend/pagespecs/GoodsDestinationPageSpec.scala @@ -16,13 +16,14 @@ package uk.gov.hmrc.merchandiseinbaggagefrontend.pagespecs +import com.softwaremill.macwire.wire import uk.gov.hmrc.merchandiseinbaggagefrontend.model.core.GoodsDestinations.{GreatBritain, NorthernIreland} import uk.gov.hmrc.merchandiseinbaggagefrontend.model.core.{DeclarationJourney, GoodsDestination} import uk.gov.hmrc.merchandiseinbaggagefrontend.pagespecs.pages.GoodsDestinationPage._ import uk.gov.hmrc.merchandiseinbaggagefrontend.pagespecs.pages.{ExciseAndRestrictedGoodsPage, GoodsRouteDestinationPage, RadioButtonPage} class GoodsDestinationPageSpec extends DeclarationDataCapturePageSpec[GoodsDestination, RadioButtonPage[GoodsDestination]] { - override lazy val page: RadioButtonPage[GoodsDestination] = goodsDestinationPage + override lazy val page: RadioButtonPage[GoodsDestination] = wire[RadioButtonPage[GoodsDestination]] "the goods destination page" should { behave like aPageWhichRenders(path, givenAnImportJourneyIsStarted(), importTitle) diff --git a/test/uk/gov/hmrc/merchandiseinbaggagefrontend/pagespecs/GoodsInVehiclePageSpec.scala b/test/uk/gov/hmrc/merchandiseinbaggagefrontend/pagespecs/GoodsInVehiclePageSpec.scala new file mode 100644 index 000000000..a17d16c2a --- /dev/null +++ b/test/uk/gov/hmrc/merchandiseinbaggagefrontend/pagespecs/GoodsInVehiclePageSpec.scala @@ -0,0 +1,41 @@ +/* + * Copyright 2020 HM Revenue & Customs + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package uk.gov.hmrc.merchandiseinbaggagefrontend.pagespecs + +import com.softwaremill.macwire.wire +import uk.gov.hmrc.merchandiseinbaggagefrontend.model.core.YesNo.{No, Yes} +import uk.gov.hmrc.merchandiseinbaggagefrontend.model.core.{DeclarationJourney, YesNo} +import uk.gov.hmrc.merchandiseinbaggagefrontend.pagespecs.pages.GoodsInVehiclePage._ +import uk.gov.hmrc.merchandiseinbaggagefrontend.pagespecs.pages.{CheckYourAnswersPage, RadioButtonPage, VehicleSizePage} + +class GoodsInVehiclePageSpec extends DeclarationDataCapturePageSpec[YesNo, RadioButtonPage[YesNo]] { + override lazy val page: RadioButtonPage[YesNo] = wire[RadioButtonPage[YesNo]] + + "the excise and restricted goods page" should { + behave like aPageWhichRequiresADeclarationJourney(path) + behave like aPageWhichRenders(path, givenAnImportJourneyIsStarted(), title) + behave like aPageWhichDisplaysPreviouslyEnteredAnswers(path) + behave like aDataCapturePageWithConditionalRouting(path, givenAnImportJourneyIsStarted(), Yes, VehicleSizePage.path) + behave like aDataCapturePageWithConditionalRouting( + path, + givenADeclarationJourney(completedDeclarationJourney.copy(maybeTravellingByVehicle = None)), + No, + CheckYourAnswersPage.path) + } + + override def extractFormDataFrom(declarationJourney: DeclarationJourney): Option[YesNo] = declarationJourney.maybeTravellingByVehicle +} diff --git a/test/uk/gov/hmrc/merchandiseinbaggagefrontend/pagespecs/GoodsRemovedPageSpec.scala b/test/uk/gov/hmrc/merchandiseinbaggagefrontend/pagespecs/GoodsRemovedPageSpec.scala index bcae78e81..3e359f080 100644 --- a/test/uk/gov/hmrc/merchandiseinbaggagefrontend/pagespecs/GoodsRemovedPageSpec.scala +++ b/test/uk/gov/hmrc/merchandiseinbaggagefrontend/pagespecs/GoodsRemovedPageSpec.scala @@ -16,11 +16,12 @@ package uk.gov.hmrc.merchandiseinbaggagefrontend.pagespecs +import com.softwaremill.macwire.wire import uk.gov.hmrc.merchandiseinbaggagefrontend.pagespecs.pages.GoodsRemovedPage._ import uk.gov.hmrc.merchandiseinbaggagefrontend.pagespecs.pages.{GoodsRemovedPage, SearchGoodsPage, StartImportPage} class GoodsRemovedPageSpec extends BasePageSpec[GoodsRemovedPage] { - override def page: GoodsRemovedPage = goodsRemovedPage + override def page: GoodsRemovedPage = wire[GoodsRemovedPage] "the goods removed page" should { behave like aPageWhichRequiresADeclarationJourney(path) diff --git a/test/uk/gov/hmrc/merchandiseinbaggagefrontend/pagespecs/GoodsRouteDestinationPageSpec.scala b/test/uk/gov/hmrc/merchandiseinbaggagefrontend/pagespecs/GoodsRouteDestinationPageSpec.scala index 3a492f956..22f8d1728 100644 --- a/test/uk/gov/hmrc/merchandiseinbaggagefrontend/pagespecs/GoodsRouteDestinationPageSpec.scala +++ b/test/uk/gov/hmrc/merchandiseinbaggagefrontend/pagespecs/GoodsRouteDestinationPageSpec.scala @@ -16,13 +16,14 @@ package uk.gov.hmrc.merchandiseinbaggagefrontend.pagespecs -import uk.gov.hmrc.merchandiseinbaggagefrontend.model.core.{DeclarationJourney, YesNo} +import com.softwaremill.macwire.wire import uk.gov.hmrc.merchandiseinbaggagefrontend.model.core.YesNo.{No, Yes} +import uk.gov.hmrc.merchandiseinbaggagefrontend.model.core.{DeclarationJourney, YesNo} import uk.gov.hmrc.merchandiseinbaggagefrontend.pagespecs.pages.GoodsRouteDestinationPage._ import uk.gov.hmrc.merchandiseinbaggagefrontend.pagespecs.pages.{CannotUseServiceIrelandPage, ExciseAndRestrictedGoodsPage, NoDeclarationNeededPage, RadioButtonPage} class GoodsRouteDestinationPageSpec extends DeclarationDataCapturePageSpec[YesNo, RadioButtonPage[YesNo]] { - override lazy val page: RadioButtonPage[YesNo] = goodsRouteDestinationPage + override lazy val page: RadioButtonPage[YesNo] = wire[RadioButtonPage[YesNo]] "the goods route destination page" should { behave like aPageWhichRenders(path, givenAnImportJourneyIsStarted(), importTitle) diff --git a/test/uk/gov/hmrc/merchandiseinbaggagefrontend/pagespecs/GoodsVatRatePageSpec.scala b/test/uk/gov/hmrc/merchandiseinbaggagefrontend/pagespecs/GoodsVatRatePageSpec.scala index 59e6aaf64..f06b01d28 100644 --- a/test/uk/gov/hmrc/merchandiseinbaggagefrontend/pagespecs/GoodsVatRatePageSpec.scala +++ b/test/uk/gov/hmrc/merchandiseinbaggagefrontend/pagespecs/GoodsVatRatePageSpec.scala @@ -16,13 +16,14 @@ package uk.gov.hmrc.merchandiseinbaggagefrontend.pagespecs +import com.softwaremill.macwire.wire import uk.gov.hmrc.merchandiseinbaggagefrontend.model.core.GoodsVatRates.Twenty import uk.gov.hmrc.merchandiseinbaggagefrontend.model.core.{GoodsEntry, GoodsVatRate} import uk.gov.hmrc.merchandiseinbaggagefrontend.pagespecs.pages.GoodsVatRatePage._ import uk.gov.hmrc.merchandiseinbaggagefrontend.pagespecs.pages.{RadioButtonPage, SearchGoodsCountryPage} class GoodsVatRatePageSpec extends GoodsEntryPageSpec[GoodsVatRate, RadioButtonPage[GoodsVatRate]] { - override lazy val page: RadioButtonPage[GoodsVatRate] = goodsVatRatePage + override lazy val page: RadioButtonPage[GoodsVatRate] = wire[RadioButtonPage[GoodsVatRate]] "the goods vat rate page" should { behave like aGoodsEntryPage(path, title, Twenty, Some(SearchGoodsCountryPage.path)) diff --git a/test/uk/gov/hmrc/merchandiseinbaggagefrontend/pagespecs/InvoiceNumberPageSpec.scala b/test/uk/gov/hmrc/merchandiseinbaggagefrontend/pagespecs/InvoiceNumberPageSpec.scala index ed58aca02..1f887d8ea 100644 --- a/test/uk/gov/hmrc/merchandiseinbaggagefrontend/pagespecs/InvoiceNumberPageSpec.scala +++ b/test/uk/gov/hmrc/merchandiseinbaggagefrontend/pagespecs/InvoiceNumberPageSpec.scala @@ -16,13 +16,14 @@ package uk.gov.hmrc.merchandiseinbaggagefrontend.pagespecs +import com.softwaremill.macwire.wire import org.scalatest.concurrent.ScalaFutures import uk.gov.hmrc.merchandiseinbaggagefrontend.model.core.GoodsEntry import uk.gov.hmrc.merchandiseinbaggagefrontend.pagespecs.pages.InvoiceNumberPage import uk.gov.hmrc.merchandiseinbaggagefrontend.pagespecs.pages.InvoiceNumberPage._ class InvoiceNumberPageSpec extends GoodsEntryPageSpec[String, InvoiceNumberPage] with ScalaFutures { - override lazy val page: InvoiceNumberPage = invoiceNumberPage + override lazy val page: InvoiceNumberPage = wire[InvoiceNumberPage] "the invoice number page" should { behave like aGoodsEntryPage(path, title, "Invoice123", None) diff --git a/test/uk/gov/hmrc/merchandiseinbaggagefrontend/pagespecs/JourneyDetailsPageSpec.scala b/test/uk/gov/hmrc/merchandiseinbaggagefrontend/pagespecs/JourneyDetailsPageSpec.scala index e419b93de..0d0f3452b 100644 --- a/test/uk/gov/hmrc/merchandiseinbaggagefrontend/pagespecs/JourneyDetailsPageSpec.scala +++ b/test/uk/gov/hmrc/merchandiseinbaggagefrontend/pagespecs/JourneyDetailsPageSpec.scala @@ -16,13 +16,14 @@ package uk.gov.hmrc.merchandiseinbaggagefrontend.pagespecs +import com.softwaremill.macwire.wire import org.scalatest.concurrent.ScalaFutures import uk.gov.hmrc.merchandiseinbaggagefrontend.model.core.{DeclarationJourney, JourneyDetailsEntry} -import uk.gov.hmrc.merchandiseinbaggagefrontend.pagespecs.pages.{CheckYourAnswersPage, GoodsInVehiclePage, InvalidRequestPage, JourneyDetailsPage} import uk.gov.hmrc.merchandiseinbaggagefrontend.pagespecs.pages.JourneyDetailsPage._ +import uk.gov.hmrc.merchandiseinbaggagefrontend.pagespecs.pages.{CheckYourAnswersPage, GoodsInVehiclePage, InvalidRequestPage, JourneyDetailsPage} class JourneyDetailsPageSpec extends DeclarationDataCapturePageSpec[JourneyDetailsEntry, JourneyDetailsPage] with ScalaFutures { - override lazy val page: JourneyDetailsPage = journeyDetailsPage + override lazy val page: JourneyDetailsPage = wire[JourneyDetailsPage] "the journey details page" should { behave like aPageWhichRenders(path, givenAnImportJourneyIsStarted(), title) diff --git a/test/uk/gov/hmrc/merchandiseinbaggagefrontend/pagespecs/PaymentCalculationPageSpec.scala b/test/uk/gov/hmrc/merchandiseinbaggagefrontend/pagespecs/PaymentCalculationPageSpec.scala index a26228c57..7becd97c7 100644 --- a/test/uk/gov/hmrc/merchandiseinbaggagefrontend/pagespecs/PaymentCalculationPageSpec.scala +++ b/test/uk/gov/hmrc/merchandiseinbaggagefrontend/pagespecs/PaymentCalculationPageSpec.scala @@ -16,11 +16,12 @@ package uk.gov.hmrc.merchandiseinbaggagefrontend.pagespecs +import com.softwaremill.macwire.wire import uk.gov.hmrc.merchandiseinbaggagefrontend.pagespecs.pages.PaymentCalculationPage._ import uk.gov.hmrc.merchandiseinbaggagefrontend.pagespecs.pages.{CustomsAgentPage, PaymentCalculationPage} class PaymentCalculationPageSpec extends BasePageSpec[PaymentCalculationPage] with TaxCalculation { - override def page: PaymentCalculationPage = paymentCalculationPage + override def page: PaymentCalculationPage = wire[PaymentCalculationPage] private def setUpTaxCalculationAndOpenPage() = { val taxCalculation = givenADeclarationWithTaxDue(importJourneyWithTwoCompleteGoodsEntries).futureValue diff --git a/test/uk/gov/hmrc/merchandiseinbaggagefrontend/pagespecs/PurchaseDetailsPageSpec.scala b/test/uk/gov/hmrc/merchandiseinbaggagefrontend/pagespecs/PurchaseDetailsPageSpec.scala index 4199d9df2..59506846a 100644 --- a/test/uk/gov/hmrc/merchandiseinbaggagefrontend/pagespecs/PurchaseDetailsPageSpec.scala +++ b/test/uk/gov/hmrc/merchandiseinbaggagefrontend/pagespecs/PurchaseDetailsPageSpec.scala @@ -16,6 +16,7 @@ package uk.gov.hmrc.merchandiseinbaggagefrontend.pagespecs +import com.softwaremill.macwire.wire import org.scalatest.concurrent.ScalaFutures import uk.gov.hmrc.merchandiseinbaggagefrontend.model.core.{GoodsEntry, PurchaseDetailsInput} import uk.gov.hmrc.merchandiseinbaggagefrontend.pagespecs.pages.PurchaseDetailsPage._ @@ -23,7 +24,7 @@ import uk.gov.hmrc.merchandiseinbaggagefrontend.pagespecs.pages.{InvoiceNumberPa import uk.gov.hmrc.merchandiseinbaggagefrontend.stubs.CurrencyConversionStub.givenCurrenciesAreFound class PurchaseDetailsPageSpec extends GoodsEntryPageSpec[PurchaseDetailsInput, PurchaseDetailsPage] with ScalaFutures { - override lazy val page: PurchaseDetailsPage = purchaseDetailsPage + override lazy val page: PurchaseDetailsPage = wire[PurchaseDetailsPage] override def beforeEach(): Unit = { super.beforeEach() diff --git a/test/uk/gov/hmrc/merchandiseinbaggagefrontend/pagespecs/RemoveGoodsPageSpec.scala b/test/uk/gov/hmrc/merchandiseinbaggagefrontend/pagespecs/RemoveGoodsPageSpec.scala index 04a30faee..a029c11de 100644 --- a/test/uk/gov/hmrc/merchandiseinbaggagefrontend/pagespecs/RemoveGoodsPageSpec.scala +++ b/test/uk/gov/hmrc/merchandiseinbaggagefrontend/pagespecs/RemoveGoodsPageSpec.scala @@ -16,15 +16,16 @@ package uk.gov.hmrc.merchandiseinbaggagefrontend.pagespecs -import uk.gov.hmrc.merchandiseinbaggagefrontend.model.core.{GoodsEntry, YesNo} +import com.softwaremill.macwire.wire import uk.gov.hmrc.merchandiseinbaggagefrontend.model.core.YesNo.{No, Yes} +import uk.gov.hmrc.merchandiseinbaggagefrontend.model.core.{GoodsEntry, YesNo} import uk.gov.hmrc.merchandiseinbaggagefrontend.pagespecs.pages.RemoveGoodsPage._ import uk.gov.hmrc.merchandiseinbaggagefrontend.pagespecs.pages.{GoodsRemovedPage, RadioButtonPage, ReviewGoodsPage} import scala.concurrent.ExecutionContext.Implicits.global class RemoveGoodsPageSpec extends BasePageSpec[RadioButtonPage[YesNo]] { - override def page: RadioButtonPage[YesNo] = removeGoodsPage + override def page: RadioButtonPage[YesNo] = wire[RadioButtonPage[YesNo]] "the remove goods page" should { behave like aPageWhichRequiresADeclarationJourney(path(1)) diff --git a/test/uk/gov/hmrc/merchandiseinbaggagefrontend/pagespecs/ReviewGoodsPageSpec.scala b/test/uk/gov/hmrc/merchandiseinbaggagefrontend/pagespecs/ReviewGoodsPageSpec.scala index 09e4663c0..1d1eee8e3 100644 --- a/test/uk/gov/hmrc/merchandiseinbaggagefrontend/pagespecs/ReviewGoodsPageSpec.scala +++ b/test/uk/gov/hmrc/merchandiseinbaggagefrontend/pagespecs/ReviewGoodsPageSpec.scala @@ -16,12 +16,13 @@ package uk.gov.hmrc.merchandiseinbaggagefrontend.pagespecs +import com.softwaremill.macwire.wire import uk.gov.hmrc.merchandiseinbaggagefrontend.model.core.YesNo.{No, Yes} import uk.gov.hmrc.merchandiseinbaggagefrontend.pagespecs.pages.ReviewGoodsPage._ import uk.gov.hmrc.merchandiseinbaggagefrontend.pagespecs.pages.{PaymentCalculationPage, RemoveGoodsPage, ReviewGoodsPage, SearchGoodsPage} class ReviewGoodsPageSpec extends BasePageSpec[ReviewGoodsPage] { - override lazy val page: ReviewGoodsPage = reviewGoodsPage + override lazy val page: ReviewGoodsPage = wire[ReviewGoodsPage] "the review goods page" should { behave like aPageWhichRequiresADeclarationJourney(path) @@ -32,9 +33,9 @@ class ReviewGoodsPageSpec extends BasePageSpec[ReviewGoodsPage] { givenADeclarationJourney(importJourneyWithOneCompleteGoodsEntry) open(path) - reviewGoodsPage.mustRenderBasicContent(path, title) + page.mustRenderBasicContent(path, title) - reviewGoodsPage.goodsSummariesAsMap mustBe + page.goodsSummariesAsMap mustBe Seq( Map( "Price paid" -> "99.99, Eurozone Euro (EUR)", @@ -50,9 +51,9 @@ class ReviewGoodsPageSpec extends BasePageSpec[ReviewGoodsPage] { givenADeclarationJourney(importJourneyWithTwoCompleteGoodsEntries) open(path) - reviewGoodsPage.mustRenderBasicContent(path, title) + page.mustRenderBasicContent(path, title) - reviewGoodsPage.goodsSummariesAsMap mustBe + page.goodsSummariesAsMap mustBe Seq( Map( "Price paid" -> "99.99, Eurozone Euro (EUR)", @@ -78,14 +79,14 @@ class ReviewGoodsPageSpec extends BasePageSpec[ReviewGoodsPage] { givenADeclarationJourney(importJourneyWithOneCompleteGoodsEntry) open(path) - reviewGoodsPage.remove(0) mustBe RemoveGoodsPage.path(1) + page.remove(0) mustBe RemoveGoodsPage.path(1) } "there are multiple goods entries" in { givenADeclarationJourney(importJourneyWithTwoCompleteGoodsEntries) open(path) - reviewGoodsPage.remove(1) mustBe RemoveGoodsPage.path(2) + page.remove(1) mustBe RemoveGoodsPage.path(2) } } @@ -94,14 +95,14 @@ class ReviewGoodsPageSpec extends BasePageSpec[ReviewGoodsPage] { givenADeclarationJourney(importJourneyWithOneCompleteGoodsEntry) open(path) - reviewGoodsPage.completeAndSubmitForm(Yes) mustBe SearchGoodsPage.path(2) + page.completeAndSubmitForm(Yes) mustBe SearchGoodsPage.path(2) } "the user elects to make a third goods entry" in { givenADeclarationJourney(importJourneyWithTwoCompleteGoodsEntries) open(path) - reviewGoodsPage.completeAndSubmitForm(Yes) mustBe SearchGoodsPage.path(3) + page.completeAndSubmitForm(Yes) mustBe SearchGoodsPage.path(3) } } @@ -110,7 +111,7 @@ class ReviewGoodsPageSpec extends BasePageSpec[ReviewGoodsPage] { givenADeclarationJourney(importJourneyWithOneCompleteGoodsEntry) open(path) - reviewGoodsPage.completeAndSubmitForm(No) mustBe PaymentCalculationPage.path + page.completeAndSubmitForm(No) mustBe PaymentCalculationPage.path } } } diff --git a/test/uk/gov/hmrc/merchandiseinbaggagefrontend/pagespecs/SearchGoodsCountryPageSpec.scala b/test/uk/gov/hmrc/merchandiseinbaggagefrontend/pagespecs/SearchGoodsCountryPageSpec.scala index 0a8f4ed31..97a75a283 100644 --- a/test/uk/gov/hmrc/merchandiseinbaggagefrontend/pagespecs/SearchGoodsCountryPageSpec.scala +++ b/test/uk/gov/hmrc/merchandiseinbaggagefrontend/pagespecs/SearchGoodsCountryPageSpec.scala @@ -16,6 +16,7 @@ package uk.gov.hmrc.merchandiseinbaggagefrontend.pagespecs +import com.softwaremill.macwire.wire import org.scalatest.concurrent.ScalaFutures import uk.gov.hmrc.merchandiseinbaggagefrontend.model.core.GoodsEntry import uk.gov.hmrc.merchandiseinbaggagefrontend.pagespecs.pages.SearchGoodsCountryPage.{path, title} @@ -23,7 +24,7 @@ import uk.gov.hmrc.merchandiseinbaggagefrontend.pagespecs.pages.{PurchaseDetails import uk.gov.hmrc.merchandiseinbaggagefrontend.service.CountriesService.countries class SearchGoodsCountryPageSpec extends GoodsEntryPageSpec[String, SearchGoodsCountryPage] with ScalaFutures { - override lazy val page: SearchGoodsCountryPage = searchGoodsCountryPage + override lazy val page: SearchGoodsCountryPage = wire[SearchGoodsCountryPage] "the search goods country page" should { behave like aGoodsEntryPage(path, title, countries.head, Some(PurchaseDetailsPage.path)) diff --git a/test/uk/gov/hmrc/merchandiseinbaggagefrontend/pagespecs/SearchGoodsPageSpec.scala b/test/uk/gov/hmrc/merchandiseinbaggagefrontend/pagespecs/SearchGoodsPageSpec.scala index 12bf40d25..da8351447 100644 --- a/test/uk/gov/hmrc/merchandiseinbaggagefrontend/pagespecs/SearchGoodsPageSpec.scala +++ b/test/uk/gov/hmrc/merchandiseinbaggagefrontend/pagespecs/SearchGoodsPageSpec.scala @@ -16,12 +16,13 @@ package uk.gov.hmrc.merchandiseinbaggagefrontend.pagespecs +import com.softwaremill.macwire.wire import uk.gov.hmrc.merchandiseinbaggagefrontend.model.core.{CategoryQuantityOfGoods, GoodsEntry} import uk.gov.hmrc.merchandiseinbaggagefrontend.pagespecs.pages.SearchGoodsPage.{path, title} import uk.gov.hmrc.merchandiseinbaggagefrontend.pagespecs.pages.{GoodsVatRatePage, SearchGoodsPage} class SearchGoodsPageSpec extends GoodsEntryPageSpec[CategoryQuantityOfGoods, SearchGoodsPage] { - override def page: SearchGoodsPage = searchGoodsPage + override def page: SearchGoodsPage = wire[SearchGoodsPage] "the search goods page" should { behave like aGoodsEntryPage(path, title, CategoryQuantityOfGoods("test good", "123"), Some(GoodsVatRatePage.path)) diff --git a/test/uk/gov/hmrc/merchandiseinbaggagefrontend/pagespecs/TravellerDetailsPageSpec.scala b/test/uk/gov/hmrc/merchandiseinbaggagefrontend/pagespecs/TravellerDetailsPageSpec.scala index f79d957bb..34c306b6c 100644 --- a/test/uk/gov/hmrc/merchandiseinbaggagefrontend/pagespecs/TravellerDetailsPageSpec.scala +++ b/test/uk/gov/hmrc/merchandiseinbaggagefrontend/pagespecs/TravellerDetailsPageSpec.scala @@ -16,13 +16,14 @@ package uk.gov.hmrc.merchandiseinbaggagefrontend.pagespecs +import com.softwaremill.macwire.wire import org.scalatest.concurrent.ScalaFutures import uk.gov.hmrc.merchandiseinbaggagefrontend.model.core.{DeclarationJourney, Name} import uk.gov.hmrc.merchandiseinbaggagefrontend.pagespecs.pages.{JourneyDetailsPage, TravellerDetailsPage} import uk.gov.hmrc.merchandiseinbaggagefrontend.pagespecs.pages.TravellerDetailsPage._ class TravellerDetailsPageSpec extends DeclarationDataCapturePageSpec[Name, TravellerDetailsPage] with ScalaFutures { - override lazy val page: TravellerDetailsPage = travellerDetailsPage + override lazy val page: TravellerDetailsPage = wire[TravellerDetailsPage] "the traveller details page" should { behave like aPageWhichRequiresADeclarationJourney(path) diff --git a/test/uk/gov/hmrc/merchandiseinbaggagefrontend/pagespecs/ValueWeightOfGoodsPageSpec.scala b/test/uk/gov/hmrc/merchandiseinbaggagefrontend/pagespecs/ValueWeightOfGoodsPageSpec.scala index d21fb4583..133314680 100644 --- a/test/uk/gov/hmrc/merchandiseinbaggagefrontend/pagespecs/ValueWeightOfGoodsPageSpec.scala +++ b/test/uk/gov/hmrc/merchandiseinbaggagefrontend/pagespecs/ValueWeightOfGoodsPageSpec.scala @@ -16,6 +16,7 @@ package uk.gov.hmrc.merchandiseinbaggagefrontend.pagespecs +import com.softwaremill.macwire.wire import uk.gov.hmrc.merchandiseinbaggagefrontend.model.core.GoodsDestinations.{GreatBritain, NorthernIreland} import uk.gov.hmrc.merchandiseinbaggagefrontend.model.core.YesNo.{No, Yes} import uk.gov.hmrc.merchandiseinbaggagefrontend.model.core.{DeclarationJourney, YesNo} @@ -23,7 +24,7 @@ import uk.gov.hmrc.merchandiseinbaggagefrontend.pagespecs.pages.ValueWeightOfGoo import uk.gov.hmrc.merchandiseinbaggagefrontend.pagespecs.pages.{CannotUseServicePage, RadioButtonPage, SearchGoodsPage} class ValueWeightOfGoodsPageSpec extends DeclarationDataCapturePageSpec[YesNo, RadioButtonPage[YesNo]] { - override lazy val page: RadioButtonPage[YesNo] = valueWeightOfGoodsPage + override lazy val page: RadioButtonPage[YesNo] = wire[RadioButtonPage[YesNo]] private def givenANorthernIrelandJourney(): Unit = givenADeclarationJourney(startedImportJourney.copy(maybeGoodsDestination = Some(NorthernIreland))) diff --git a/test/uk/gov/hmrc/merchandiseinbaggagefrontend/pagespecs/VehicleRegistrationNumberPageSpec.scala b/test/uk/gov/hmrc/merchandiseinbaggagefrontend/pagespecs/VehicleRegistrationNumberPageSpec.scala index 82fb8f1cd..17dc909a3 100644 --- a/test/uk/gov/hmrc/merchandiseinbaggagefrontend/pagespecs/VehicleRegistrationNumberPageSpec.scala +++ b/test/uk/gov/hmrc/merchandiseinbaggagefrontend/pagespecs/VehicleRegistrationNumberPageSpec.scala @@ -16,12 +16,13 @@ package uk.gov.hmrc.merchandiseinbaggagefrontend.pagespecs +import com.softwaremill.macwire.wire import uk.gov.hmrc.merchandiseinbaggagefrontend.model.core.DeclarationJourney import uk.gov.hmrc.merchandiseinbaggagefrontend.pagespecs.pages.VehicleRegistrationNumberPage.{path, title} import uk.gov.hmrc.merchandiseinbaggagefrontend.pagespecs.pages.{CheckYourAnswersPage, InvalidRequestPage, VehicleRegistrationNumberPage} class VehicleRegistrationNumberPageSpec extends DeclarationDataCapturePageSpec[String, VehicleRegistrationNumberPage] { - override lazy val page: VehicleRegistrationNumberPage = vehicleRegistrationNumberPage + override lazy val page: VehicleRegistrationNumberPage = wire[VehicleRegistrationNumberPage] private val registrationNumber = "reg 123" diff --git a/test/uk/gov/hmrc/merchandiseinbaggagefrontend/pagespecs/VehicleSizePageSpec.scala b/test/uk/gov/hmrc/merchandiseinbaggagefrontend/pagespecs/VehicleSizePageSpec.scala new file mode 100644 index 000000000..0fda1a260 --- /dev/null +++ b/test/uk/gov/hmrc/merchandiseinbaggagefrontend/pagespecs/VehicleSizePageSpec.scala @@ -0,0 +1,41 @@ +/* + * Copyright 2020 HM Revenue & Customs + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package uk.gov.hmrc.merchandiseinbaggagefrontend.pagespecs + +import com.softwaremill.macwire.wire +import uk.gov.hmrc.merchandiseinbaggagefrontend.model.core.YesNo.{No, Yes} +import uk.gov.hmrc.merchandiseinbaggagefrontend.model.core.{DeclarationJourney, YesNo} +import uk.gov.hmrc.merchandiseinbaggagefrontend.pagespecs.pages.VehicleSizePage._ +import uk.gov.hmrc.merchandiseinbaggagefrontend.pagespecs.pages.{CannotUseServicePage, RadioButtonPage, VehicleRegistrationNumberPage} + +class VehicleSizePageSpec extends DeclarationDataCapturePageSpec[YesNo, RadioButtonPage[YesNo]] { + override lazy val page: RadioButtonPage[YesNo] = wire[RadioButtonPage[YesNo]] + + "the excise and restricted goods page" should { + behave like aPageWhichRequiresADeclarationJourney(path) + behave like aPageWhichRenders(path, givenAnImportJourneyIsStarted(), title) + behave like aPageWhichDisplaysPreviouslyEnteredAnswers(path) + + behave like aDataCapturePageWithConditionalRouting( + path, givenAnImportJourneyIsStarted(), Yes, VehicleRegistrationNumberPage.path) + + behave like aDataCapturePageWithConditionalRouting( + path, givenADeclarationJourney(startedImportToGreatBritainJourney), No, CannotUseServicePage.path) + } + + override def extractFormDataFrom(declarationJourney: DeclarationJourney): Option[YesNo] = declarationJourney.maybeTravellingBySmallVehicle +} diff --git a/test/uk/gov/hmrc/merchandiseinbaggagefrontend/pagespecs/pages/CustomsAgentPage.scala b/test/uk/gov/hmrc/merchandiseinbaggagefrontend/pagespecs/pages/CustomsAgentPage.scala index f65f6f6f6..157014b15 100644 --- a/test/uk/gov/hmrc/merchandiseinbaggagefrontend/pagespecs/pages/CustomsAgentPage.scala +++ b/test/uk/gov/hmrc/merchandiseinbaggagefrontend/pagespecs/pages/CustomsAgentPage.scala @@ -16,7 +16,6 @@ package uk.gov.hmrc.merchandiseinbaggagefrontend.pagespecs.pages - object CustomsAgentPage { val path = "/merchandise-in-baggage/customs-agent" val title = "Are you a customs agent?" diff --git a/test/uk/gov/hmrc/merchandiseinbaggagefrontend/pagespecs/pages/GoodsInVehiclePage.scala b/test/uk/gov/hmrc/merchandiseinbaggagefrontend/pagespecs/pages/GoodsInVehiclePage.scala index 1432243fe..f9957e821 100644 --- a/test/uk/gov/hmrc/merchandiseinbaggagefrontend/pagespecs/pages/GoodsInVehiclePage.scala +++ b/test/uk/gov/hmrc/merchandiseinbaggagefrontend/pagespecs/pages/GoodsInVehiclePage.scala @@ -18,5 +18,6 @@ package uk.gov.hmrc.merchandiseinbaggagefrontend.pagespecs.pages object GoodsInVehiclePage { val path: String = "/merchandise-in-baggage/goods-in-vehicle" + val title: String = "Are you travelling by vehicle?" } diff --git a/test/uk/gov/hmrc/merchandiseinbaggagefrontend/pagespecs/pages/VehicleSizePage.scala b/test/uk/gov/hmrc/merchandiseinbaggagefrontend/pagespecs/pages/VehicleSizePage.scala new file mode 100644 index 000000000..a517a2508 --- /dev/null +++ b/test/uk/gov/hmrc/merchandiseinbaggagefrontend/pagespecs/pages/VehicleSizePage.scala @@ -0,0 +1,22 @@ +/* + * Copyright 2020 HM Revenue & Customs + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package uk.gov.hmrc.merchandiseinbaggagefrontend.pagespecs.pages + +object VehicleSizePage{ + val path = "/merchandise-in-baggage/vehicle-size" + val title = "Are you bringing the goods in a small vehicle?" +}