diff --git a/app/pages/annualallowance/taxyear/WhichSchemePage.scala b/app/pages/annualallowance/taxyear/WhichSchemePage.scala index f7d0740c1..dd1788d3d 100644 --- a/app/pages/annualallowance/taxyear/WhichSchemePage.scala +++ b/app/pages/annualallowance/taxyear/WhichSchemePage.scala @@ -35,8 +35,14 @@ case class WhichSchemePage(period: Period, schemeIndex: SchemeIndex) extends Que controllers.annualallowance.taxyear.routes.PensionSchemeDetailsController .onPageLoad(NormalMode, period, schemeIndex) case Some(_) => - controllers.annualallowance.taxyear.routes.PensionSchemeInputAmountsController - .onPageLoad(NormalMode, period, schemeIndex) + period match { + case Period._2016 => + controllers.annualallowance.taxyear.routes.PensionSchemeInput2016preAmountsController + .onPageLoad(NormalMode, period, schemeIndex) + case _ => + controllers.annualallowance.taxyear.routes.PensionSchemeInputAmountsController + .onPageLoad(NormalMode, period, schemeIndex) + } case None => controllers.routes.JourneyRecoveryController.onPageLoad(None) } } diff --git a/test/pages/annualallowance/taxyear/WhichSchemePageSpec.scala b/test/pages/annualallowance/taxyear/WhichSchemePageSpec.scala index 2b8be42c8..d5df468dd 100644 --- a/test/pages/annualallowance/taxyear/WhichSchemePageSpec.scala +++ b/test/pages/annualallowance/taxyear/WhichSchemePageSpec.scala @@ -32,7 +32,7 @@ class WhichSchemeSpec extends PageBehaviours { "normal mode navigation" - { - "when a scheme ref is specified capture input amounts" in { + "when a scheme ref is specified capture input amounts for 2017+ periods" in { val userAnswers = emptyUserAnswers.set(WhichSchemePage(Period._2018, SchemeIndex(0)), "schemeRef").get val nextPageUrl: String = @@ -41,6 +41,15 @@ class WhichSchemeSpec extends PageBehaviours { checkNavigation(nextPageUrl, "/annual-allowance/2018/pension-scheme-0/pension-input-amount") } + "when a scheme ref is specified capture input amounts for 2016 period" in { + val userAnswers = emptyUserAnswers.set(WhichSchemePage(Period._2016, SchemeIndex(0)), "schemeRef").get + + val nextPageUrl: String = + WhichSchemePage(Period._2016, SchemeIndex(0)).navigate(NormalMode, userAnswers).url + + checkNavigation(nextPageUrl, "/annual-allowance/2016/pension-scheme-0/pension-input-amount-15-16-period-1") + } + "when a new scheme is indicated capture scheme details" in { val userAnswers = emptyUserAnswers.set(WhichSchemePage(Period._2018, SchemeIndex(0)), PSTR.New).get