From 5da747d702e1bbf977255727ab8f63db7439e746 Mon Sep 17 00:00:00 2001 From: Michele Satta <3033136+msatta@users.noreply.github.com> Date: Fri, 8 Nov 2024 16:20:24 +0000 Subject: [PATCH] ADR-1401: Cache renamed as User Answers (#196) --- .../$section$/$className$Controller.scala | 10 +-- .../$section$/$className$ControllerSpec.scala | 8 +-- .../$section$/$className$Controller.scala | 6 +- .../$section$/$className$ControllerSpec.scala | 8 +-- .../$section$/$className$Controller.scala | 6 +- .../$section$/$className$ControllerSpec.scala | 8 +-- .../$section$/$className$Controller.scala | 6 +- .../$section$/$className$ControllerSpec.scala | 8 +-- .../$section$/$className$Controller.scala | 6 +- .../$section$/$className$ControllerSpec.scala | 8 +-- .../$section$/$className$Controller.scala | 6 +- .../$section$/$className$ControllerSpec.scala | 8 +-- .../$section$/$className$Controller.scala | 6 +- .../$section$/$className$ControllerSpec.scala | 8 +-- .../$section$/$className$Controller.scala | 6 +- .../$section$/$className$ControllerSpec.scala | 8 +-- app/config/FrontendAppConfig.scala | 23 +++---- ...ector.scala => UserAnswersConnector.scala} | 14 ++-- .../BeforeStartReturnController.scala | 14 ++-- .../BusinessTaxAccountRedirect.scala | 6 +- app/controllers/KeepAliveController.scala | 6 +- .../actions/DataRetrievalAction.scala | 6 +- .../AdjustmentDutyDueController.scala | 6 +- .../adjustment/AdjustmentListController.scala | 8 +-- ...djustmentRepackagedTaxTypeController.scala | 6 +- ...mallProducerReliefDutyRateController.scala | 6 +- .../AdjustmentTaxTypeController.scala | 6 +- .../adjustment/AdjustmentTypeController.scala | 6 +- .../AdjustmentVolumeController.scala | 6 +- .../AdjustmentVolumeWithSPRController.scala | 6 +- .../AlcoholicProductTypeController.scala | 6 +- .../CheckYourAnswersController.scala | 8 +-- .../DeclareAdjustmentQuestionController.scala | 6 +- .../DeleteAdjustmentController.scala | 6 +- .../OverDeclarationReasonController.scala | 6 +- .../SpoiltVolumeWithDutyController.scala | 6 +- .../UnderDeclarationReasonController.scala | 6 +- .../WhenDidYouPayDutyController.scala | 6 +- app/controllers/auth/AuthController.scala | 6 +- .../declareDuty/AlcoholTypeController.scala | 6 +- .../CheckYourAnswersSPRController.scala | 6 +- ...DeclareAlcoholDutyQuestionController.scala | 6 +- .../DeleteMultipleSPREntryController.scala | 6 +- ...ouHaveMultipleSPRDutyRatesController.scala | 6 +- .../DutyCalculationController.scala | 8 +-- .../HowMuchDoYouNeedToDeclareController.scala | 6 +- .../MultipleSPRListController.scala | 6 +- ...TellUsAboutMultipleSPRRateController.scala | 6 +- .../TellUsAboutSingleSPRRateController.scala | 6 +- .../WhatDoYouNeedToDeclareController.scala | 6 +- ...uspendedDeliveriesQuestionController.scala | 6 +- .../DutySuspendedBeerController.scala | 6 +- .../DutySuspendedCiderController.scala | 6 +- ...utySuspendedOtherFermentedController.scala | 6 +- .../DutySuspendedSpiritsController.scala | 6 +- .../DutySuspendedWineController.scala | 6 +- .../AlcoholUsedController.scala | 6 +- .../DeclareQuarterlySpiritsController.scala | 6 +- .../DeclareSpiritsTotalController.scala | 6 +- .../EthyleneGasOrMolassesUsedController.scala | 6 +- .../GrainsUsedController.scala | 6 +- .../OtherIngredientsUsedController.scala | 6 +- .../OtherMaltedGrainsController.scala | 6 +- .../OtherSpiritsProducedController.scala | 6 +- .../SpiritTypeController.scala | 6 +- .../spiritsQuestions/WhiskyController.scala | 6 +- .../adjustment/AdjustmentEntryService.scala | 2 +- .../connectors/TestOnlyCacheConnector.scala | 4 +- .../controllers/TestOnlyController.scala | 4 +- .../AdjustmentListSummaryHelper.scala | 8 ++- build.sbt | 2 +- ....scala => UserAnswersConnectorISpec.scala} | 39 ++++++----- ...c.scala => UserAnswersConnectorSpec.scala} | 30 ++++---- .../BeforeStartReturnControllerSpec.scala | 44 ++++++------ .../BusinessTaxAccountRedirectSpec.scala | 16 ++--- .../controllers/KeepAliveControllerSpec.scala | 15 ++-- .../actions/DataRetrievalActionSpec.scala | 41 +++++------ .../AdjustmentDutyDueControllerSpec.scala | 12 ++-- .../AdjustmentListControllerSpec.scala | 32 ++++----- ...tmentRepackagedTaxTypeControllerSpec.scala | 58 ++++++++-------- ...ProducerReliefDutyRateControllerSpec.scala | 14 ++-- .../AdjustmentTaxTypeControllerSpec.scala | 34 +++++----- .../AdjustmentTypeControllerSpec.scala | 26 +++---- .../AdjustmentVolumeControllerSpec.scala | 20 +++--- ...djustmentVolumeWithSPRControllerSpec.scala | 20 +++--- .../AlcoholicProductTypeControllerSpec.scala | 24 +++---- .../CheckYourAnswersControllerSpec.scala | 68 +++++++++---------- ...lareAdjustmentQuestionControllerSpec.scala | 14 ++-- .../DeleteAdjustmentControllerSpec.scala | 34 +++++----- .../OverDeclarationReasonControllerSpec.scala | 8 +-- .../SpoiltVolumeWithDutyControllerSpec.scala | 26 +++---- ...UnderDeclarationReasonControllerSpec.scala | 8 +-- .../WhenDidYouPayDutyControllerSpec.scala | 20 +++--- .../controllers/auth/AuthControllerSpec.scala | 16 ++--- .../AlcoholTypeControllerSpec.scala | 8 +-- .../CheckYourAnswersSPRControllerSpec.scala | 14 ++-- ...areAlcoholDutyQuestionControllerSpec.scala | 22 +++--- ...DeleteMultipleSPREntryControllerSpec.scala | 14 ++-- ...veMultipleSPRDutyRatesControllerSpec.scala | 20 +++--- .../DutyCalculationControllerSpec.scala | 32 ++++----- ...MuchDoYouNeedToDeclareControllerSpec.scala | 14 ++-- .../MultipleSPRListControllerSpec.scala | 8 +-- ...UsAboutMultipleSPRRateControllerSpec.scala | 32 ++++----- ...llUsAboutSingleSPRRateControllerSpec.scala | 8 +-- ...WhatDoYouNeedToDeclareControllerSpec.scala | 20 +++--- ...ndedDeliveriesQuestionControllerSpec.scala | 16 ++--- .../DutySuspendedBeerControllerSpec.scala | 8 +-- .../DutySuspendedCiderControllerSpec.scala | 8 +-- ...uspendedOtherFermentedControllerSpec.scala | 8 +-- .../DutySuspendedSpiritsControllerSpec.scala | 8 +-- .../DutySuspendedWineControllerSpec.scala | 8 +-- .../AlcoholUsedControllerSpec.scala | 8 +-- .../CheckYourAnswersControllerSpec.scala | 20 +++--- ...eclareQuarterlySpiritsControllerSpec.scala | 8 +-- .../DeclareSpiritsTotalControllerSpec.scala | 8 +-- ...yleneGasOrMolassesUsedControllerSpec.scala | 20 +++--- .../GrainsUsedControllerSpec.scala | 20 +++--- .../OtherIngredientsUsedControllerSpec.scala | 8 +-- .../OtherMaltedGrainsControllerSpec.scala | 8 +-- .../OtherSpiritsProducedControllerSpec.scala | 8 +-- .../SpiritTypeControllerSpec.scala | 20 +++--- .../WhiskyControllerSpec.scala | 8 +-- .../BeforeStartReturnViewModelSpec.scala | 10 +-- .../AdjustmentListSummaryHelperSpec.scala | 2 +- 124 files changed, 748 insertions(+), 742 deletions(-) rename app/connectors/{CacheConnector.scala => UserAnswersConnector.scala} (82%) rename it/test/{CacheConnectorISpec.scala => UserAnswersConnectorISpec.scala} (81%) rename test/connectors/{CacheConnectorSpec.scala => UserAnswersConnectorSpec.scala} (80%) diff --git a/.g8/bigDecimalPage/app/controllers/$section$/$className$Controller.scala b/.g8/bigDecimalPage/app/controllers/$section$/$className$Controller.scala index 89d10545..a13adb9b 100644 --- a/.g8/bigDecimalPage/app/controllers/$section$/$className$Controller.scala +++ b/.g8/bigDecimalPage/app/controllers/$section$/$className$Controller.scala @@ -8,16 +8,16 @@ import navigation.$section;format="cap"$Navigator import pages.$section$.$className$Page import play.api.i18n.{I18nSupport, MessagesApi} import play.api.mvc.{Action, AnyContent, MessagesControllerComponents} -import connectors.CacheConnector +import connectors.UserAnswersConnector import uk.gov.hmrc.play.bootstrap.frontend.controller.FrontendBaseController import views.html.$section$.$className$View import scala.concurrent.{ExecutionContext, Future} class $className$Controller @Inject()( - override val messagesApi: MessagesApi, - cacheConnector: CacheConnector, - navigator: $section;format="cap"$Navigator, + override val messagesApi: MessagesApi, + userAnswersConnector: UserAnswersConnector, + navigator: $section;format="cap"$Navigator, identify: IdentifyWithEnrolmentAction, getData: DataRetrievalAction, requireData: DataRequiredAction, @@ -49,7 +49,7 @@ class $className$Controller @Inject()( value => for { updatedAnswers <- Future.fromTry(request.userAnswers.set($className$Page, value)) - _ <- cacheConnector.set(updatedAnswers) + _ <- userAnswersConnector.set(updatedAnswers) } yield Redirect(navigator.nextPage($className$Page, mode, updatedAnswers)) ) } diff --git a/.g8/bigDecimalPage/generated-test/controllers/$section$/$className$ControllerSpec.scala b/.g8/bigDecimalPage/generated-test/controllers/$section$/$className$ControllerSpec.scala index a48c8cb8..897e5494 100644 --- a/.g8/bigDecimalPage/generated-test/controllers/$section$/$className$ControllerSpec.scala +++ b/.g8/bigDecimalPage/generated-test/controllers/$section$/$className$ControllerSpec.scala @@ -11,7 +11,7 @@ import pages.$section$.$className$Page import play.api.inject.bind import play.api.mvc.Call import play.api.test.Helpers._ -import connectors.CacheConnector +import connectors.UserAnswersConnector import uk.gov.hmrc.http.HttpResponse import views.html.$section$.$className$View @@ -66,15 +66,15 @@ class $className$ControllerSpec extends SpecBase { "must redirect to the next page when valid data is submitted" in { - val mockCacheConnector = mock[CacheConnector] + val mockUserAnswersConnector = mock[UserAnswersConnector] - when(mockCacheConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) + when(mockUserAnswersConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) val application = applicationBuilder(userAnswers = Some(emptyUserAnswers)) .overrides( bind[$section;format="cap"$Navigator].toInstance(new Fake$section;format="cap"$Navigator(onwardRoute)), - bind[CacheConnector].toInstance(mockCacheConnector) + bind[UserAnswersConnector].toInstance(mockUserAnswersConnector) ) .build() diff --git a/.g8/checkboxPage/app/controllers/$section$/$className$Controller.scala b/.g8/checkboxPage/app/controllers/$section$/$className$Controller.scala index 4978bed8..96311e91 100644 --- a/.g8/checkboxPage/app/controllers/$section$/$className$Controller.scala +++ b/.g8/checkboxPage/app/controllers/$section$/$className$Controller.scala @@ -8,7 +8,7 @@ import navigation.$section;format="cap"$Navigator import pages.$section$.$className$Page import play.api.i18n.{I18nSupport, MessagesApi} import play.api.mvc.{Action, AnyContent, MessagesControllerComponents} -import connectors.CacheConnector +import connectors.UserAnswersConnector import uk.gov.hmrc.play.bootstrap.frontend.controller.FrontendBaseController import views.html.$section$.$className$View @@ -16,7 +16,7 @@ import scala.concurrent.{ExecutionContext, Future} class $className$Controller @Inject()( override val messagesApi: MessagesApi, - cacheConnector: CacheConnector, + userAnswersConnector: UserAnswersConnector, navigator: $section;format="cap"$Navigator, identify: IdentifyWithEnrolmentAction, getData: DataRetrievalAction, @@ -49,7 +49,7 @@ class $className$Controller @Inject()( value => for { updatedAnswers <- Future.fromTry(request.userAnswers.set($className$Page, value)) - _ <- cacheConnector.set(updatedAnswers) + _ <- userAnswersConnector.set(updatedAnswers) } yield Redirect(navigator.nextPage($className$Page, mode, updatedAnswers)) ) } diff --git a/.g8/checkboxPage/generated-test/controllers/$section$/$className$ControllerSpec.scala b/.g8/checkboxPage/generated-test/controllers/$section$/$className$ControllerSpec.scala index 11335d1d..da51aa2b 100644 --- a/.g8/checkboxPage/generated-test/controllers/$section$/$className$ControllerSpec.scala +++ b/.g8/checkboxPage/generated-test/controllers/$section$/$className$ControllerSpec.scala @@ -12,7 +12,7 @@ import pages.$section$.$className$Page import play.api.inject.bind import play.api.mvc.Call import play.api.test.Helpers._ -import connectors.CacheConnector +import connectors.UserAnswersConnector import uk.gov.hmrc.http.HttpResponse import views.html.$section$.$className$View @@ -66,15 +66,15 @@ class $className$ControllerSpec extends SpecBase{ "must redirect to the next page when valid data is submitted" in { - val mockCacheConnector = mock[CacheConnector] + val mockUserAnswersConnector = mock[UserAnswersConnector] - when(mockCacheConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) + when(mockUserAnswersConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) val application = applicationBuilder(userAnswers = Some(emptyUserAnswers)) .overrides( bind[$section;format="cap"$Navigator].toInstance(new Fake$section;format="cap"$Navigator(onwardRoute)), - bind[CacheConnector].toInstance(mockCacheConnector) + bind[UserAnswersConnector].toInstance(mockUserAnswersConnector) ) .build() diff --git a/.g8/datePage/app/controllers/$section$/$className$Controller.scala b/.g8/datePage/app/controllers/$section$/$className$Controller.scala index f37a5743..f8122a41 100644 --- a/.g8/datePage/app/controllers/$section$/$className$Controller.scala +++ b/.g8/datePage/app/controllers/$section$/$className$Controller.scala @@ -8,7 +8,7 @@ import navigation.$section;format="cap"$Navigator import pages.$section$.$className$Page import play.api.i18n.{I18nSupport, MessagesApi} import play.api.mvc.{Action, AnyContent, MessagesControllerComponents} -import connectors.CacheConnector +import connectors.UserAnswersConnector import uk.gov.hmrc.play.bootstrap.frontend.controller.FrontendBaseController import views.html.$section$.$className$View @@ -16,7 +16,7 @@ import scala.concurrent.{ExecutionContext, Future} class $className$Controller @Inject()( override val messagesApi: MessagesApi, - cacheConnector: CacheConnector, + userAnswersConnector: UserAnswersConnector, navigator: $section;format="cap"$Navigator, identify: IdentifyWithEnrolmentAction, getData: DataRetrievalAction, @@ -49,7 +49,7 @@ class $className$Controller @Inject()( value => for { updatedAnswers <- Future.fromTry(request.userAnswers.set($className$Page, value)) - _ <- cacheConnector.set(updatedAnswers) + _ <- userAnswersConnector.set(updatedAnswers) } yield Redirect(navigator.nextPage($className$Page, mode, updatedAnswers)) ) } diff --git a/.g8/datePage/generated-test/controllers/$section$/$className$ControllerSpec.scala b/.g8/datePage/generated-test/controllers/$section$/$className$ControllerSpec.scala index c79a4fd0..71f80fb0 100644 --- a/.g8/datePage/generated-test/controllers/$section$/$className$ControllerSpec.scala +++ b/.g8/datePage/generated-test/controllers/$section$/$className$ControllerSpec.scala @@ -13,7 +13,7 @@ import pages.$section$.$className$Page import play.api.inject.bind import play.api.mvc.{AnyContentAsEmpty, AnyContentAsFormUrlEncoded, Call} import play.api.test.Helpers._ -import connectors.CacheConnector +import connectors.UserAnswersConnector import uk.gov.hmrc.http.HttpResponse import views.html.$section$.$className$View @@ -75,15 +75,15 @@ class $className$ControllerSpec extends SpecBase{ "must redirect to the next page when valid data is submitted" in { - val mockCacheConnector = mock[CacheConnector] + val mockUserAnswersConnector = mock[UserAnswersConnector] - when(mockCacheConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) + when(mockUserAnswersConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) val application = applicationBuilder(userAnswers = Some(emptyUserAnswers)) .overrides( bind[$section;format="cap"$Navigator].toInstance(new Fake$section;format="cap"$Navigator(onwardRoute)), - bind[CacheConnector].toInstance(mockCacheConnector) + bind[UserAnswersConnector].toInstance(mockUserAnswersConnector) ) .build() diff --git a/.g8/intPage/app/controllers/$section$/$className$Controller.scala b/.g8/intPage/app/controllers/$section$/$className$Controller.scala index f1278a95..2f7c3d23 100644 --- a/.g8/intPage/app/controllers/$section$/$className$Controller.scala +++ b/.g8/intPage/app/controllers/$section$/$className$Controller.scala @@ -8,7 +8,7 @@ import navigation.$section;format="cap"$Navigator import pages.$section$.$className$Page import play.api.i18n.{I18nSupport, MessagesApi} import play.api.mvc.{Action, AnyContent, MessagesControllerComponents} -import connectors.CacheConnector +import connectors.UserAnswersConnector import uk.gov.hmrc.play.bootstrap.frontend.controller.FrontendBaseController import views.html.$section$.$className$View @@ -16,7 +16,7 @@ import scala.concurrent.{ExecutionContext, Future} class $className$Controller @Inject()( override val messagesApi: MessagesApi, - cacheConnector: CacheConnector, + userAnswersConnector: UserAnswersConnector, navigator: $section;format="cap"$Navigator, identify: IdentifyWithEnrolmentAction, getData: DataRetrievalAction, @@ -49,7 +49,7 @@ class $className$Controller @Inject()( value => for { updatedAnswers <- Future.fromTry(request.userAnswers.set($className$Page, value)) - _ <- cacheConnector.set(updatedAnswers) + _ <- userAnswersConnector.set(updatedAnswers) } yield Redirect(navigator.nextPage($className$Page, mode, updatedAnswers)) ) } diff --git a/.g8/intPage/generated-test/controllers/$section$/$className$ControllerSpec.scala b/.g8/intPage/generated-test/controllers/$section$/$className$ControllerSpec.scala index 53a6333a..4e61dfbd 100644 --- a/.g8/intPage/generated-test/controllers/$section$/$className$ControllerSpec.scala +++ b/.g8/intPage/generated-test/controllers/$section$/$className$ControllerSpec.scala @@ -11,7 +11,7 @@ import pages.$section$.$className$Page import play.api.inject.bind import play.api.mvc.Call import play.api.test.Helpers._ -import connectors.CacheConnector +import connectors.UserAnswersConnector import uk.gov.hmrc.http.HttpResponse import views.html.$section$.$className$View @@ -66,15 +66,15 @@ class $className$ControllerSpec extends SpecBase{ "must redirect to the next page when valid data is submitted" in { - val mockCacheConnector = mock[CacheConnector] + val mockUserAnswersConnector = mock[UserAnswersConnector] - when(mockCacheConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) + when(mockUserAnswersConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) val application = applicationBuilder(userAnswers = Some(emptyUserAnswers)) .overrides( bind[$section;format="cap"$Navigator].toInstance(new Fake$section;format="cap"$Navigator(onwardRoute)), - bind[CacheConnector].toInstance(mockCacheConnector) + bind[UserAnswersConnector].toInstance(mockUserAnswersConnector) ) .build() diff --git a/.g8/multipleQuestionsPage/app/controllers/$section$/$className$Controller.scala b/.g8/multipleQuestionsPage/app/controllers/$section$/$className$Controller.scala index 49eedaf9..e2cab297 100644 --- a/.g8/multipleQuestionsPage/app/controllers/$section$/$className$Controller.scala +++ b/.g8/multipleQuestionsPage/app/controllers/$section$/$className$Controller.scala @@ -8,7 +8,7 @@ import navigation.$section;format="cap"$Navigator import pages.$section$.$className$Page import play.api.i18n.{I18nSupport, MessagesApi} import play.api.mvc.{Action, AnyContent, MessagesControllerComponents} -import connectors.CacheConnector +import connectors.UserAnswersConnector import uk.gov.hmrc.play.bootstrap.frontend.controller.FrontendBaseController import views.html.$section$.$className$View @@ -16,7 +16,7 @@ import scala.concurrent.{ExecutionContext, Future} class $className$Controller @Inject()( override val messagesApi: MessagesApi, - cacheConnector: CacheConnector, + userAnswersConnector: UserAnswersConnector, navigator: $section;format="cap"$Navigator, identify: IdentifyWithEnrolmentAction, getData: DataRetrievalAction, @@ -49,7 +49,7 @@ class $className$Controller @Inject()( value => for { updatedAnswers <- Future.fromTry(request.userAnswers.set($className$Page, value)) - _ <- cacheConnector.set(updatedAnswers) + _ <- userAnswersConnector.set(updatedAnswers) } yield Redirect(navigator.nextPage($className$Page, mode, updatedAnswers)) ) } diff --git a/.g8/multipleQuestionsPage/generated-test/controllers/$section$/$className$ControllerSpec.scala b/.g8/multipleQuestionsPage/generated-test/controllers/$section$/$className$ControllerSpec.scala index 85f03bc6..a3f9d1a0 100644 --- a/.g8/multipleQuestionsPage/generated-test/controllers/$section$/$className$ControllerSpec.scala +++ b/.g8/multipleQuestionsPage/generated-test/controllers/$section$/$className$ControllerSpec.scala @@ -13,7 +13,7 @@ import play.api.inject.bind import play.api.libs.json.Json import play.api.mvc.Call import play.api.test.Helpers._ -import connectors.CacheConnector +import connectors.UserAnswersConnector import uk.gov.hmrc.http.HttpResponse import views.html.$section$.$className$View @@ -76,15 +76,15 @@ class $className$ControllerSpec extends SpecBase{ "must redirect to the next page when valid data is submitted" in { - val mockCacheConnector = mock[CacheConnector] + val mockUserAnswersConnector = mock[UserAnswersConnector] - when(mockCacheConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) + when(mockUserAnswersConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) val application = applicationBuilder(userAnswers = Some(emptyUserAnswers)) .overrides( bind[$section;format="cap"$Navigator].toInstance(new Fake$section;format="cap"$Navigator(onwardRoute)), - bind[CacheConnector].toInstance(mockCacheConnector) + bind[UserAnswersConnector].toInstance(mockUserAnswersConnector) ) .build() diff --git a/.g8/radioButtonPage/app/controllers/$section$/$className$Controller.scala b/.g8/radioButtonPage/app/controllers/$section$/$className$Controller.scala index 49eedaf9..e2cab297 100644 --- a/.g8/radioButtonPage/app/controllers/$section$/$className$Controller.scala +++ b/.g8/radioButtonPage/app/controllers/$section$/$className$Controller.scala @@ -8,7 +8,7 @@ import navigation.$section;format="cap"$Navigator import pages.$section$.$className$Page import play.api.i18n.{I18nSupport, MessagesApi} import play.api.mvc.{Action, AnyContent, MessagesControllerComponents} -import connectors.CacheConnector +import connectors.UserAnswersConnector import uk.gov.hmrc.play.bootstrap.frontend.controller.FrontendBaseController import views.html.$section$.$className$View @@ -16,7 +16,7 @@ import scala.concurrent.{ExecutionContext, Future} class $className$Controller @Inject()( override val messagesApi: MessagesApi, - cacheConnector: CacheConnector, + userAnswersConnector: UserAnswersConnector, navigator: $section;format="cap"$Navigator, identify: IdentifyWithEnrolmentAction, getData: DataRetrievalAction, @@ -49,7 +49,7 @@ class $className$Controller @Inject()( value => for { updatedAnswers <- Future.fromTry(request.userAnswers.set($className$Page, value)) - _ <- cacheConnector.set(updatedAnswers) + _ <- userAnswersConnector.set(updatedAnswers) } yield Redirect(navigator.nextPage($className$Page, mode, updatedAnswers)) ) } diff --git a/.g8/radioButtonPage/generated-test/controllers/$section$/$className$ControllerSpec.scala b/.g8/radioButtonPage/generated-test/controllers/$section$/$className$ControllerSpec.scala index e8715100..f95b2b7e 100644 --- a/.g8/radioButtonPage/generated-test/controllers/$section$/$className$ControllerSpec.scala +++ b/.g8/radioButtonPage/generated-test/controllers/$section$/$className$ControllerSpec.scala @@ -12,7 +12,7 @@ import pages.$section$.$className$Page import play.api.inject.bind import play.api.mvc.Call import play.api.test.Helpers._ -import connectors.CacheConnector +import connectors.UserAnswersConnector import uk.gov.hmrc.http.HttpResponse import views.html.$section$.$className$View @@ -65,15 +65,15 @@ class $className$ControllerSpec extends SpecBase{ "must redirect to the next page when valid data is submitted" in { - val mockCacheConnector = mock[CacheConnector] + val mockUserAnswersConnector = mock[UserAnswersConnector] - when(mockCacheConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) + when(mockUserAnswersConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) val application = applicationBuilder(userAnswers = Some(emptyUserAnswers)) .overrides( bind[$section;format="cap"$Navigator].toInstance(new Fake$section;format="cap"$Navigator(onwardRoute)), - bind[CacheConnector].toInstance(mockCacheConnector) + bind[UserAnswersConnector].toInstance(mockUserAnswersConnector) ) .build() diff --git a/.g8/stringPage/app/controllers/$section$/$className$Controller.scala b/.g8/stringPage/app/controllers/$section$/$className$Controller.scala index 9da3bc9a..40a6c860 100644 --- a/.g8/stringPage/app/controllers/$section$/$className$Controller.scala +++ b/.g8/stringPage/app/controllers/$section$/$className$Controller.scala @@ -8,7 +8,7 @@ import navigation.$section;format="cap"$Navigator import pages.$section$.$className$Page import play.api.i18n.{I18nSupport, MessagesApi} import play.api.mvc.{Action, AnyContent, MessagesControllerComponents} -import connectors.CacheConnector +import connectors.UserAnswersConnector import uk.gov.hmrc.play.bootstrap.frontend.controller.FrontendBaseController import views.html.$section$.$className$View @@ -16,7 +16,7 @@ import scala.concurrent.{ExecutionContext, Future} class $className$Controller @Inject()( override val messagesApi: MessagesApi, - cacheConnector: CacheConnector, + userAnswersConnector: UserAnswersConnector, navigator: $section;format="cap"$Navigator, identify: IdentifyWithEnrolmentAction, getData: DataRetrievalAction, @@ -49,7 +49,7 @@ class $className$Controller @Inject()( value => for { updatedAnswers <- Future.fromTry(request.userAnswers.set($className$Page, value)) - _ <- cacheConnector.set(updatedAnswers) + _ <- userAnswersConnector.set(updatedAnswers) } yield Redirect(navigator.nextPage($className$Page, mode, updatedAnswers)) ) } diff --git a/.g8/stringPage/generated-test/controllers/$section$/$className$ControllerSpec.scala b/.g8/stringPage/generated-test/controllers/$section$/$className$ControllerSpec.scala index c612aec1..a22b9621 100644 --- a/.g8/stringPage/generated-test/controllers/$section$/$className$ControllerSpec.scala +++ b/.g8/stringPage/generated-test/controllers/$section$/$className$ControllerSpec.scala @@ -11,7 +11,7 @@ import pages.$section$.$className$Page import play.api.inject.bind import play.api.mvc.Call import play.api.test.Helpers._ -import connectors.CacheConnector +import connectors.UserAnswersConnector import uk.gov.hmrc.http.HttpResponse import views.html.$section$.$className$View @@ -64,15 +64,15 @@ class $className$ControllerSpec extends SpecBase{ "must redirect to the next page when valid data is submitted" in { - val mockCacheConnector = mock[CacheConnector] + val mockUserAnswersConnector = mock[UserAnswersConnector] - when(mockCacheConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) + when(mockUserAnswersConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) val application = applicationBuilder(userAnswers = Some(emptyUserAnswers)) .overrides( bind[$section;format="cap"$Navigator].toInstance(new Fake$section;format="cap"$Navigator(onwardRoute)), - bind[CacheConnector].toInstance(mockCacheConnector) + bind[UserAnswersConnector].toInstance(mockUserAnswersConnector) ) .build() diff --git a/.g8/yesNoPage/app/controllers/$section$/$className$Controller.scala b/.g8/yesNoPage/app/controllers/$section$/$className$Controller.scala index d9bc220e..ec5310b7 100644 --- a/.g8/yesNoPage/app/controllers/$section$/$className$Controller.scala +++ b/.g8/yesNoPage/app/controllers/$section$/$className$Controller.scala @@ -8,7 +8,7 @@ import navigation.$section;format="cap"$Navigator import pages.$section$.$className$Page import play.api.i18n.{I18nSupport, MessagesApi} import play.api.mvc.{Action, AnyContent, MessagesControllerComponents} -import connectors.CacheConnector +import connectors.UserAnswersConnector import uk.gov.hmrc.play.bootstrap.frontend.controller.FrontendBaseController import views.html.$section$.$className$View @@ -16,7 +16,7 @@ import scala.concurrent.{ExecutionContext, Future} class $className;format="cap"$Controller @Inject()( override val messagesApi: MessagesApi, - cacheConnector: CacheConnector, + userAnswersConnector: UserAnswersConnector, navigator: $section;format="cap"$Navigator, identify: IdentifyWithEnrolmentAction, getData: DataRetrievalAction, @@ -49,7 +49,7 @@ class $className;format="cap"$Controller @Inject()( value => for { updatedAnswers <- Future.fromTry(request.userAnswers.set($className$Page, value)) - _ <- cacheConnector.set(updatedAnswers) + _ <- userAnswersConnector.set(updatedAnswers) } yield Redirect(navigator.nextPage($className$Page, mode, updatedAnswers)) ) } diff --git a/.g8/yesNoPage/generated-test/controllers/$section$/$className$ControllerSpec.scala b/.g8/yesNoPage/generated-test/controllers/$section$/$className$ControllerSpec.scala index b413848a..b79e127c 100644 --- a/.g8/yesNoPage/generated-test/controllers/$section$/$className$ControllerSpec.scala +++ b/.g8/yesNoPage/generated-test/controllers/$section$/$className$ControllerSpec.scala @@ -11,7 +11,7 @@ import pages.$section$.$className$Page import play.api.inject.bind import play.api.mvc.Call import play.api.test.Helpers._ -import connectors.CacheConnector +import connectors.UserAnswersConnector import uk.gov.hmrc.http.HttpResponse import views.html.$section$.$className$View @@ -64,15 +64,15 @@ class $className$ControllerSpec extends SpecBase{ "must redirect to the next page when valid data is submitted" in { - val mockCacheConnector = mock[CacheConnector] + val mockUserAnswersConnector = mock[UserAnswersConnector] - when(mockCacheConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) + when(mockUserAnswersConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) val application = applicationBuilder(userAnswers = Some(emptyUserAnswers)) .overrides( bind[$section;format="cap"$Navigator].toInstance(new Fake$section;format="cap"$Navigator(onwardRoute)), - bind[CacheConnector].toInstance(mockCacheConnector) + bind[UserAnswersConnector].toInstance(mockUserAnswersConnector) ) .build() diff --git a/app/config/FrontendAppConfig.scala b/app/config/FrontendAppConfig.scala index 65cc9108..baf9f5b0 100644 --- a/app/config/FrontendAppConfig.scala +++ b/app/config/FrontendAppConfig.scala @@ -90,23 +90,20 @@ class FrontendAppConfig @Inject() (configuration: Configuration, servicesConfig: val timeout: Int = configuration.get[Int]("timeout-dialog.timeout") val countdown: Int = configuration.get[Int]("timeout-dialog.countdown") - def adrCacheGetUrl(appaId: String, periodKey: String): String = - s"$adrReturnsHost/alcohol-duty-returns/cache/get/$appaId/$periodKey" + def adrUserAnswersGetUrl(appaId: String, periodKey: String): String = + s"$adrReturnsHost/alcohol-duty-returns/user-answers/$appaId/$periodKey" - def adrCacheSetUrl(): String = - s"$adrReturnsHost/alcohol-duty-returns/cache/set" + def adrUserAnswersUrl(): String = + s"$adrReturnsHost/alcohol-duty-returns/user-answers" - def adrCacheCreateUserAnswersUrl(): String = - s"$adrReturnsHost/alcohol-duty-returns/cache/user-answers" + def adrReleaseUserAnswersLockUrl(appaId: String, periodKey: String): String = + s"$adrReturnsHost/alcohol-duty-returns/user-answers/lock/$appaId/$periodKey" - def adrReleaseCacheLockUrl(appaId: String, periodKey: String): String = - s"$adrReturnsHost/alcohol-duty-returns/cache/lock/$appaId/$periodKey" + def adrUserAnswersLockKeepAliveUrl(appaId: String, periodKey: String): String = + s"$adrReturnsHost/alcohol-duty-returns/user-answers/lock/$appaId/$periodKey/ttl" - def adrCacheKeepAliveUrl(appaId: String, periodKey: String): String = - s"$adrReturnsHost/alcohol-duty-returns/cache/lock/$appaId/$periodKey/ttl" - - def adrCacheClearAllUrl(): String = - s"$adrReturnsHost/alcohol-duty-returns/test-only/cache/clear-all" + def adrUserAnswersClearAllUrl(): String = + s"$adrReturnsHost/alcohol-duty-returns/test-only/user-answers/clear-all" def adrGetObligationDetailsUrl(appaId: String): String = s"$adrReturnsHost/alcohol-duty-returns/obligationDetails/$appaId" diff --git a/app/connectors/CacheConnector.scala b/app/connectors/UserAnswersConnector.scala similarity index 82% rename from app/connectors/CacheConnector.scala rename to app/connectors/UserAnswersConnector.scala index 818946d2..bc0596f4 100644 --- a/app/connectors/CacheConnector.scala +++ b/app/connectors/UserAnswersConnector.scala @@ -26,7 +26,7 @@ import uk.gov.hmrc.http.{HeaderCarrier, HttpReadsInstances, HttpResponse, String import javax.inject.Inject import scala.concurrent.{ExecutionContext, Future} -class CacheConnector @Inject() ( +class UserAnswersConnector @Inject() ( config: FrontendAppConfig, implicit val httpClient: HttpClientV2 )(implicit ec: ExecutionContext) @@ -35,11 +35,13 @@ class CacheConnector @Inject() ( def get(appaId: String, periodKey: String)(implicit hc: HeaderCarrier ): Future[Either[UpstreamErrorResponse, UserAnswers]] = - httpClient.get(url"${config.adrCacheGetUrl(appaId, periodKey)}").execute[Either[UpstreamErrorResponse, UserAnswers]] + httpClient + .get(url"${config.adrUserAnswersGetUrl(appaId, periodKey)}") + .execute[Either[UpstreamErrorResponse, UserAnswers]] def set(userAnswers: UserAnswers)(implicit hc: HeaderCarrier): Future[HttpResponse] = httpClient - .put(url"${config.adrCacheSetUrl()}") + .put(url"${config.adrUserAnswersUrl()}") .setHeader("Csrf-Token" -> "nocheck") .withBody(Json.toJson(userAnswers)) .execute[HttpResponse] @@ -48,20 +50,20 @@ class CacheConnector @Inject() ( returnAndUserDetails: ReturnAndUserDetails )(implicit hc: HeaderCarrier): Future[Either[UpstreamErrorResponse, UserAnswers]] = httpClient - .post(url"${config.adrCacheCreateUserAnswersUrl()}") + .post(url"${config.adrUserAnswersUrl()}") .withBody(Json.toJson(returnAndUserDetails)) .setHeader("Csrf-Token" -> "nocheck") .execute[Either[UpstreamErrorResponse, UserAnswers]] def releaseLock(returnId: ReturnId)(implicit hc: HeaderCarrier): Future[HttpResponse] = httpClient - .delete(url"${config.adrReleaseCacheLockUrl(returnId.appaId, returnId.periodKey)}") + .delete(url"${config.adrReleaseUserAnswersLockUrl(returnId.appaId, returnId.periodKey)}") .setHeader("Csrf-Token" -> "nocheck") .execute[HttpResponse] def keepAlive(returnId: ReturnId)(implicit hc: HeaderCarrier): Future[HttpResponse] = httpClient - .put(url"${config.adrCacheKeepAliveUrl(returnId.appaId, returnId.periodKey)}") + .put(url"${config.adrUserAnswersLockKeepAliveUrl(returnId.appaId, returnId.periodKey)}") .setHeader("Csrf-Token" -> "nocheck") .execute[HttpResponse] } diff --git a/app/controllers/BeforeStartReturnController.scala b/app/controllers/BeforeStartReturnController.scala index f065b676..096bd66f 100644 --- a/app/controllers/BeforeStartReturnController.scala +++ b/app/controllers/BeforeStartReturnController.scala @@ -17,7 +17,7 @@ package controllers import config.Constants.periodKeySessionKey -import connectors.CacheConnector +import connectors.UserAnswersConnector import controllers.actions._ import models.audit.{AuditContinueReturn, AuditObligationData, AuditReturnStarted} import models.{ObligationData, ReturnId, ReturnPeriod, UserAnswers} @@ -36,7 +36,7 @@ import javax.inject.Inject import scala.concurrent.{ExecutionContext, Future} class BeforeStartReturnController @Inject() ( - cacheConnector: CacheConnector, + userAnswersConnector: UserAnswersConnector, identify: IdentifyWithEnrolmentAction, getData: DataRetrievalAction, auditService: AuditService, @@ -61,19 +61,19 @@ class BeforeStartReturnController @Inject() ( val currentDate = LocalDate.now(clock) val viewModel = BeforeStartReturnViewModel(returnPeriod, currentDate) val session = request.session + (periodKeySessionKey, periodKey) - cacheConnector.get(request.appaId, periodKey).map { + userAnswersConnector.get(request.appaId, periodKey).map { case Right(ua) => - logger.info(s"Return $appaId/$periodKey retrieved from cache by the user") + logger.info(s"Return $appaId/$periodKey retrieved by the user") auditContinueReturn(ua, periodKey, appaId, credentialId, groupId) Redirect(controllers.routes.TaskListController.onPageLoad).withSession(session) case Left(error) if error.statusCode == NOT_FOUND => - logger.info(s"Return $appaId/$periodKey not found in cache") + logger.info(s"Return $appaId/$periodKey not found") Ok(view(ReturnPeriodViewModel(returnPeriod), viewModel)).withSession(session) case Left(error) if error.statusCode == LOCKED => logger.warn(s"Return ${request.appaId}/$periodKey locked for the user") Redirect(controllers.routes.ReturnLockedController.onPageLoad()) case _ => - logger.warn(s"Error retrieving the return $appaId/$periodKey from the cache for the user") + logger.warn(s"Error retrieving the return $appaId/$periodKey for the user") Redirect(controllers.routes.JourneyRecoveryController.onPageLoad()) } } @@ -87,7 +87,7 @@ class BeforeStartReturnController @Inject() ( case Some(periodKey) => val returnAndUserDetails = ReturnAndUserDetails(ReturnId(request.appaId, periodKey), request.groupId, request.userId) - cacheConnector.createUserAnswers(returnAndUserDetails).map { + userAnswersConnector.createUserAnswers(returnAndUserDetails).map { case Right(userAnswer) => logger.info(s"Return ${request.appaId}/$periodKey created") auditReturnStarted(userAnswer) diff --git a/app/controllers/BusinessTaxAccountRedirect.scala b/app/controllers/BusinessTaxAccountRedirect.scala index 88028527..b22e7f39 100644 --- a/app/controllers/BusinessTaxAccountRedirect.scala +++ b/app/controllers/BusinessTaxAccountRedirect.scala @@ -18,7 +18,7 @@ package controllers import config.Constants.periodKeySessionKey import config.FrontendAppConfig -import connectors.CacheConnector +import connectors.UserAnswersConnector import controllers.actions.IdentifyWithEnrolmentAction import models.ReturnId import play.api.Logging @@ -31,7 +31,7 @@ import scala.concurrent.{ExecutionContext, Future} class BusinessTaxAccountRedirect @Inject() ( config: FrontendAppConfig, identify: IdentifyWithEnrolmentAction, - cacheConnector: CacheConnector, + userAnswersConnector: UserAnswersConnector, val controllerComponents: MessagesControllerComponents )(implicit ec: ExecutionContext) extends FrontendBaseController @@ -40,7 +40,7 @@ class BusinessTaxAccountRedirect @Inject() ( def onPageLoad: Action[AnyContent] = identify.async { implicit request => request.session.get(periodKeySessionKey) match { case Some(periodKey) => - cacheConnector + userAnswersConnector .releaseLock(ReturnId(request.appaId, periodKey)) .map(_ => Redirect(config.businessTaxAccountUrl)) case None => diff --git a/app/controllers/KeepAliveController.scala b/app/controllers/KeepAliveController.scala index 46faa6a0..9b12820d 100644 --- a/app/controllers/KeepAliveController.scala +++ b/app/controllers/KeepAliveController.scala @@ -17,7 +17,7 @@ package controllers import config.Constants.periodKeySessionKey -import connectors.CacheConnector +import connectors.UserAnswersConnector import controllers.actions.IdentifyWithEnrolmentAction import models.ReturnId import play.api.mvc.{Action, AnyContent, MessagesControllerComponents} @@ -29,11 +29,11 @@ import scala.concurrent.ExecutionContext class KeepAliveController @Inject() ( val controllerComponents: MessagesControllerComponents, identify: IdentifyWithEnrolmentAction, - cacheConnector: CacheConnector + userAnswersConnector: UserAnswersConnector )(implicit ec: ExecutionContext) extends FrontendBaseController { def keepAlive: Action[AnyContent] = identify.async { implicit request => - cacheConnector.keepAlive(ReturnId(request.appaId, request.session(periodKeySessionKey))).map(_ => Ok) + userAnswersConnector.keepAlive(ReturnId(request.appaId, request.session(periodKeySessionKey))).map(_ => Ok) } } diff --git a/app/controllers/actions/DataRetrievalAction.scala b/app/controllers/actions/DataRetrievalAction.scala index b3bc05c6..a2c440cc 100644 --- a/app/controllers/actions/DataRetrievalAction.scala +++ b/app/controllers/actions/DataRetrievalAction.scala @@ -17,7 +17,7 @@ package controllers.actions import config.Constants.periodKeySessionKey -import connectors.CacheConnector +import connectors.UserAnswersConnector import controllers.routes import models.ReturnPeriod @@ -33,7 +33,7 @@ import uk.gov.hmrc.play.http.HeaderCarrierConverter import scala.concurrent.{ExecutionContext, Future} class DataRetrievalActionImpl @Inject() ( - val cacheConnector: CacheConnector + val userAnswersConnector: UserAnswersConnector )(implicit val executionContext: ExecutionContext) extends DataRetrievalAction with Logging { @@ -48,7 +48,7 @@ class DataRetrievalActionImpl @Inject() ( Right(OptionalDataRequest(request.request, request.appaId, request.groupId, request.userId, None, None)) ) case Some(periodKey) => - cacheConnector + userAnswersConnector .get(request.appaId, periodKey)(headerCarrier) .map { case Right(ua) => diff --git a/app/controllers/adjustment/AdjustmentDutyDueController.scala b/app/controllers/adjustment/AdjustmentDutyDueController.scala index a49562d2..283f6935 100644 --- a/app/controllers/adjustment/AdjustmentDutyDueController.scala +++ b/app/controllers/adjustment/AdjustmentDutyDueController.scala @@ -16,7 +16,7 @@ package controllers.adjustment -import connectors.CacheConnector +import connectors.UserAnswersConnector import controllers.actions._ import models.adjustment.AdjustmentEntry import pages.adjustment.CurrentAdjustmentEntryPage @@ -33,7 +33,7 @@ import scala.concurrent.{ExecutionContext, Future} class AdjustmentDutyDueController @Inject() ( override val messagesApi: MessagesApi, - cacheConnector: CacheConnector, + userAnswersConnector: UserAnswersConnector, identify: IdentifyWithEnrolmentAction, getData: DataRetrievalAction, requireData: DataRequiredAction, @@ -49,7 +49,7 @@ class AdjustmentDutyDueController @Inject() ( for { adjustment <- adjustmentEntryService.createAdjustment(request.userAnswers) userAnswers <- Future.fromTry(request.userAnswers.set(CurrentAdjustmentEntryPage, adjustment)) - _ <- cacheConnector.set(userAnswers) + _ <- userAnswersConnector.set(userAnswers) } yield getView(adjustment) } diff --git a/app/controllers/adjustment/AdjustmentListController.scala b/app/controllers/adjustment/AdjustmentListController.scala index 29d5db92..78cbb552 100644 --- a/app/controllers/adjustment/AdjustmentListController.scala +++ b/app/controllers/adjustment/AdjustmentListController.scala @@ -17,7 +17,7 @@ package controllers.adjustment import config.Constants.rowsPerPage -import connectors.{AlcoholDutyCalculatorConnector, CacheConnector} +import connectors.{AlcoholDutyCalculatorConnector, UserAnswersConnector} import controllers.actions.{DataRequiredAction, DataRetrievalAction, IdentifyWithEnrolmentAction} import forms.adjustment.AdjustmentListFormProvider import navigation.AdjustmentNavigator @@ -36,7 +36,7 @@ import scala.concurrent.{ExecutionContext, Future} class AdjustmentListController @Inject() ( override val messagesApi: MessagesApi, - cacheConnector: CacheConnector, + userAnswersConnector: UserAnswersConnector, navigator: AdjustmentNavigator, identify: IdentifyWithEnrolmentAction, getData: DataRetrievalAction, @@ -71,7 +71,7 @@ class AdjustmentListController @Inject() ( } else { for { updatedAnswers <- Future.fromTry(request.userAnswers.set(AdjustmentTotalPage, total.duty)) - _ <- cacheConnector.set(updatedAnswers) + _ <- userAnswersConnector.set(updatedAnswers) } yield Ok(view(preparedForm, paginatedViewModel.tableViewModel, paginatedViewModel.totalPages, pageNumber)) } } @@ -100,7 +100,7 @@ class AdjustmentListController @Inject() ( updatedAnswers <- Future.fromTry(request.userAnswers.set(AdjustmentListPage, value)) userAnswersWithOverUnderTotals <- adjustmentOverUnderDeclarationCalculationHelper.fetchOverUnderDeclarationTotals(updatedAnswers, value) - _ <- cacheConnector.set(userAnswersWithOverUnderTotals) + _ <- userAnswersConnector.set(userAnswersWithOverUnderTotals) } yield Redirect(navigator.nextPage(AdjustmentListPage, NormalMode, userAnswersWithOverUnderTotals)) ) } diff --git a/app/controllers/adjustment/AdjustmentRepackagedTaxTypeController.scala b/app/controllers/adjustment/AdjustmentRepackagedTaxTypeController.scala index 8fc99473..a7da88e7 100644 --- a/app/controllers/adjustment/AdjustmentRepackagedTaxTypeController.scala +++ b/app/controllers/adjustment/AdjustmentRepackagedTaxTypeController.scala @@ -25,7 +25,7 @@ import navigation.AdjustmentNavigator import pages.adjustment.{AdjustmentRepackagedTaxTypePage, CurrentAdjustmentEntryPage} import play.api.i18n.{I18nSupport, Messages, MessagesApi} import play.api.mvc.{Action, AnyContent, MessagesControllerComponents, Request, Result} -import connectors.{AlcoholDutyCalculatorConnector, CacheConnector} +import connectors.{AlcoholDutyCalculatorConnector, UserAnswersConnector} import models.RateType.{DraughtAndSmallProducerRelief, DraughtRelief} import models.adjustment.{AdjustmentEntry, AdjustmentType} import play.api.Logging @@ -39,7 +39,7 @@ import scala.concurrent.{ExecutionContext, Future} class AdjustmentRepackagedTaxTypeController @Inject() ( override val messagesApi: MessagesApi, - cacheConnector: CacheConnector, + userAnswersConnector: UserAnswersConnector, navigator: AdjustmentNavigator, identify: IdentifyWithEnrolmentAction, getData: DataRetrievalAction, @@ -112,7 +112,7 @@ class AdjustmentRepackagedTaxTypeController @Inject() ( updatedAdjustment.copy(repackagedRateBand = Some(repackagedRateBand)) ) ) - _ <- cacheConnector.set(updatedAnswers) + _ <- userAnswersConnector.set(updatedAnswers) } yield Redirect( navigator.nextPage(AdjustmentRepackagedTaxTypePage, mode, updatedAnswers, hasChanged) ) diff --git a/app/controllers/adjustment/AdjustmentSmallProducerReliefDutyRateController.scala b/app/controllers/adjustment/AdjustmentSmallProducerReliefDutyRateController.scala index f2716bf9..bab929ca 100644 --- a/app/controllers/adjustment/AdjustmentSmallProducerReliefDutyRateController.scala +++ b/app/controllers/adjustment/AdjustmentSmallProducerReliefDutyRateController.scala @@ -25,7 +25,7 @@ import navigation.AdjustmentNavigator import pages.adjustment.{AdjustmentSmallProducerReliefDutyRatePage, CurrentAdjustmentEntryPage} import play.api.i18n.{I18nSupport, MessagesApi} import play.api.mvc.{Action, AnyContent, MessagesControllerComponents} -import connectors.CacheConnector +import connectors.UserAnswersConnector import models.adjustment.AdjustmentEntry import play.api.Logging import uk.gov.hmrc.play.bootstrap.frontend.controller.FrontendBaseController @@ -35,7 +35,7 @@ import scala.concurrent.{ExecutionContext, Future} class AdjustmentSmallProducerReliefDutyRateController @Inject() ( override val messagesApi: MessagesApi, - cacheConnector: CacheConnector, + userAnswersConnector: UserAnswersConnector, navigator: AdjustmentNavigator, identify: IdentifyWithEnrolmentAction, getData: DataRetrievalAction, @@ -104,7 +104,7 @@ class AdjustmentSmallProducerReliefDutyRateController @Inject() ( request.userAnswers .set(CurrentAdjustmentEntryPage, updatedAdjustment.copy(repackagedSprDutyRate = Some(value))) ) - _ <- cacheConnector.set(updatedAnswers) + _ <- userAnswersConnector.set(updatedAnswers) } yield Redirect( navigator.nextPage(AdjustmentSmallProducerReliefDutyRatePage, mode, updatedAnswers, hasChanged) ) diff --git a/app/controllers/adjustment/AdjustmentTaxTypeController.scala b/app/controllers/adjustment/AdjustmentTaxTypeController.scala index 9c5c6373..5d81b122 100644 --- a/app/controllers/adjustment/AdjustmentTaxTypeController.scala +++ b/app/controllers/adjustment/AdjustmentTaxTypeController.scala @@ -25,7 +25,7 @@ import navigation.AdjustmentNavigator import pages.adjustment.{AdjustmentTaxTypePage, CurrentAdjustmentEntryPage} import play.api.i18n.{I18nSupport, MessagesApi} import play.api.mvc.{Action, AnyContent, MessagesControllerComponents, Request, Result} -import connectors.{AlcoholDutyCalculatorConnector, CacheConnector} +import connectors.{AlcoholDutyCalculatorConnector, UserAnswersConnector} import models.RateType.{DraughtAndSmallProducerRelief, DraughtRelief} import models.adjustment.{AdjustmentEntry, AdjustmentType} import models.adjustment.AdjustmentType.RepackagedDraughtProducts @@ -40,7 +40,7 @@ import scala.concurrent.{ExecutionContext, Future} class AdjustmentTaxTypeController @Inject() ( override val messagesApi: MessagesApi, - cacheConnector: CacheConnector, + userAnswersConnector: UserAnswersConnector, navigator: AdjustmentNavigator, identify: IdentifyWithEnrolmentAction, getData: DataRetrievalAction, @@ -105,7 +105,7 @@ class AdjustmentTaxTypeController @Inject() ( request.userAnswers .set(CurrentAdjustmentEntryPage, updatedAdjustment.copy(rateBand = Some(rateBand))) ) - _ <- cacheConnector.set(updatedAnswers) + _ <- userAnswersConnector.set(updatedAnswers) } yield Redirect(navigator.nextPage(AdjustmentTaxTypePage, mode, updatedAnswers, hasChanged)) } case None => diff --git a/app/controllers/adjustment/AdjustmentTypeController.scala b/app/controllers/adjustment/AdjustmentTypeController.scala index a3fea6a9..064c54ef 100644 --- a/app/controllers/adjustment/AdjustmentTypeController.scala +++ b/app/controllers/adjustment/AdjustmentTypeController.scala @@ -25,7 +25,7 @@ import navigation.AdjustmentNavigator import pages.adjustment.{AdjustmentTypePage, CurrentAdjustmentEntryPage} import play.api.i18n.{I18nSupport, Messages, MessagesApi} import play.api.mvc.{Action, AnyContent, MessagesControllerComponents} -import connectors.CacheConnector +import connectors.UserAnswersConnector import models.adjustment.{AdjustmentEntry, AdjustmentType} import uk.gov.hmrc.play.bootstrap.frontend.controller.FrontendBaseController import viewmodels.checkAnswers.adjustment.AlcoholicProductTypeHelper @@ -37,7 +37,7 @@ import scala.util.Try class AdjustmentTypeController @Inject() ( override val messagesApi: MessagesApi, - cacheConnector: CacheConnector, + userAnswersConnector: UserAnswersConnector, navigator: AdjustmentNavigator, identify: IdentifyWithEnrolmentAction, getData: DataRetrievalAction, @@ -78,7 +78,7 @@ class AdjustmentTypeController @Inject() ( .set(CurrentAdjustmentEntryPage, updatedAdjustment.copy(adjustmentType = Some(value))) ) singleRegimeUpdatedUserAnswer <- Future.fromTry(checkIfOneRegimeAndUpdateUserAnswers(updatedAnswers)) - _ <- cacheConnector.set(singleRegimeUpdatedUserAnswer) + _ <- userAnswersConnector.set(singleRegimeUpdatedUserAnswer) } yield Redirect(navigator.nextPage(AdjustmentTypePage, mode, singleRegimeUpdatedUserAnswer, hasChanged)) } ) diff --git a/app/controllers/adjustment/AdjustmentVolumeController.scala b/app/controllers/adjustment/AdjustmentVolumeController.scala index 5315445b..2878b7e5 100644 --- a/app/controllers/adjustment/AdjustmentVolumeController.scala +++ b/app/controllers/adjustment/AdjustmentVolumeController.scala @@ -16,7 +16,7 @@ package controllers.adjustment -import connectors.CacheConnector +import connectors.UserAnswersConnector import controllers.actions._ import forms.adjustment.AdjustmentVolumeFormProvider @@ -38,7 +38,7 @@ import scala.concurrent.{ExecutionContext, Future} class AdjustmentVolumeController @Inject() ( override val messagesApi: MessagesApi, - cacheConnector: CacheConnector, + userAnswersConnector: UserAnswersConnector, navigator: AdjustmentNavigator, identify: IdentifyWithEnrolmentAction, getData: DataRetrievalAction, @@ -134,7 +134,7 @@ class AdjustmentVolumeController @Inject() ( ) ) ) - _ <- cacheConnector.set(updatedAnswers) + _ <- userAnswersConnector.set(updatedAnswers) } yield Redirect(navigator.nextPage(AdjustmentVolumePage, mode, updatedAnswers, hasChanged)) } ) diff --git a/app/controllers/adjustment/AdjustmentVolumeWithSPRController.scala b/app/controllers/adjustment/AdjustmentVolumeWithSPRController.scala index 3219b62d..113ebb21 100644 --- a/app/controllers/adjustment/AdjustmentVolumeWithSPRController.scala +++ b/app/controllers/adjustment/AdjustmentVolumeWithSPRController.scala @@ -25,7 +25,7 @@ import navigation.AdjustmentNavigator import pages.adjustment.{AdjustmentVolumeWithSPRPage, CurrentAdjustmentEntryPage} import play.api.i18n.{I18nSupport, MessagesApi} import play.api.mvc.{Action, AnyContent, MessagesControllerComponents, Result} -import connectors.CacheConnector +import connectors.UserAnswersConnector import models.adjustment.{AdjustmentEntry, AdjustmentVolumeWithSPR} import models.requests.DataRequest import play.api.Logging @@ -38,7 +38,7 @@ import scala.concurrent.{ExecutionContext, Future} class AdjustmentVolumeWithSPRController @Inject() ( override val messagesApi: MessagesApi, - cacheConnector: CacheConnector, + userAnswersConnector: UserAnswersConnector, navigator: AdjustmentNavigator, identify: IdentifyWithEnrolmentAction, getData: DataRetrievalAction, @@ -136,7 +136,7 @@ class AdjustmentVolumeWithSPRController @Inject() ( ) ) ) - _ <- cacheConnector.set(updatedAnswers) + _ <- userAnswersConnector.set(updatedAnswers) } yield Redirect(navigator.nextPage(AdjustmentVolumeWithSPRPage, mode, updatedAnswers, hasChanged)) } ) diff --git a/app/controllers/adjustment/AlcoholicProductTypeController.scala b/app/controllers/adjustment/AlcoholicProductTypeController.scala index b2eabb3f..0e234a32 100644 --- a/app/controllers/adjustment/AlcoholicProductTypeController.scala +++ b/app/controllers/adjustment/AlcoholicProductTypeController.scala @@ -25,7 +25,7 @@ import navigation.AdjustmentNavigator import pages.adjustment.{AlcoholicProductTypePage, CurrentAdjustmentEntryPage} import play.api.i18n.{I18nSupport, MessagesApi} import play.api.mvc.{Action, AnyContent, MessagesControllerComponents} -import connectors.CacheConnector +import connectors.UserAnswersConnector import models.adjustment.AdjustmentEntry import play.api.Logging import uk.gov.hmrc.play.bootstrap.frontend.controller.FrontendBaseController @@ -37,7 +37,7 @@ import scala.concurrent.{ExecutionContext, Future} class AlcoholicProductTypeController @Inject() ( override val messagesApi: MessagesApi, - cacheConnector: CacheConnector, + userAnswersConnector: UserAnswersConnector, navigator: AdjustmentNavigator, identify: IdentifyWithEnrolmentAction, getData: DataRetrievalAction, @@ -86,7 +86,7 @@ class AlcoholicProductTypeController @Inject() ( ) ) ) - _ <- cacheConnector.set(updatedAnswers) + _ <- userAnswersConnector.set(updatedAnswers) } yield Redirect(navigator.nextPage(AlcoholicProductTypePage, mode, updatedAnswers, hasChanged)) case _ => logger.warn("Couldn't retrieve regime") diff --git a/app/controllers/adjustment/CheckYourAnswersController.scala b/app/controllers/adjustment/CheckYourAnswersController.scala index 7c22fa65..945b7de7 100644 --- a/app/controllers/adjustment/CheckYourAnswersController.scala +++ b/app/controllers/adjustment/CheckYourAnswersController.scala @@ -16,7 +16,7 @@ package controllers.adjustment -import connectors.CacheConnector +import connectors.UserAnswersConnector import controllers.actions._ import models.UserAnswers import models.adjustment.AdjustmentEntry @@ -35,7 +35,7 @@ import scala.concurrent.{ExecutionContext, Future} class CheckYourAnswersController @Inject() ( override val messagesApi: MessagesApi, - cacheConnector: CacheConnector, + userAnswersConnector: UserAnswersConnector, identify: IdentifyWithEnrolmentAction, getData: DataRetrievalAction, requireData: DataRequiredAction, @@ -65,7 +65,7 @@ class CheckYourAnswersController @Inject() ( for { updatedAnswers <- saveAdjustmentEntry(request.userAnswers, adjustmentEntry) cleanedAnswers <- Future.fromTry(updatedAnswers.remove(CurrentAdjustmentEntryPage)) - _ <- cacheConnector.set(cleanedAnswers) + _ <- userAnswersConnector.set(cleanedAnswers) } yield Redirect( controllers.adjustment.routes.AdjustmentListController.onPageLoad(1) ) @@ -104,7 +104,7 @@ class CheckYourAnswersController @Inject() ( ): Future[Result] = for { updateUserAnswers <- Future.fromTry(userAnswers.set(CurrentAdjustmentEntryPage, adjustmentEntry)) - _ <- cacheConnector.set(updateUserAnswers) + _ <- userAnswersConnector.set(updateUserAnswers) } yield Ok( view( summaryList diff --git a/app/controllers/adjustment/DeclareAdjustmentQuestionController.scala b/app/controllers/adjustment/DeclareAdjustmentQuestionController.scala index 3fba1783..38afffb9 100644 --- a/app/controllers/adjustment/DeclareAdjustmentQuestionController.scala +++ b/app/controllers/adjustment/DeclareAdjustmentQuestionController.scala @@ -25,7 +25,7 @@ import navigation.AdjustmentNavigator import pages.adjustment.{AdjustmentEntryListPage, AdjustmentListPage, AdjustmentTotalPage, CurrentAdjustmentEntryPage, DeclareAdjustmentQuestionPage} import play.api.i18n.{I18nSupport, MessagesApi} import play.api.mvc.{Action, AnyContent, MessagesControllerComponents} -import connectors.CacheConnector +import connectors.UserAnswersConnector import uk.gov.hmrc.play.bootstrap.frontend.controller.FrontendBaseController import views.html.adjustment.DeclareAdjustmentQuestionView @@ -34,7 +34,7 @@ import scala.util.Try class DeclareAdjustmentQuestionController @Inject() ( override val messagesApi: MessagesApi, - cacheConnector: CacheConnector, + userAnswersConnector: UserAnswersConnector, navigator: AdjustmentNavigator, identify: IdentifyWithEnrolmentAction, getData: DataRetrievalAction, @@ -67,7 +67,7 @@ class DeclareAdjustmentQuestionController @Inject() ( for { updatedAnswers <- Future.fromTry(request.userAnswers.set(DeclareAdjustmentQuestionPage, value)) filterUserAnswer <- Future.fromTry(filterAdjustmentQuestionAnswer(updatedAnswers, value)) - _ <- cacheConnector.set(filterUserAnswer) + _ <- userAnswersConnector.set(filterUserAnswer) } yield Redirect(navigator.nextPage(DeclareAdjustmentQuestionPage, mode, filterUserAnswer)) ) } diff --git a/app/controllers/adjustment/DeleteAdjustmentController.scala b/app/controllers/adjustment/DeleteAdjustmentController.scala index cc83d788..e12b288e 100644 --- a/app/controllers/adjustment/DeleteAdjustmentController.scala +++ b/app/controllers/adjustment/DeleteAdjustmentController.scala @@ -16,7 +16,7 @@ package controllers.adjustment -import connectors.CacheConnector +import connectors.UserAnswersConnector import controllers.actions.{DataRequiredAction, DataRetrievalAction, IdentifyWithEnrolmentAction} import forms.adjustment.DeleteAdjustmentFormProvider import pages.adjustment.{AdjustmentEntryListPage, DeleteAdjustmentPage} @@ -31,7 +31,7 @@ import scala.concurrent.{ExecutionContext, Future} class DeleteAdjustmentController @Inject() ( override val messagesApi: MessagesApi, - cacheConnector: CacheConnector, + userAnswersConnector: UserAnswersConnector, identify: IdentifyWithEnrolmentAction, getData: DataRetrievalAction, requireData: DataRequiredAction, @@ -62,7 +62,7 @@ class DeleteAdjustmentController @Inject() ( updatedAnswers <- Future.fromTry(request.userAnswers.removeBySeqIndex(AdjustmentEntryListPage, index)) userAnswersWithUpdatedOverUnderReason <- adjustmentOverUnderDeclarationCalculationHelper.fetchOverUnderDeclarationTotals(updatedAnswers) - _ <- cacheConnector.set(userAnswersWithUpdatedOverUnderReason) + _ <- userAnswersConnector.set(userAnswersWithUpdatedOverUnderReason) } yield Redirect(controllers.adjustment.routes.AdjustmentListController.onPageLoad(1)) } else { Future.successful(Redirect(controllers.adjustment.routes.AdjustmentListController.onPageLoad(1))) diff --git a/app/controllers/adjustment/OverDeclarationReasonController.scala b/app/controllers/adjustment/OverDeclarationReasonController.scala index 6089011d..1c9dd82c 100644 --- a/app/controllers/adjustment/OverDeclarationReasonController.scala +++ b/app/controllers/adjustment/OverDeclarationReasonController.scala @@ -24,7 +24,7 @@ import navigation.AdjustmentNavigator import pages.adjustment.OverDeclarationReasonPage import play.api.i18n.{I18nSupport, MessagesApi} import play.api.mvc.{Action, AnyContent, MessagesControllerComponents} -import connectors.CacheConnector +import connectors.UserAnswersConnector import uk.gov.hmrc.play.bootstrap.frontend.controller.FrontendBaseController import views.html.adjustment.OverDeclarationReasonView @@ -32,7 +32,7 @@ import scala.concurrent.{ExecutionContext, Future} class OverDeclarationReasonController @Inject() ( override val messagesApi: MessagesApi, - cacheConnector: CacheConnector, + userAnswersConnector: UserAnswersConnector, navigator: AdjustmentNavigator, identify: IdentifyWithEnrolmentAction, getData: DataRetrievalAction, @@ -64,7 +64,7 @@ class OverDeclarationReasonController @Inject() ( value => for { updatedAnswers <- Future.fromTry(request.userAnswers.set(OverDeclarationReasonPage, value)) - _ <- cacheConnector.set(updatedAnswers) + _ <- userAnswersConnector.set(updatedAnswers) } yield Redirect(navigator.nextPage(OverDeclarationReasonPage, mode, updatedAnswers)) ) } diff --git a/app/controllers/adjustment/SpoiltVolumeWithDutyController.scala b/app/controllers/adjustment/SpoiltVolumeWithDutyController.scala index ca17049e..6485f579 100644 --- a/app/controllers/adjustment/SpoiltVolumeWithDutyController.scala +++ b/app/controllers/adjustment/SpoiltVolumeWithDutyController.scala @@ -16,7 +16,7 @@ package controllers.adjustment -import connectors.CacheConnector +import connectors.UserAnswersConnector import controllers.actions._ import forms.adjustment.SpoiltVolumeWithDutyFormProvider import models.adjustment.{AdjustmentEntry, SpoiltVolumeWithDuty} @@ -35,7 +35,7 @@ import scala.concurrent.{ExecutionContext, Future} class SpoiltVolumeWithDutyController @Inject() ( override val messagesApi: MessagesApi, - cacheConnector: CacheConnector, + userAnswersConnector: UserAnswersConnector, navigator: AdjustmentNavigator, identify: IdentifyWithEnrolmentAction, getData: DataRetrievalAction, @@ -126,7 +126,7 @@ class SpoiltVolumeWithDutyController @Inject() ( ) ) ) - _ <- cacheConnector.set(updatedAnswers) + _ <- userAnswersConnector.set(updatedAnswers) } yield Redirect(navigator.nextPage(SpoiltVolumeWithDutyPage, mode, updatedAnswers)) } ) diff --git a/app/controllers/adjustment/UnderDeclarationReasonController.scala b/app/controllers/adjustment/UnderDeclarationReasonController.scala index ff8b9f10..06d15778 100644 --- a/app/controllers/adjustment/UnderDeclarationReasonController.scala +++ b/app/controllers/adjustment/UnderDeclarationReasonController.scala @@ -24,7 +24,7 @@ import navigation.AdjustmentNavigator import pages.adjustment.UnderDeclarationReasonPage import play.api.i18n.{I18nSupport, MessagesApi} import play.api.mvc.{Action, AnyContent, MessagesControllerComponents} -import connectors.CacheConnector +import connectors.UserAnswersConnector import uk.gov.hmrc.play.bootstrap.frontend.controller.FrontendBaseController import views.html.adjustment.UnderDeclarationReasonView @@ -32,7 +32,7 @@ import scala.concurrent.{ExecutionContext, Future} class UnderDeclarationReasonController @Inject() ( override val messagesApi: MessagesApi, - cacheConnector: CacheConnector, + userAnswersConnector: UserAnswersConnector, navigator: AdjustmentNavigator, identify: IdentifyWithEnrolmentAction, getData: DataRetrievalAction, @@ -64,7 +64,7 @@ class UnderDeclarationReasonController @Inject() ( value => for { updatedAnswers <- Future.fromTry(request.userAnswers.set(UnderDeclarationReasonPage, value)) - _ <- cacheConnector.set(updatedAnswers) + _ <- userAnswersConnector.set(updatedAnswers) } yield Redirect(navigator.nextPage(UnderDeclarationReasonPage, mode, updatedAnswers)) ) } diff --git a/app/controllers/adjustment/WhenDidYouPayDutyController.scala b/app/controllers/adjustment/WhenDidYouPayDutyController.scala index b51365fc..04cca547 100644 --- a/app/controllers/adjustment/WhenDidYouPayDutyController.scala +++ b/app/controllers/adjustment/WhenDidYouPayDutyController.scala @@ -25,7 +25,7 @@ import navigation.AdjustmentNavigator import pages.adjustment.{CurrentAdjustmentEntryPage, WhenDidYouPayDutyPage} import play.api.i18n.{I18nSupport, MessagesApi} import play.api.mvc.{Action, AnyContent, MessagesControllerComponents} -import connectors.CacheConnector +import connectors.UserAnswersConnector import models.adjustment.AdjustmentEntry import play.api.Logging import uk.gov.hmrc.play.bootstrap.frontend.controller.FrontendBaseController @@ -36,7 +36,7 @@ import scala.concurrent.{ExecutionContext, Future} class WhenDidYouPayDutyController @Inject() ( override val messagesApi: MessagesApi, - cacheConnector: CacheConnector, + userAnswersConnector: UserAnswersConnector, navigator: AdjustmentNavigator, identify: IdentifyWithEnrolmentAction, getData: DataRetrievalAction, @@ -107,7 +107,7 @@ class WhenDidYouPayDutyController @Inject() ( request.userAnswers .set(CurrentAdjustmentEntryPage, updatedAdjustment.copy(period = Some(value))) ) - _ <- cacheConnector.set(updatedAnswers) + _ <- userAnswersConnector.set(updatedAnswers) } yield Redirect(navigator.nextPage(WhenDidYouPayDutyPage, mode, updatedAnswers, hasChanged)) } ) diff --git a/app/controllers/auth/AuthController.scala b/app/controllers/auth/AuthController.scala index 5a9922b8..b2a6ea99 100644 --- a/app/controllers/auth/AuthController.scala +++ b/app/controllers/auth/AuthController.scala @@ -18,7 +18,7 @@ package controllers.auth import config.Constants.periodKeySessionKey import config.FrontendAppConfig -import connectors.CacheConnector +import connectors.UserAnswersConnector import controllers.actions.IdentifyWithEnrolmentAction import models.ReturnId import play.api.Logging @@ -32,7 +32,7 @@ import scala.concurrent.{ExecutionContext, Future} class AuthController @Inject() ( val controllerComponents: MessagesControllerComponents, config: FrontendAppConfig, - cacheConnector: CacheConnector, + userAnswersConnector: UserAnswersConnector, identify: IdentifyWithEnrolmentAction )(implicit ec: ExecutionContext) extends FrontendBaseController @@ -42,7 +42,7 @@ class AuthController @Inject() ( def signOut(): Action[AnyContent] = identify.async { implicit request => request.session.get(periodKeySessionKey) match { case Some(periodKey) => - cacheConnector + userAnswersConnector .releaseLock(ReturnId(request.appaId, periodKey)) .map(_ => Redirect(config.signOutUrl, Map("continue" -> Seq(config.exitSurveyUrl)))) case None => diff --git a/app/controllers/declareDuty/AlcoholTypeController.scala b/app/controllers/declareDuty/AlcoholTypeController.scala index d136657a..5186b515 100644 --- a/app/controllers/declareDuty/AlcoholTypeController.scala +++ b/app/controllers/declareDuty/AlcoholTypeController.scala @@ -25,7 +25,7 @@ import navigation.ReturnsNavigator import pages.declareDuty.{AlcoholTypePage, nextPages} import play.api.i18n.{I18nSupport, MessagesApi} import play.api.mvc.{Action, AnyContent, MessagesControllerComponents} -import connectors.CacheConnector +import connectors.UserAnswersConnector import uk.gov.hmrc.play.bootstrap.frontend.controller.FrontendBaseController import views.html.declareDuty.AlcoholTypeView @@ -34,7 +34,7 @@ import scala.util.Try class AlcoholTypeController @Inject() ( override val messagesApi: MessagesApi, - cacheConnector: CacheConnector, + userAnswersConnector: UserAnswersConnector, navigator: ReturnsNavigator, identify: IdentifyWithEnrolmentAction, getData: DataRetrievalAction, @@ -69,7 +69,7 @@ class AlcoholTypeController @Inject() ( for { updatedAnswers <- Future.fromTry(request.userAnswers.set(AlcoholTypePage, alcoholRegimes)) userAnswersWithUpdatedRegimes <- Future.fromTry(clearUserAnswers(updatedAnswers, regimesToRemove)) - _ <- cacheConnector.set(userAnswersWithUpdatedRegimes) + _ <- userAnswersConnector.set(userAnswersWithUpdatedRegimes) } yield Redirect(navigator.nextPage(AlcoholTypePage, mode, userAnswersWithUpdatedRegimes)) } ) diff --git a/app/controllers/declareDuty/CheckYourAnswersSPRController.scala b/app/controllers/declareDuty/CheckYourAnswersSPRController.scala index 9a7b09ea..0e78362c 100644 --- a/app/controllers/declareDuty/CheckYourAnswersSPRController.scala +++ b/app/controllers/declareDuty/CheckYourAnswersSPRController.scala @@ -16,7 +16,7 @@ package controllers.declareDuty -import connectors.CacheConnector +import connectors.UserAnswersConnector import controllers.actions._ import models.declareDuty.VolumeAndRateByTaxType import models.{AlcoholRegime, UserAnswers} @@ -35,7 +35,7 @@ import scala.util.Try class CheckYourAnswersSPRController @Inject() ( override val messagesApi: MessagesApi, - cacheConnector: CacheConnector, + userAnswersConnector: UserAnswersConnector, identify: IdentifyWithEnrolmentAction, getData: DataRetrievalAction, requireData: DataRequiredAction, @@ -67,7 +67,7 @@ class CheckYourAnswersSPRController @Inject() ( for { updatedUserAnswers <- Future.fromTry(updateUserAnswer(request.userAnswers, regime, sprRateEntry, index)) cleanedUserAnswers <- Future.fromTry(updatedUserAnswers.removeByKey(TellUsAboutMultipleSPRRatePage, regime)) - _ <- cacheConnector.set(cleanedUserAnswers) + _ <- userAnswersConnector.set(cleanedUserAnswers) } yield Redirect(controllers.declareDuty.routes.MultipleSPRListController.onPageLoad(regime)) } } diff --git a/app/controllers/declareDuty/DeclareAlcoholDutyQuestionController.scala b/app/controllers/declareDuty/DeclareAlcoholDutyQuestionController.scala index f2ce83f0..afb6feed 100644 --- a/app/controllers/declareDuty/DeclareAlcoholDutyQuestionController.scala +++ b/app/controllers/declareDuty/DeclareAlcoholDutyQuestionController.scala @@ -16,7 +16,7 @@ package controllers.declareDuty -import connectors.CacheConnector +import connectors.UserAnswersConnector import controllers.actions._ import forms.declareDuty.DeclareAlcoholDutyQuestionFormProvider import models.AlcoholRegime.{Beer, Cider, OtherFermentedProduct, Spirits, Wine} @@ -34,7 +34,7 @@ import scala.util.Try class DeclareAlcoholDutyQuestionController @Inject() ( override val messagesApi: MessagesApi, - cacheConnector: CacheConnector, + userAnswersConnector: UserAnswersConnector, navigator: ReturnsNavigator, identify: IdentifyWithEnrolmentAction, getData: DataRetrievalAction, @@ -72,7 +72,7 @@ class DeclareAlcoholDutyQuestionController @Inject() ( updatedAnswers <- Future.fromTry(request.userAnswers.set(DeclareAlcoholDutyQuestionPage, value)) singleRegimeUpdatedUserAnswer <- Future.fromTry(checkIfOneRegimeAndUpdateUserAnswer(updatedAnswers)) filterUserAnswer <- Future.fromTry(filterAlcoholDutyQuestionAnswer(singleRegimeUpdatedUserAnswer, value)) - _ <- cacheConnector.set(filterUserAnswer) + _ <- userAnswersConnector.set(filterUserAnswer) } yield Redirect(navigator.nextPage(DeclareAlcoholDutyQuestionPage, mode, filterUserAnswer)) ) } diff --git a/app/controllers/declareDuty/DeleteMultipleSPREntryController.scala b/app/controllers/declareDuty/DeleteMultipleSPREntryController.scala index ab474bab..a01a70dd 100644 --- a/app/controllers/declareDuty/DeleteMultipleSPREntryController.scala +++ b/app/controllers/declareDuty/DeleteMultipleSPREntryController.scala @@ -24,7 +24,7 @@ import models.{AlcoholRegime, NormalMode} import pages.declareDuty.{DeleteMultipleSPREntryPage, MultipleSPRListPage} import play.api.i18n.{I18nSupport, MessagesApi} import play.api.mvc.{Action, AnyContent, MessagesControllerComponents} -import connectors.CacheConnector +import connectors.UserAnswersConnector import navigation.ReturnsNavigator import play.api.Logging import uk.gov.hmrc.play.bootstrap.frontend.controller.FrontendBaseController @@ -34,7 +34,7 @@ import scala.concurrent.{ExecutionContext, Future} class DeleteMultipleSPREntryController @Inject() ( override val messagesApi: MessagesApi, - cacheConnector: CacheConnector, + userAnswersConnector: UserAnswersConnector, identify: IdentifyWithEnrolmentAction, getData: DataRetrievalAction, navigator: ReturnsNavigator, @@ -75,7 +75,7 @@ class DeleteMultipleSPREntryController @Inject() ( for { updatedAnswers <- Future.fromTry(request.userAnswers.removeByKeyAndIndex(MultipleSPRListPage, regime, index)) - _ <- cacheConnector.set(updatedAnswers) + _ <- userAnswersConnector.set(updatedAnswers) } yield Redirect( navigator.nextPageWithRegime(DeleteMultipleSPREntryPage, NormalMode, updatedAnswers, regime) ) diff --git a/app/controllers/declareDuty/DoYouHaveMultipleSPRDutyRatesController.scala b/app/controllers/declareDuty/DoYouHaveMultipleSPRDutyRatesController.scala index 71b99ee1..3fc045e2 100644 --- a/app/controllers/declareDuty/DoYouHaveMultipleSPRDutyRatesController.scala +++ b/app/controllers/declareDuty/DoYouHaveMultipleSPRDutyRatesController.scala @@ -25,7 +25,7 @@ import navigation.ReturnsNavigator import pages.declareDuty.{DoYouHaveMultipleSPRDutyRatesPage, nextPages} import play.api.i18n.{I18nSupport, MessagesApi} import play.api.mvc.{Action, AnyContent, MessagesControllerComponents} -import connectors.CacheConnector +import connectors.UserAnswersConnector import uk.gov.hmrc.play.bootstrap.frontend.controller.FrontendBaseController import views.html.declareDuty.DoYouHaveMultipleSPRDutyRatesView @@ -33,7 +33,7 @@ import scala.concurrent.{ExecutionContext, Future} class DoYouHaveMultipleSPRDutyRatesController @Inject() ( override val messagesApi: MessagesApi, - cacheConnector: CacheConnector, + userAnswersConnector: UserAnswersConnector, navigator: ReturnsNavigator, identify: IdentifyWithEnrolmentAction, getData: DataRetrievalAction, @@ -72,7 +72,7 @@ class DoYouHaveMultipleSPRDutyRatesController @Inject() ( updatedAnswers <- Future.fromTry(request.userAnswers.setByKey(currentPage, regime, value)) clearedUserAnswers <- Future.fromTry(updatedAnswers.removePagesByKey(pagesToClear, regime)) - _ <- cacheConnector.set(clearedUserAnswers) + _ <- userAnswersConnector.set(clearedUserAnswers) } yield Redirect( navigator.nextPageWithRegime(currentPage, mode, updatedAnswers, regime, pagesToClear.nonEmpty) ) diff --git a/app/controllers/declareDuty/DutyCalculationController.scala b/app/controllers/declareDuty/DutyCalculationController.scala index 19f885ad..d511b117 100644 --- a/app/controllers/declareDuty/DutyCalculationController.scala +++ b/app/controllers/declareDuty/DutyCalculationController.scala @@ -16,7 +16,7 @@ package controllers.declareDuty -import connectors.{AlcoholDutyCalculatorConnector, CacheConnector} +import connectors.{AlcoholDutyCalculatorConnector, UserAnswersConnector} import controllers.actions._ import models.declareDuty.VolumeAndRateByTaxType import models.{AlcoholRegime, TotalDutyCalculationRequest, UserAnswers} @@ -38,7 +38,7 @@ class DutyCalculationController @Inject() ( identify: IdentifyWithEnrolmentAction, getData: DataRetrievalAction, requireData: DataRequiredAction, - cacheConnector: CacheConnector, + userAnswersConnector: UserAnswersConnector, calculatorConnector: AlcoholDutyCalculatorConnector, val controllerComponents: MessagesControllerComponents, view: DutyCalculationView @@ -53,7 +53,7 @@ class DutyCalculationController @Inject() ( for { totalDuty <- calculatorConnector.calculateTotalDuty(totalDutyCalculatorRequest) updatedUserAnswers <- Future.fromTry(request.userAnswers.setByKey(DutyCalculationPage, regime, totalDuty)) - _ <- cacheConnector.set(updatedUserAnswers) + _ <- userAnswersConnector.set(updatedUserAnswers) } yield DutyCalculationHelper.dutyDueTableViewModel(totalDuty, request.userAnswers, regime) match { case Left(errorMessage) => logger.warn(s"Failed to create duty due table view model: $errorMessage") @@ -71,7 +71,7 @@ class DutyCalculationController @Inject() ( case Some(totalDuty) => for { updatedUserAnswers <- Future.fromTry(request.userAnswers.setByKey(AlcoholDutyPage, regime, totalDuty)) - _ <- cacheConnector.set(updatedUserAnswers) + _ <- userAnswersConnector.set(updatedUserAnswers) } yield Redirect(controllers.routes.TaskListController.onPageLoad) } } diff --git a/app/controllers/declareDuty/HowMuchDoYouNeedToDeclareController.scala b/app/controllers/declareDuty/HowMuchDoYouNeedToDeclareController.scala index 992917f8..52092d2f 100644 --- a/app/controllers/declareDuty/HowMuchDoYouNeedToDeclareController.scala +++ b/app/controllers/declareDuty/HowMuchDoYouNeedToDeclareController.scala @@ -25,7 +25,7 @@ import navigation.ReturnsNavigator import pages.declareDuty.{HowMuchDoYouNeedToDeclarePage, WhatDoYouNeedToDeclarePage} import play.api.i18n.{I18nSupport, MessagesApi} import play.api.mvc.{Action, AnyContent, MessagesControllerComponents} -import connectors.CacheConnector +import connectors.UserAnswersConnector import models.declareDuty.{VolumeAndRateByTaxType, VolumesByTaxType} import play.api.Logging import uk.gov.hmrc.play.bootstrap.frontend.controller.FrontendBaseController @@ -37,7 +37,7 @@ import scala.util.{Failure, Success, Try} class HowMuchDoYouNeedToDeclareController @Inject() ( override val messagesApi: MessagesApi, - cacheConnector: CacheConnector, + userAnswersConnector: UserAnswersConnector, navigator: ReturnsNavigator, identify: IdentifyWithEnrolmentAction, getData: DataRetrievalAction, @@ -93,7 +93,7 @@ class HowMuchDoYouNeedToDeclareController @Inject() ( request.userAnswers.setByKey(HowMuchDoYouNeedToDeclarePage, regime, volumesAndRateByTaxTypes) ) hasChanged = hasValueChanged(volumesAndRateByTaxTypes, regime) - _ <- cacheConnector.set(updatedAnswers) + _ <- userAnswersConnector.set(updatedAnswers) } yield Redirect( navigator.nextPageWithRegime( HowMuchDoYouNeedToDeclarePage, diff --git a/app/controllers/declareDuty/MultipleSPRListController.scala b/app/controllers/declareDuty/MultipleSPRListController.scala index e4ab8681..cd31b8a2 100644 --- a/app/controllers/declareDuty/MultipleSPRListController.scala +++ b/app/controllers/declareDuty/MultipleSPRListController.scala @@ -25,7 +25,7 @@ import navigation.ReturnsNavigator import pages.declareDuty.DoYouWantToAddMultipleSPRToListPage import play.api.i18n.{I18nSupport, MessagesApi} import play.api.mvc.{Action, AnyContent, MessagesControllerComponents} -import connectors.CacheConnector +import connectors.UserAnswersConnector import play.api.Logging import uk.gov.hmrc.play.bootstrap.frontend.controller.FrontendBaseController import viewmodels.declareDuty.MultipleSPRListHelper @@ -35,7 +35,7 @@ import scala.concurrent.{ExecutionContext, Future} class MultipleSPRListController @Inject() ( override val messagesApi: MessagesApi, - cacheConnector: CacheConnector, + userAnswersConnector: UserAnswersConnector, navigator: ReturnsNavigator, identify: IdentifyWithEnrolmentAction, getData: DataRetrievalAction, @@ -87,7 +87,7 @@ class MultipleSPRListController @Inject() ( for { updatedAnswers <- Future.fromTry(request.userAnswers.setByKey(DoYouWantToAddMultipleSPRToListPage, regime, value)) - _ <- cacheConnector.set(updatedAnswers) + _ <- userAnswersConnector.set(updatedAnswers) } yield Redirect( navigator.nextPageWithRegime(DoYouWantToAddMultipleSPRToListPage, NormalMode, updatedAnswers, regime) ) diff --git a/app/controllers/declareDuty/TellUsAboutMultipleSPRRateController.scala b/app/controllers/declareDuty/TellUsAboutMultipleSPRRateController.scala index 41e369c0..79f40a9e 100644 --- a/app/controllers/declareDuty/TellUsAboutMultipleSPRRateController.scala +++ b/app/controllers/declareDuty/TellUsAboutMultipleSPRRateController.scala @@ -25,7 +25,7 @@ import navigation.ReturnsNavigator import pages.declareDuty.{MultipleSPRListPage, TellUsAboutMultipleSPRRatePage, WhatDoYouNeedToDeclarePage} import play.api.i18n.{I18nSupport, Messages, MessagesApi} import play.api.mvc.{Action, AnyContent, MessagesControllerComponents} -import connectors.CacheConnector +import connectors.UserAnswersConnector import models.declareDuty.VolumeAndRateByTaxType import play.api.Logging import play.api.data.Form @@ -37,7 +37,7 @@ import scala.concurrent.{ExecutionContext, Future} class TellUsAboutMultipleSPRRateController @Inject() ( override val messagesApi: MessagesApi, - cacheConnector: CacheConnector, + userAnswersConnector: UserAnswersConnector, navigator: ReturnsNavigator, identify: IdentifyWithEnrolmentAction, getData: DataRetrievalAction, @@ -90,7 +90,7 @@ class TellUsAboutMultipleSPRRateController @Inject() ( for { updatedAnswers <- Future.fromTry(request.userAnswers.setByKey(TellUsAboutMultipleSPRRatePage, regime, value)) - _ <- cacheConnector.set(updatedAnswers) + _ <- userAnswersConnector.set(updatedAnswers) } yield Redirect( navigator .nextPageWithRegime(TellUsAboutMultipleSPRRatePage, mode, updatedAnswers, regime, hasChanged, index) diff --git a/app/controllers/declareDuty/TellUsAboutSingleSPRRateController.scala b/app/controllers/declareDuty/TellUsAboutSingleSPRRateController.scala index 4ff2b6b4..eb22fbc1 100644 --- a/app/controllers/declareDuty/TellUsAboutSingleSPRRateController.scala +++ b/app/controllers/declareDuty/TellUsAboutSingleSPRRateController.scala @@ -25,7 +25,7 @@ import navigation.ReturnsNavigator import pages.declareDuty.{TellUsAboutSingleSPRRatePage, WhatDoYouNeedToDeclarePage} import play.api.i18n.{I18nSupport, MessagesApi} import play.api.mvc.{Action, AnyContent, MessagesControllerComponents} -import connectors.CacheConnector +import connectors.UserAnswersConnector import models.declareDuty.VolumeAndRateByTaxType import play.api.Logging import uk.gov.hmrc.play.bootstrap.frontend.controller.FrontendBaseController @@ -36,7 +36,7 @@ import scala.concurrent.{ExecutionContext, Future} class TellUsAboutSingleSPRRateController @Inject() ( override val messagesApi: MessagesApi, - cacheConnector: CacheConnector, + userAnswersConnector: UserAnswersConnector, navigator: ReturnsNavigator, identify: IdentifyWithEnrolmentAction, getData: DataRetrievalAction, @@ -90,7 +90,7 @@ class TellUsAboutSingleSPRRateController @Inject() ( for { updatedAnswers <- Future.fromTry(request.userAnswers.setByKey(currentPage, regime, value)) - _ <- cacheConnector.set(updatedAnswers) + _ <- userAnswersConnector.set(updatedAnswers) } yield Redirect( navigator .nextPageWithRegime(currentPage, mode, updatedAnswers, regime, hasChanged) diff --git a/app/controllers/declareDuty/WhatDoYouNeedToDeclareController.scala b/app/controllers/declareDuty/WhatDoYouNeedToDeclareController.scala index bef09fe0..6df7d44a 100644 --- a/app/controllers/declareDuty/WhatDoYouNeedToDeclareController.scala +++ b/app/controllers/declareDuty/WhatDoYouNeedToDeclareController.scala @@ -16,7 +16,7 @@ package controllers.declareDuty -import connectors.{AlcoholDutyCalculatorConnector, CacheConnector} +import connectors.{AlcoholDutyCalculatorConnector, UserAnswersConnector} import controllers.actions._ import forms.declareDuty.WhatDoYouNeedToDeclareFormProvider import models.requests.DataRequest @@ -38,7 +38,7 @@ import scala.util.Try class WhatDoYouNeedToDeclareController @Inject() ( override val messagesApi: MessagesApi, - cacheConnector: CacheConnector, + userAnswersConnector: UserAnswersConnector, calculatorConnector: AlcoholDutyCalculatorConnector, navigator: ReturnsNavigator, identify: IdentifyWithEnrolmentAction, @@ -85,7 +85,7 @@ class WhatDoYouNeedToDeclareController @Inject() ( updatedAnswers <- Future.fromTry(request.userAnswers.setByKey(currentPage, regime, selectedRateBands)) (pagesToClear, hasChanged) = changedValue(selectedRateBands, regime) clearedAnswers <- Future.fromTry(updatedAnswers.removePagesByKey(pagesToClear, regime)) - _ <- cacheConnector.set(clearedAnswers) + _ <- userAnswersConnector.set(clearedAnswers) } yield Redirect( navigator .nextPageWithRegime(currentPage, mode, updatedAnswers, regime, hasChanged) diff --git a/app/controllers/dutySuspended/DeclareDutySuspendedDeliveriesQuestionController.scala b/app/controllers/dutySuspended/DeclareDutySuspendedDeliveriesQuestionController.scala index 8f0d5fac..50376d62 100644 --- a/app/controllers/dutySuspended/DeclareDutySuspendedDeliveriesQuestionController.scala +++ b/app/controllers/dutySuspended/DeclareDutySuspendedDeliveriesQuestionController.scala @@ -16,7 +16,7 @@ package controllers.dutySuspended -import connectors.CacheConnector +import connectors.UserAnswersConnector import controllers.actions._ import forms.dutySuspended.DeclareDutySuspendedDeliveriesQuestionFormProvider import models.{Mode, UserAnswers} @@ -33,7 +33,7 @@ import scala.util.Try class DeclareDutySuspendedDeliveriesQuestionController @Inject() ( override val messagesApi: MessagesApi, - cacheConnector: CacheConnector, + userAnswersConnector: UserAnswersConnector, navigator: DeclareDutySuspendedDeliveriesNavigator, identify: IdentifyWithEnrolmentAction, getData: DataRetrievalAction, @@ -69,7 +69,7 @@ class DeclareDutySuspendedDeliveriesQuestionController @Inject() ( request.userAnswers.set(DeclareDutySuspendedDeliveriesQuestionPage, value) ) filterUserAnswer <- Future.fromTry(filterDSDQuestionAnswer(updatedAnswers, value)) - _ <- cacheConnector.set(filterUserAnswer) + _ <- userAnswersConnector.set(filterUserAnswer) } yield Redirect(navigator.nextPage(DeclareDutySuspendedDeliveriesQuestionPage, mode, filterUserAnswer)) ) } diff --git a/app/controllers/dutySuspended/DutySuspendedBeerController.scala b/app/controllers/dutySuspended/DutySuspendedBeerController.scala index d313ab2f..5b43a865 100644 --- a/app/controllers/dutySuspended/DutySuspendedBeerController.scala +++ b/app/controllers/dutySuspended/DutySuspendedBeerController.scala @@ -24,7 +24,7 @@ import navigation.DeclareDutySuspendedDeliveriesNavigator import pages.dutySuspended.DutySuspendedBeerPage import play.api.i18n.{I18nSupport, MessagesApi} import play.api.mvc.{Action, AnyContent, MessagesControllerComponents} -import connectors.CacheConnector +import connectors.UserAnswersConnector import uk.gov.hmrc.play.bootstrap.frontend.controller.FrontendBaseController import views.html.dutySuspended.DutySuspendedBeerView @@ -32,7 +32,7 @@ import scala.concurrent.{ExecutionContext, Future} class DutySuspendedBeerController @Inject() ( override val messagesApi: MessagesApi, - cacheConnector: CacheConnector, + userAnswersConnector: UserAnswersConnector, navigator: DeclareDutySuspendedDeliveriesNavigator, identify: IdentifyWithEnrolmentAction, getData: DataRetrievalAction, @@ -66,7 +66,7 @@ class DutySuspendedBeerController @Inject() ( value => for { updatedAnswers <- Future.fromTry(request.userAnswers.set(DutySuspendedBeerPage, value)) - _ <- cacheConnector.set(updatedAnswers) + _ <- userAnswersConnector.set(updatedAnswers) } yield Redirect(navigator.nextPage(DutySuspendedBeerPage, mode, updatedAnswers)) ) } diff --git a/app/controllers/dutySuspended/DutySuspendedCiderController.scala b/app/controllers/dutySuspended/DutySuspendedCiderController.scala index 080893d9..db19bed1 100644 --- a/app/controllers/dutySuspended/DutySuspendedCiderController.scala +++ b/app/controllers/dutySuspended/DutySuspendedCiderController.scala @@ -24,7 +24,7 @@ import navigation.DeclareDutySuspendedDeliveriesNavigator import pages.dutySuspended.DutySuspendedCiderPage import play.api.i18n.{I18nSupport, MessagesApi} import play.api.mvc.{Action, AnyContent, MessagesControllerComponents} -import connectors.CacheConnector +import connectors.UserAnswersConnector import uk.gov.hmrc.play.bootstrap.frontend.controller.FrontendBaseController import views.html.dutySuspended.DutySuspendedCiderView @@ -32,7 +32,7 @@ import scala.concurrent.{ExecutionContext, Future} class DutySuspendedCiderController @Inject() ( override val messagesApi: MessagesApi, - cacheConnector: CacheConnector, + userAnswersConnector: UserAnswersConnector, navigator: DeclareDutySuspendedDeliveriesNavigator, identify: IdentifyWithEnrolmentAction, getData: DataRetrievalAction, @@ -66,7 +66,7 @@ class DutySuspendedCiderController @Inject() ( value => for { updatedAnswers <- Future.fromTry(request.userAnswers.set(DutySuspendedCiderPage, value)) - _ <- cacheConnector.set(updatedAnswers) + _ <- userAnswersConnector.set(updatedAnswers) } yield Redirect(navigator.nextPage(DutySuspendedCiderPage, mode, updatedAnswers)) ) } diff --git a/app/controllers/dutySuspended/DutySuspendedOtherFermentedController.scala b/app/controllers/dutySuspended/DutySuspendedOtherFermentedController.scala index 2d8faf16..e1db5f63 100644 --- a/app/controllers/dutySuspended/DutySuspendedOtherFermentedController.scala +++ b/app/controllers/dutySuspended/DutySuspendedOtherFermentedController.scala @@ -25,7 +25,7 @@ import navigation.DeclareDutySuspendedDeliveriesNavigator import pages.dutySuspended.DutySuspendedOtherFermentedPage import play.api.i18n.{I18nSupport, MessagesApi} import play.api.mvc.{Action, AnyContent, MessagesControllerComponents} -import connectors.CacheConnector +import connectors.UserAnswersConnector import uk.gov.hmrc.play.bootstrap.frontend.controller.FrontendBaseController import views.html.dutySuspended.DutySuspendedOtherFermentedView @@ -33,7 +33,7 @@ import scala.concurrent.{ExecutionContext, Future} class DutySuspendedOtherFermentedController @Inject() ( override val messagesApi: MessagesApi, - cacheConnector: CacheConnector, + userAnswersConnector: UserAnswersConnector, navigator: DeclareDutySuspendedDeliveriesNavigator, identify: IdentifyWithEnrolmentAction, getData: DataRetrievalAction, @@ -67,7 +67,7 @@ class DutySuspendedOtherFermentedController @Inject() ( value => for { updatedAnswers <- Future.fromTry(request.userAnswers.set(DutySuspendedOtherFermentedPage, value)) - _ <- cacheConnector.set(updatedAnswers) + _ <- userAnswersConnector.set(updatedAnswers) } yield Redirect(navigator.nextPage(DutySuspendedOtherFermentedPage, mode, updatedAnswers)) ) } diff --git a/app/controllers/dutySuspended/DutySuspendedSpiritsController.scala b/app/controllers/dutySuspended/DutySuspendedSpiritsController.scala index a6715460..3ad3e433 100644 --- a/app/controllers/dutySuspended/DutySuspendedSpiritsController.scala +++ b/app/controllers/dutySuspended/DutySuspendedSpiritsController.scala @@ -24,7 +24,7 @@ import navigation.DeclareDutySuspendedDeliveriesNavigator import pages.dutySuspended.DutySuspendedSpiritsPage import play.api.i18n.{I18nSupport, MessagesApi} import play.api.mvc.{Action, AnyContent, MessagesControllerComponents} -import connectors.CacheConnector +import connectors.UserAnswersConnector import uk.gov.hmrc.play.bootstrap.frontend.controller.FrontendBaseController import views.html.dutySuspended.DutySuspendedSpiritsView @@ -32,7 +32,7 @@ import scala.concurrent.{ExecutionContext, Future} class DutySuspendedSpiritsController @Inject() ( override val messagesApi: MessagesApi, - cacheConnector: CacheConnector, + userAnswersConnector: UserAnswersConnector, navigator: DeclareDutySuspendedDeliveriesNavigator, identify: IdentifyWithEnrolmentAction, getData: DataRetrievalAction, @@ -66,7 +66,7 @@ class DutySuspendedSpiritsController @Inject() ( value => for { updatedAnswers <- Future.fromTry(request.userAnswers.set(DutySuspendedSpiritsPage, value)) - _ <- cacheConnector.set(updatedAnswers) + _ <- userAnswersConnector.set(updatedAnswers) } yield Redirect(navigator.nextPage(DutySuspendedSpiritsPage, mode, updatedAnswers)) ) } diff --git a/app/controllers/dutySuspended/DutySuspendedWineController.scala b/app/controllers/dutySuspended/DutySuspendedWineController.scala index d995f875..11aa1fee 100644 --- a/app/controllers/dutySuspended/DutySuspendedWineController.scala +++ b/app/controllers/dutySuspended/DutySuspendedWineController.scala @@ -24,7 +24,7 @@ import navigation.DeclareDutySuspendedDeliveriesNavigator import pages.dutySuspended.DutySuspendedWinePage import play.api.i18n.{I18nSupport, MessagesApi} import play.api.mvc.{Action, AnyContent, MessagesControllerComponents} -import connectors.CacheConnector +import connectors.UserAnswersConnector import uk.gov.hmrc.play.bootstrap.frontend.controller.FrontendBaseController import views.html.dutySuspended.DutySuspendedWineView @@ -32,7 +32,7 @@ import scala.concurrent.{ExecutionContext, Future} class DutySuspendedWineController @Inject() ( override val messagesApi: MessagesApi, - cacheConnector: CacheConnector, + userAnswersConnector: UserAnswersConnector, navigator: DeclareDutySuspendedDeliveriesNavigator, identify: IdentifyWithEnrolmentAction, getData: DataRetrievalAction, @@ -66,7 +66,7 @@ class DutySuspendedWineController @Inject() ( value => for { updatedAnswers <- Future.fromTry(request.userAnswers.set(DutySuspendedWinePage, value)) - _ <- cacheConnector.set(updatedAnswers) + _ <- userAnswersConnector.set(updatedAnswers) } yield Redirect(navigator.nextPage(DutySuspendedWinePage, mode, updatedAnswers)) ) } diff --git a/app/controllers/spiritsQuestions/AlcoholUsedController.scala b/app/controllers/spiritsQuestions/AlcoholUsedController.scala index 9ee94ed6..fb60dec6 100644 --- a/app/controllers/spiritsQuestions/AlcoholUsedController.scala +++ b/app/controllers/spiritsQuestions/AlcoholUsedController.scala @@ -26,7 +26,7 @@ import navigation.QuarterlySpiritsQuestionsNavigator import pages.spiritsQuestions.AlcoholUsedPage import play.api.i18n.{I18nSupport, MessagesApi} import play.api.mvc.{Action, AnyContent, MessagesControllerComponents} -import connectors.CacheConnector +import connectors.UserAnswersConnector import uk.gov.hmrc.play.bootstrap.frontend.controller.FrontendBaseController import views.html.spiritsQuestions.AlcoholUsedView @@ -34,7 +34,7 @@ import scala.concurrent.{ExecutionContext, Future} class AlcoholUsedController @Inject() ( override val messagesApi: MessagesApi, - cacheConnector: CacheConnector, + userAnswersConnector: UserAnswersConnector, navigator: QuarterlySpiritsQuestionsNavigator, identify: IdentifyWithEnrolmentAction, getData: DataRetrievalAction, @@ -72,7 +72,7 @@ class AlcoholUsedController @Inject() ( value => for { updatedAnswers <- Future.fromTry(request.userAnswers.set(AlcoholUsedPage, value)) - _ <- cacheConnector.set(updatedAnswers) + _ <- userAnswersConnector.set(updatedAnswers) } yield Redirect(navigator.nextPage(AlcoholUsedPage, mode, updatedAnswers)) ) } diff --git a/app/controllers/spiritsQuestions/DeclareQuarterlySpiritsController.scala b/app/controllers/spiritsQuestions/DeclareQuarterlySpiritsController.scala index ffde1805..407dded5 100644 --- a/app/controllers/spiritsQuestions/DeclareQuarterlySpiritsController.scala +++ b/app/controllers/spiritsQuestions/DeclareQuarterlySpiritsController.scala @@ -24,7 +24,7 @@ import navigation.QuarterlySpiritsQuestionsNavigator import pages.spiritsQuestions.DeclareQuarterlySpiritsPage import play.api.i18n.{I18nSupport, MessagesApi} import play.api.mvc.{Action, AnyContent, MessagesControllerComponents} -import connectors.CacheConnector +import connectors.UserAnswersConnector import uk.gov.hmrc.play.bootstrap.frontend.controller.FrontendBaseController import views.html.spiritsQuestions.DeclareQuarterlySpiritsView @@ -32,7 +32,7 @@ import scala.concurrent.{ExecutionContext, Future} class DeclareQuarterlySpiritsController @Inject() ( override val messagesApi: MessagesApi, - cacheConnector: CacheConnector, + userAnswersConnector: UserAnswersConnector, navigator: QuarterlySpiritsQuestionsNavigator, identify: IdentifyWithEnrolmentAction, getData: DataRetrievalAction, @@ -69,7 +69,7 @@ class DeclareQuarterlySpiritsController @Inject() ( value => for { updatedAnswers <- Future.fromTry(request.userAnswers.set(DeclareQuarterlySpiritsPage, value)) - _ <- cacheConnector.set(updatedAnswers) + _ <- userAnswersConnector.set(updatedAnswers) } yield Redirect(navigator.nextPage(DeclareQuarterlySpiritsPage, mode, updatedAnswers)) ) } diff --git a/app/controllers/spiritsQuestions/DeclareSpiritsTotalController.scala b/app/controllers/spiritsQuestions/DeclareSpiritsTotalController.scala index be921454..b2681077 100644 --- a/app/controllers/spiritsQuestions/DeclareSpiritsTotalController.scala +++ b/app/controllers/spiritsQuestions/DeclareSpiritsTotalController.scala @@ -16,7 +16,7 @@ package controllers.spiritsQuestions -import connectors.CacheConnector +import connectors.UserAnswersConnector import controllers.actions._ import forms.spiritsQuestions.DeclareSpiritsTotalFormProvider import javax.inject.Inject @@ -32,7 +32,7 @@ import scala.concurrent.{ExecutionContext, Future} class DeclareSpiritsTotalController @Inject() ( override val messagesApi: MessagesApi, - cacheConnector: CacheConnector, + userAnswersConnector: UserAnswersConnector, navigator: QuarterlySpiritsQuestionsNavigator, identify: IdentifyWithEnrolmentAction, getData: DataRetrievalAction, @@ -70,7 +70,7 @@ class DeclareSpiritsTotalController @Inject() ( for { updatedAnswers <- Future.fromTry(request.userAnswers.set(DeclareSpiritsTotalPage, value)) - _ <- cacheConnector.set(updatedAnswers) + _ <- userAnswersConnector.set(updatedAnswers) } yield Redirect(navigator.nextPage(DeclareSpiritsTotalPage, mode, updatedAnswers)) ) } diff --git a/app/controllers/spiritsQuestions/EthyleneGasOrMolassesUsedController.scala b/app/controllers/spiritsQuestions/EthyleneGasOrMolassesUsedController.scala index 543db70a..aa24d463 100644 --- a/app/controllers/spiritsQuestions/EthyleneGasOrMolassesUsedController.scala +++ b/app/controllers/spiritsQuestions/EthyleneGasOrMolassesUsedController.scala @@ -25,7 +25,7 @@ import navigation.QuarterlySpiritsQuestionsNavigator import pages.spiritsQuestions.{EthyleneGasOrMolassesUsedPage, OtherIngredientsUsedPage} import play.api.i18n.{I18nSupport, MessagesApi} import play.api.mvc.{Action, AnyContent, MessagesControllerComponents} -import connectors.CacheConnector +import connectors.UserAnswersConnector import uk.gov.hmrc.play.bootstrap.frontend.controller.FrontendBaseController import views.html.spiritsQuestions.EthyleneGasOrMolassesUsedView @@ -33,7 +33,7 @@ import scala.concurrent.{ExecutionContext, Future} class EthyleneGasOrMolassesUsedController @Inject() ( override val messagesApi: MessagesApi, - cacheConnector: CacheConnector, + userAnswersConnector: UserAnswersConnector, navigator: QuarterlySpiritsQuestionsNavigator, identify: IdentifyWithEnrolmentAction, getData: DataRetrievalAction, @@ -72,7 +72,7 @@ class EthyleneGasOrMolassesUsedController @Inject() ( handleOtherIngredientsChange(request.userAnswers, value.otherIngredients) for { updatedAnswers <- Future.fromTry(intermediateAnswers.set(EthyleneGasOrMolassesUsedPage, value)) - _ <- cacheConnector.set(updatedAnswers) + _ <- userAnswersConnector.set(updatedAnswers) } yield Redirect( navigator.nextPage(EthyleneGasOrMolassesUsedPage, mode, updatedAnswers, otherIngredientsNowSelected) ) diff --git a/app/controllers/spiritsQuestions/GrainsUsedController.scala b/app/controllers/spiritsQuestions/GrainsUsedController.scala index 697d5486..fc170ad7 100644 --- a/app/controllers/spiritsQuestions/GrainsUsedController.scala +++ b/app/controllers/spiritsQuestions/GrainsUsedController.scala @@ -25,7 +25,7 @@ import navigation.QuarterlySpiritsQuestionsNavigator import pages.spiritsQuestions.{GrainsUsedPage, OtherMaltedGrainsPage} import play.api.i18n.{I18nSupport, MessagesApi} import play.api.mvc.{Action, AnyContent, MessagesControllerComponents} -import connectors.CacheConnector +import connectors.UserAnswersConnector import uk.gov.hmrc.play.bootstrap.frontend.controller.FrontendBaseController import views.html.spiritsQuestions.GrainsUsedView @@ -33,7 +33,7 @@ import scala.concurrent.{ExecutionContext, Future} class GrainsUsedController @Inject() ( override val messagesApi: MessagesApi, - cacheConnector: CacheConnector, + userAnswersConnector: UserAnswersConnector, navigator: QuarterlySpiritsQuestionsNavigator, identify: IdentifyWithEnrolmentAction, getData: DataRetrievalAction, @@ -72,7 +72,7 @@ class GrainsUsedController @Inject() ( handleOtherMaltedGrainsChange(request.userAnswers, value.usedMaltedGrainNotBarley) for { updatedAnswers <- Future.fromTry(intermediateAnswers.set(GrainsUsedPage, value)) - _ <- cacheConnector.set(updatedAnswers) + _ <- userAnswersConnector.set(updatedAnswers) } yield Redirect( navigator.nextPage(GrainsUsedPage, mode, updatedAnswers, maltedGrainNotBarleyNowSelected) ) diff --git a/app/controllers/spiritsQuestions/OtherIngredientsUsedController.scala b/app/controllers/spiritsQuestions/OtherIngredientsUsedController.scala index 483d1d19..366d4e0a 100644 --- a/app/controllers/spiritsQuestions/OtherIngredientsUsedController.scala +++ b/app/controllers/spiritsQuestions/OtherIngredientsUsedController.scala @@ -24,7 +24,7 @@ import models.Mode import pages.spiritsQuestions.OtherIngredientsUsedPage import play.api.i18n.{I18nSupport, MessagesApi} import play.api.mvc.{Action, AnyContent, MessagesControllerComponents} -import connectors.CacheConnector +import connectors.UserAnswersConnector import navigation.QuarterlySpiritsQuestionsNavigator import uk.gov.hmrc.play.bootstrap.frontend.controller.FrontendBaseController import views.html.spiritsQuestions.OtherIngredientsUsedView @@ -33,7 +33,7 @@ import scala.concurrent.{ExecutionContext, Future} class OtherIngredientsUsedController @Inject() ( override val messagesApi: MessagesApi, - cacheConnector: CacheConnector, + userAnswersConnector: UserAnswersConnector, navigator: QuarterlySpiritsQuestionsNavigator, identify: IdentifyWithEnrolmentAction, getData: DataRetrievalAction, @@ -70,7 +70,7 @@ class OtherIngredientsUsedController @Inject() ( value => for { updatedAnswers <- Future.fromTry(request.userAnswers.set(OtherIngredientsUsedPage, value)) - _ <- cacheConnector.set(updatedAnswers) + _ <- userAnswersConnector.set(updatedAnswers) } yield Redirect(navigator.nextPage(OtherIngredientsUsedPage, mode, updatedAnswers)) ) } diff --git a/app/controllers/spiritsQuestions/OtherMaltedGrainsController.scala b/app/controllers/spiritsQuestions/OtherMaltedGrainsController.scala index 4fb2dc87..eeaf6aab 100644 --- a/app/controllers/spiritsQuestions/OtherMaltedGrainsController.scala +++ b/app/controllers/spiritsQuestions/OtherMaltedGrainsController.scala @@ -24,7 +24,7 @@ import models.Mode import pages.spiritsQuestions.OtherMaltedGrainsPage import play.api.i18n.{I18nSupport, MessagesApi} import play.api.mvc.{Action, AnyContent, MessagesControllerComponents} -import connectors.CacheConnector +import connectors.UserAnswersConnector import navigation.QuarterlySpiritsQuestionsNavigator import uk.gov.hmrc.play.bootstrap.frontend.controller.FrontendBaseController import views.html.spiritsQuestions.OtherMaltedGrainsView @@ -33,7 +33,7 @@ import scala.concurrent.{ExecutionContext, Future} class OtherMaltedGrainsController @Inject() ( override val messagesApi: MessagesApi, - cacheConnector: CacheConnector, + userAnswersConnector: UserAnswersConnector, navigator: QuarterlySpiritsQuestionsNavigator, identify: IdentifyWithEnrolmentAction, getData: DataRetrievalAction, @@ -70,7 +70,7 @@ class OtherMaltedGrainsController @Inject() ( value => for { updatedAnswers <- Future.fromTry(request.userAnswers.set(OtherMaltedGrainsPage, value)) - _ <- cacheConnector.set(updatedAnswers) + _ <- userAnswersConnector.set(updatedAnswers) } yield Redirect(navigator.nextPage(OtherMaltedGrainsPage, mode, updatedAnswers)) ) } diff --git a/app/controllers/spiritsQuestions/OtherSpiritsProducedController.scala b/app/controllers/spiritsQuestions/OtherSpiritsProducedController.scala index 74ccd152..3ad88eca 100644 --- a/app/controllers/spiritsQuestions/OtherSpiritsProducedController.scala +++ b/app/controllers/spiritsQuestions/OtherSpiritsProducedController.scala @@ -25,7 +25,7 @@ import navigation.QuarterlySpiritsQuestionsNavigator import pages.spiritsQuestions.OtherSpiritsProducedPage import play.api.i18n.{I18nSupport, MessagesApi} import play.api.mvc.{Action, AnyContent, MessagesControllerComponents} -import connectors.CacheConnector +import connectors.UserAnswersConnector import uk.gov.hmrc.play.bootstrap.frontend.controller.FrontendBaseController import views.html.spiritsQuestions.OtherSpiritsProducedView @@ -33,7 +33,7 @@ import scala.concurrent.{ExecutionContext, Future} class OtherSpiritsProducedController @Inject() ( override val messagesApi: MessagesApi, - cacheConnector: CacheConnector, + userAnswersConnector: UserAnswersConnector, navigator: QuarterlySpiritsQuestionsNavigator, identify: IdentifyWithEnrolmentAction, getData: DataRetrievalAction, @@ -70,7 +70,7 @@ class OtherSpiritsProducedController @Inject() ( value => for { updatedAnswers <- Future.fromTry(request.userAnswers.set(OtherSpiritsProducedPage, value)) - _ <- cacheConnector.set(updatedAnswers) + _ <- userAnswersConnector.set(updatedAnswers) } yield Redirect(navigator.nextPage(OtherSpiritsProducedPage, mode, updatedAnswers)) ) } diff --git a/app/controllers/spiritsQuestions/SpiritTypeController.scala b/app/controllers/spiritsQuestions/SpiritTypeController.scala index 27db9bb5..60a2138d 100644 --- a/app/controllers/spiritsQuestions/SpiritTypeController.scala +++ b/app/controllers/spiritsQuestions/SpiritTypeController.scala @@ -25,7 +25,7 @@ import navigation.QuarterlySpiritsQuestionsNavigator import pages.spiritsQuestions.{OtherSpiritsProducedPage, SpiritTypePage} import play.api.i18n.{I18nSupport, MessagesApi} import play.api.mvc.{Action, AnyContent, MessagesControllerComponents} -import connectors.CacheConnector +import connectors.UserAnswersConnector import uk.gov.hmrc.play.bootstrap.frontend.controller.FrontendBaseController import views.html.spiritsQuestions.SpiritTypeView @@ -33,7 +33,7 @@ import scala.concurrent.{ExecutionContext, Future} class SpiritTypeController @Inject() ( override val messagesApi: MessagesApi, - cacheConnector: CacheConnector, + userAnswersConnector: UserAnswersConnector, navigator: QuarterlySpiritsQuestionsNavigator, identify: IdentifyWithEnrolmentAction, getData: DataRetrievalAction, @@ -72,7 +72,7 @@ class SpiritTypeController @Inject() ( handleOtherSpiritsChange(request.userAnswers, SpiritTypePage.hasMadeOtherSpirits(value)) for { updatedAnswers <- Future.fromTry(intermediateAnswers.set(SpiritTypePage, value)) - _ <- cacheConnector.set(updatedAnswers) + _ <- userAnswersConnector.set(updatedAnswers) } yield Redirect(navigator.nextPage(SpiritTypePage, mode, updatedAnswers, otherSpiritsNowSelected)) } ) diff --git a/app/controllers/spiritsQuestions/WhiskyController.scala b/app/controllers/spiritsQuestions/WhiskyController.scala index 131d0960..c18ab93a 100644 --- a/app/controllers/spiritsQuestions/WhiskyController.scala +++ b/app/controllers/spiritsQuestions/WhiskyController.scala @@ -24,7 +24,7 @@ import navigation.QuarterlySpiritsQuestionsNavigator import pages.spiritsQuestions.WhiskyPage import play.api.i18n.{I18nSupport, MessagesApi} import play.api.mvc.{Action, AnyContent, MessagesControllerComponents} -import connectors.CacheConnector +import connectors.UserAnswersConnector import uk.gov.hmrc.play.bootstrap.frontend.controller.FrontendBaseController import views.html.spiritsQuestions.WhiskyView @@ -32,7 +32,7 @@ import scala.concurrent.{ExecutionContext, Future} class WhiskyController @Inject() ( override val messagesApi: MessagesApi, - cacheConnector: CacheConnector, + userAnswersConnector: UserAnswersConnector, navigator: QuarterlySpiritsQuestionsNavigator, identify: IdentifyWithEnrolmentAction, getData: DataRetrievalAction, @@ -69,7 +69,7 @@ class WhiskyController @Inject() ( value => for { updatedAnswers <- Future.fromTry(request.userAnswers.set(WhiskyPage, value)) - _ <- cacheConnector.set(updatedAnswers) + _ <- userAnswersConnector.set(updatedAnswers) } yield Redirect(navigator.nextPage(WhiskyPage, mode, updatedAnswers)) ) } diff --git a/app/services/adjustment/AdjustmentEntryService.scala b/app/services/adjustment/AdjustmentEntryService.scala index 219585e6..ca5cf521 100644 --- a/app/services/adjustment/AdjustmentEntryService.scala +++ b/app/services/adjustment/AdjustmentEntryService.scala @@ -80,7 +80,7 @@ class AdjustmentEntryServiceImpl @Inject() ( alcoholDutyCalculatorConnector.calculateRepackagedDutyChange( repackagedTaxDuty.duty, updatedAdjustment.duty.getOrElse( - throw new RuntimeException("Couldn't fetch adjustment duty from cache") + throw new RuntimeException("Couldn't fetch adjustment duty from user answers") ) ) } yield updatedAdjustment.copy( diff --git a/app/testonly/connectors/TestOnlyCacheConnector.scala b/app/testonly/connectors/TestOnlyCacheConnector.scala index b91789f6..918996aa 100644 --- a/app/testonly/connectors/TestOnlyCacheConnector.scala +++ b/app/testonly/connectors/TestOnlyCacheConnector.scala @@ -24,11 +24,11 @@ import uk.gov.hmrc.http.{HeaderCarrier, HttpResponse, StringContextOps} import javax.inject.Inject import scala.concurrent.{ExecutionContext, Future} -class TestOnlyCacheConnector @Inject() ( +class TestOnlyUserAnswersConnector @Inject() ( appConfig: FrontendAppConfig, httpClient: HttpClientV2 )(implicit val ec: ExecutionContext) { def clearAllData()(implicit hc: HeaderCarrier): Future[HttpResponse] = - httpClient.delete(url"${appConfig.adrCacheClearAllUrl()}").execute[HttpResponse] + httpClient.delete(url"${appConfig.adrUserAnswersClearAllUrl()}").execute[HttpResponse] } diff --git a/app/testonly/controllers/TestOnlyController.scala b/app/testonly/controllers/TestOnlyController.scala index 8ae55e06..e96a12a1 100644 --- a/app/testonly/controllers/TestOnlyController.scala +++ b/app/testonly/controllers/TestOnlyController.scala @@ -17,7 +17,7 @@ package testonly.controllers import play.api.mvc.{Action, AnyContent, MessagesControllerComponents} -import testonly.connectors.TestOnlyCacheConnector +import testonly.connectors.TestOnlyUserAnswersConnector import uk.gov.hmrc.play.bootstrap.frontend.controller.FrontendBaseController import javax.inject.Inject @@ -25,7 +25,7 @@ import scala.concurrent.ExecutionContext class TestOnlyController @Inject() ( val controllerComponents: MessagesControllerComponents, - testOnlyConnector: TestOnlyCacheConnector + testOnlyConnector: TestOnlyUserAnswersConnector )(implicit val ec: ExecutionContext) extends FrontendBaseController { diff --git a/app/viewmodels/checkAnswers/adjustment/AdjustmentListSummaryHelper.scala b/app/viewmodels/checkAnswers/adjustment/AdjustmentListSummaryHelper.scala index 41a6babe..a8a38851 100644 --- a/app/viewmodels/checkAnswers/adjustment/AdjustmentListSummaryHelper.scala +++ b/app/viewmodels/checkAnswers/adjustment/AdjustmentListSummaryHelper.scala @@ -66,7 +66,7 @@ object AdjustmentListSummaryHelper { adjustmentEntries.zipWithIndex.map { case (adjustmentEntry, index) => val adjustmentIndex = (pageNumber - 1) * rowsPerPage + index val adjustmentType = adjustmentEntry.adjustmentType.getOrElse( - throw new RuntimeException("Couldn't fetch adjustment type value from cache") + throw new RuntimeException("Couldn't fetch adjustment type value from user answers") ) val adjustmentTypeLabel = messages(s"adjustmentType.checkYourAnswersLabel.$adjustmentType") val dutyValue = if (adjustmentEntry.newDuty.isDefined) { @@ -75,13 +75,15 @@ object AdjustmentListSummaryHelper { adjustmentEntry.duty } val formattedDutyValue = - Money.format(dutyValue.getOrElse(throw new RuntimeException("Couldn't fetch duty value from cache"))) + Money.format(dutyValue.getOrElse(throw new RuntimeException("Couldn't fetch duty value from user answers"))) val description = (adjustmentType, adjustmentEntry.spoiltRegime) match { case (Spoilt, Some(spoiltRegime)) => Text(messages(s"alcoholType.$spoiltRegime")) case _ => Text( rateBandRecap( - adjustmentEntry.rateBand.getOrElse(throw new RuntimeException("Couldn't fetch rateBand from cache")) + adjustmentEntry.rateBand.getOrElse( + throw new RuntimeException("Couldn't fetch rateBand from user answers") + ) ) ) } diff --git a/build.sbt b/build.sbt index fa2b5b72..9b04ea7c 100644 --- a/build.sbt +++ b/build.sbt @@ -93,7 +93,7 @@ lazy val scoverageExcludedList:Seq[String] = Seq( ".*views.*", "testOnly.*", ".*testOnly.*", - ".*TestOnlyCacheConnector.*", + ".*TestOnlyUserAnswersConnector.*", ".*TestOnlyController.*", "testOnlyDoNotUseInAppConf.*" ) diff --git a/it/test/CacheConnectorISpec.scala b/it/test/UserAnswersConnectorISpec.scala similarity index 81% rename from it/test/CacheConnectorISpec.scala rename to it/test/UserAnswersConnectorISpec.scala index 2511d037..619ee6e9 100644 --- a/it/test/CacheConnectorISpec.scala +++ b/it/test/UserAnswersConnectorISpec.scala @@ -15,7 +15,7 @@ */ import com.github.tomakehurst.wiremock.client.WireMock.{aResponse, delete, equalToJson, get, post, put, urlMatching} -import connectors.CacheConnector +import connectors.UserAnswersConnector import models.AlcoholRegime.Beer import models.{AlcoholRegimes, ReturnId, UserAnswers} import play.api.Application @@ -24,16 +24,16 @@ import play.api.libs.json.Json import java.time.Instant -class CacheConnectorISpec extends ISpecBase with WireMockHelper { +class UserAnswersConnectorISpec extends ISpecBase with WireMockHelper { override def fakeApplication(): Application = applicationBuilder(None).configure("microservice.services.alcohol-duty-returns.port" -> server.port()).build() -"CacheConnector" - { +"UserAnswersConnector" - { "get" - { - "successfully fetch cache" in new SetUp { + "successfully fetch user answers" in new SetUp { val jsonResponse = Json.toJson(userAnswers).toString() server.stubFor( - get(urlMatching(cacheGetUrl)) + get(urlMatching(userAnswersGetUrl)) .willReturn(aResponse().withStatus(OK).withBody(jsonResponse)) ) @@ -43,7 +43,7 @@ class CacheConnectorISpec extends ISpecBase with WireMockHelper { } "return an error when the upstream service returns an error" in new SetUp { server.stubFor( - get(urlMatching(cacheGetUrl)) + get(urlMatching(userAnswersGetUrl)) .willReturn(aResponse().withStatus(INTERNAL_SERVER_ERROR)) ) @@ -55,9 +55,9 @@ class CacheConnectorISpec extends ISpecBase with WireMockHelper { } "createUserAnswers" - { - "successfully write cache" in new SetUp { + "successfully write user answers" in new SetUp { server.stubFor( - post(urlMatching(createUserAnswersUrl)) + post(urlMatching(userAnswersUrl)) .withRequestBody(equalToJson(Json.stringify(Json.toJson(returnAndUserDetails)))) .willReturn(aResponse().withStatus(CREATED) .withBody(Json.stringify(Json.toJson(userAnswers)))) @@ -71,9 +71,9 @@ class CacheConnectorISpec extends ISpecBase with WireMockHelper { } } - "fail to write cache when the service returns an error" in new SetUp { + "fail to write user answers when the service returns an error" in new SetUp { server.stubFor( - post(urlMatching(createUserAnswersUrl)) + post(urlMatching(userAnswersUrl)) .withRequestBody(equalToJson(Json.stringify(Json.toJson(returnAndUserDetails)))) .willReturn(aResponse().withStatus(BAD_REQUEST)) ) @@ -87,9 +87,9 @@ class CacheConnectorISpec extends ISpecBase with WireMockHelper { "set" - { - "successfully write cache" in new SetUp{ + "successfully write user answers" in new SetUp{ server.stubFor( - put(urlMatching(cacheSetUrl)) + put(urlMatching(userAnswersUrl)) .withRequestBody(equalToJson(Json.stringify(Json.toJson(emptyUserAnswers)))) .willReturn(aResponse().withStatus(OK)) ) @@ -100,9 +100,9 @@ class CacheConnectorISpec extends ISpecBase with WireMockHelper { } } - "fail to write cache when the service returns an error" in new SetUp { + "fail to write user answers when the service returns an error" in new SetUp { server.stubFor( - put(urlMatching(cacheSetUrl)) + put(urlMatching(userAnswersUrl)) .withRequestBody(equalToJson(Json.stringify(Json.toJson(emptyUserAnswers)))) .willReturn(aResponse().withStatus(SERVICE_UNAVAILABLE)) ) @@ -163,12 +163,11 @@ class CacheConnectorISpec extends ISpecBase with WireMockHelper { } class SetUp { - val connector = app.injector.instanceOf[CacheConnector] + val connector = app.injector.instanceOf[UserAnswersConnector] val userAnswers = UserAnswers(ReturnId(appaId, periodKey),"abc","xyz", AlcoholRegimes(Set(Beer)), Json.obj(), Instant.now(clock), Instant.now(clock)) - val cacheGetUrl = s"/alcohol-duty-returns/cache/get/$appaId/$periodKey" - val cacheSetUrl = "/alcohol-duty-returns/cache/set" - val createUserAnswersUrl = "/alcohol-duty-returns/cache/user-answers" - val releaseLockUrl = s"/alcohol-duty-returns/cache/lock/$appaId/$periodKey" - val keepAliveUrl = s"/alcohol-duty-returns/cache/lock/${returnId.appaId}/${returnId.periodKey}/ttl" + val userAnswersGetUrl = s"/alcohol-duty-returns/user-answers/$appaId/$periodKey" + val userAnswersUrl = "/alcohol-duty-returns/user-answers" + val releaseLockUrl = s"/alcohol-duty-returns/user-answers/lock/$appaId/$periodKey" + val keepAliveUrl = s"/alcohol-duty-returns/user-answers/lock/${returnId.appaId}/${returnId.periodKey}/ttl" } } \ No newline at end of file diff --git a/test/connectors/CacheConnectorSpec.scala b/test/connectors/UserAnswersConnectorSpec.scala similarity index 80% rename from test/connectors/CacheConnectorSpec.scala rename to test/connectors/UserAnswersConnectorSpec.scala index 0a5e9e1d..23864f12 100644 --- a/test/connectors/CacheConnectorSpec.scala +++ b/test/connectors/UserAnswersConnectorSpec.scala @@ -28,11 +28,11 @@ import uk.gov.hmrc.http.{HttpResponse, StringContextOps, UpstreamErrorResponse} import java.time.LocalDateTime import scala.concurrent.Future -class CacheConnectorSpec extends SpecBase { +class UserAnswersConnectorSpec extends SpecBase { "GET" - { - "successfully fetch cache" in new SetUp { - val mockUrl = s"http://alcohol-duty-account/cache/$appaId/$periodKey" - when(mockConfig.adrCacheGetUrl(any(), any())).thenReturn(mockUrl) + "successfully fetch user answers" in new SetUp { + val mockUrl = s"http://alcohol-duty-account/user-answers/$appaId/$periodKey" + when(mockConfig.adrUserAnswersGetUrl(any(), any())).thenReturn(mockUrl) when(requestBuilder.execute[Either[UpstreamErrorResponse, UserAnswers]](any(), any())) .thenReturn(Future.successful(Right(emptyUserAnswers))) @@ -46,10 +46,10 @@ class CacheConnectorSpec extends SpecBase { } "POST" - { - "successfully write cache" in new SetUp { - val postUrl = "http://cache/user-answers" + "successfully write user answers" in new SetUp { + val postUrl = "http://user-answers" - when(mockConfig.adrCacheCreateUserAnswersUrl()).thenReturn(postUrl) + when(mockConfig.adrUserAnswersUrl()).thenReturn(postUrl) when(connector.httpClient.post(any())(any())).thenReturn(requestBuilder) @@ -69,10 +69,10 @@ class CacheConnectorSpec extends SpecBase { } "PUT" - { - "successfully write cache" in new SetUp { - val putUrl = "http://cache/set" + "successfully write user answers" in new SetUp { + val putUrl = "http://user-answers" - when(mockConfig.adrCacheSetUrl()).thenReturn(putUrl) + when(mockConfig.adrUserAnswersUrl()).thenReturn(putUrl) when(connector.httpClient.put(any())(any())).thenReturn(requestBuilder) @@ -94,9 +94,9 @@ class CacheConnectorSpec extends SpecBase { "releaseLock" - { "should call the release lock endpoint" in new SetUp { - val releaseLockUrl = "http://cache/release-lock" + val releaseLockUrl = "http://user-answers/release-lock" - when(mockConfig.adrReleaseCacheLockUrl(eqTo(appaId), eqTo(periodKey))).thenReturn(releaseLockUrl) + when(mockConfig.adrReleaseUserAnswersLockUrl(eqTo(appaId), eqTo(periodKey))).thenReturn(releaseLockUrl) when(connector.httpClient.delete(any())(any())).thenReturn(requestBuilder) @@ -117,9 +117,9 @@ class CacheConnectorSpec extends SpecBase { "keepAlive" - { "should call the keep alive endpoint" in new SetUp { - val keepAliveUrl = s"http://cache/keep-alive/$appaId/$periodKey" + val keepAliveUrl = s"http://user-answers/keep-alive/$appaId/$periodKey" - when(mockConfig.adrCacheKeepAliveUrl(eqTo(appaId), eqTo(periodKey))).thenReturn(keepAliveUrl) + when(mockConfig.adrUserAnswersLockKeepAliveUrl(eqTo(appaId), eqTo(periodKey))).thenReturn(keepAliveUrl) when { connector.httpClient @@ -147,7 +147,7 @@ class CacheConnectorSpec extends SpecBase { class SetUp { val mockConfig: FrontendAppConfig = mock[FrontendAppConfig] val httpClient: HttpClientV2 = mock[HttpClientV2] - val connector = new CacheConnector(config = mockConfig, httpClient = httpClient) + val connector = new UserAnswersConnector(config = mockConfig, httpClient = httpClient) val dateVal: LocalDateTime = LocalDateTime.now val mockHttpResponse: HttpResponse = mock[HttpResponse] val requestBuilder: RequestBuilder = mock[RequestBuilder] diff --git a/test/controllers/BeforeStartReturnControllerSpec.scala b/test/controllers/BeforeStartReturnControllerSpec.scala index 751991ba..3153396b 100644 --- a/test/controllers/BeforeStartReturnControllerSpec.scala +++ b/test/controllers/BeforeStartReturnControllerSpec.scala @@ -17,7 +17,7 @@ package controllers import base.SpecBase -import connectors.CacheConnector +import connectors.UserAnswersConnector import models.AlcoholRegime.{Beer, Cider, OtherFermentedProduct, Spirits, Wine} import models.{AlcoholRegimes, ObligationData, ReturnPeriod, UserAnswers} import models.audit.{AuditContinueReturn, AuditObligationData, AuditReturnStarted} @@ -36,7 +36,7 @@ import scala.concurrent.Future class BeforeStartReturnControllerSpec extends SpecBase { "BeforeStartReturn Controller" - { - val mockCacheConnector = mock[CacheConnector] + val mockUserAnswersConnector = mock[UserAnswersConnector] val mockAuditService: AuditService = mock[AuditService] val emptyUserAnswers: UserAnswers = UserAnswers( @@ -73,11 +73,11 @@ class BeforeStartReturnControllerSpec extends SpecBase { val viewModel = BeforeStartReturnViewModel(returnPeriod, currentDate) "must redirect to the TaskList Page if UserAnswers already exist for a GET with audit event" in { - when(mockCacheConnector.get(any(), any())(any())) thenReturn Future.successful(Right(emptyUserAnswers)) + when(mockUserAnswersConnector.get(any(), any())(any())) thenReturn Future.successful(Right(emptyUserAnswers)) val application = applicationBuilder() .overrides( - bind[CacheConnector].toInstance(mockCacheConnector), + bind[UserAnswersConnector].toInstance(mockUserAnswersConnector), bind[AuditService].toInstance(mockAuditService), bind(classOf[Clock]).toInstance(clock) ) @@ -101,11 +101,13 @@ class BeforeStartReturnControllerSpec extends SpecBase { "must return OK and the correct view for a GET if the userAnswer does not exist yet" in { val mockUpstreamErrorResponse = mock[UpstreamErrorResponse] when(mockUpstreamErrorResponse.statusCode).thenReturn(NOT_FOUND) - when(mockCacheConnector.get(any(), any())(any())) thenReturn Future.successful(Left(mockUpstreamErrorResponse)) + when(mockUserAnswersConnector.get(any(), any())(any())) thenReturn Future.successful( + Left(mockUpstreamErrorResponse) + ) val application = applicationBuilder() .overrides( - bind[CacheConnector].toInstance(mockCacheConnector) + bind[UserAnswersConnector].toInstance(mockUserAnswersConnector) ) .build() @@ -133,7 +135,7 @@ class BeforeStartReturnControllerSpec extends SpecBase { "must redirect to the journey recovery controller if a bad period key is supplied" in { val application = applicationBuilder(userAnswers = Some(emptyUserAnswers)) .overrides( - bind[CacheConnector].toInstance(mockCacheConnector) + bind[UserAnswersConnector].toInstance(mockUserAnswersConnector) ) .build() @@ -151,13 +153,13 @@ class BeforeStartReturnControllerSpec extends SpecBase { val mockUpstreamErrorResponse = mock[UpstreamErrorResponse] when(mockUpstreamErrorResponse.statusCode).thenReturn(LOCKED) - when(mockCacheConnector.get(any(), any())(any())) thenReturn Future( + when(mockUserAnswersConnector.get(any(), any())(any())) thenReturn Future( Left(mockUpstreamErrorResponse) ) val application = applicationBuilder() .overrides( - bind[CacheConnector].toInstance(mockCacheConnector) + bind[UserAnswersConnector].toInstance(mockUserAnswersConnector) ) .build() @@ -174,17 +176,17 @@ class BeforeStartReturnControllerSpec extends SpecBase { } } - "must redirect to journey recovery controller if the cache connector return a bad request" in { + "must redirect to journey recovery controller if the user answers connector return a bad request" in { val mockUpstreamErrorResponse = mock[UpstreamErrorResponse] when(mockUpstreamErrorResponse.statusCode).thenReturn(BAD_REQUEST) - when(mockCacheConnector.get(any(), any())(any())) thenReturn Future( + when(mockUserAnswersConnector.get(any(), any())(any())) thenReturn Future( Left(mockUpstreamErrorResponse) ) val application = applicationBuilder() .overrides( - bind[CacheConnector].toInstance(mockCacheConnector) + bind[UserAnswersConnector].toInstance(mockUserAnswersConnector) ) .build() @@ -203,11 +205,11 @@ class BeforeStartReturnControllerSpec extends SpecBase { "must redirect to the TaskList Page when a userAnswers is successfully created for a POST" in { val userAnswers = emptyUserAnswers.set(ObligationData, obligationDataSingleOpen).success.value - when(mockCacheConnector.createUserAnswers(any())(any())) thenReturn Future.successful(Right(userAnswers)) + when(mockUserAnswersConnector.createUserAnswers(any())(any())) thenReturn Future.successful(Right(userAnswers)) val application = applicationBuilder() .overrides( - bind[CacheConnector].toInstance(mockCacheConnector), + bind[UserAnswersConnector].toInstance(mockUserAnswersConnector), bind[AuditService].toInstance(mockAuditService) ) .build() @@ -225,13 +227,13 @@ class BeforeStartReturnControllerSpec extends SpecBase { "must redirect to the TaskList Page when a userAnswers is successfully created for a POST without sending the audit event if the obligation is not available" in { val userAnswers = emptyUserAnswers.remove(ObligationData).success.value - when(mockCacheConnector.createUserAnswers(any())(any())) thenReturn Future.successful(Right(userAnswers)) + when(mockUserAnswersConnector.createUserAnswers(any())(any())) thenReturn Future.successful(Right(userAnswers)) val mockAuditService = mock[AuditService] val application = applicationBuilder() .overrides( - bind[CacheConnector].toInstance(mockCacheConnector), + bind[UserAnswersConnector].toInstance(mockUserAnswersConnector), bind[AuditService].toInstance(mockAuditService) ) .build() @@ -250,14 +252,14 @@ class BeforeStartReturnControllerSpec extends SpecBase { "must redirect to the JourneyRecovery Page when a userAnswers cannot be created for a POST" in { val errorResponse = mock[UpstreamErrorResponse] - when(mockCacheConnector.createUserAnswers(any())(any())) thenReturn Future.successful(Left(errorResponse)) + when(mockUserAnswersConnector.createUserAnswers(any())(any())) thenReturn Future.successful(Left(errorResponse)) when(errorResponse.statusCode).thenReturn(INTERNAL_SERVER_ERROR) val mockAuditService = mock[AuditService] val application = applicationBuilder() .overrides( - bind[CacheConnector].toInstance(mockCacheConnector), + bind[UserAnswersConnector].toInstance(mockUserAnswersConnector), bind[AuditService].toInstance(mockAuditService) ) .build() @@ -275,13 +277,15 @@ class BeforeStartReturnControllerSpec extends SpecBase { } "must redirect to the journey recovery controller if the period key is not in the session for a POST" in { - when(mockCacheConnector.createUserAnswers(any())(any())) thenReturn Future.successful(Right(emptyUserAnswers)) + when(mockUserAnswersConnector.createUserAnswers(any())(any())) thenReturn Future.successful( + Right(emptyUserAnswers) + ) val mockAuditService = mock[AuditService] val application = applicationBuilder() .overrides( - bind[CacheConnector].toInstance(mockCacheConnector), + bind[UserAnswersConnector].toInstance(mockUserAnswersConnector), bind[AuditService].toInstance(mockAuditService) ) .build() diff --git a/test/controllers/BusinessTaxAccountRedirectSpec.scala b/test/controllers/BusinessTaxAccountRedirectSpec.scala index aef30e19..00fb3616 100644 --- a/test/controllers/BusinessTaxAccountRedirectSpec.scala +++ b/test/controllers/BusinessTaxAccountRedirectSpec.scala @@ -18,7 +18,7 @@ package controllers import base.SpecBase import config.FrontendAppConfig -import connectors.CacheConnector +import connectors.UserAnswersConnector import org.mockito.ArgumentMatchers.any import org.mockito.ArgumentMatchersSugar.eqTo import play.api.http.Status.{OK, SEE_OTHER} @@ -34,11 +34,11 @@ class BusinessTaxAccountRedirectSpec extends SpecBase { "if the period key is not available must redirect to the business tax account page" in { - val mockCacheConnector = mock[CacheConnector] + val mockUserAnswersConnector = mock[UserAnswersConnector] val application = applicationBuilder(None) - .overrides(bind[CacheConnector].toInstance(mockCacheConnector)) + .overrides(bind[UserAnswersConnector].toInstance(mockUserAnswersConnector)) .build() running(application) { @@ -50,18 +50,18 @@ class BusinessTaxAccountRedirectSpec extends SpecBase { status(result) mustEqual SEE_OTHER redirectLocation(result).value mustEqual appConfig.businessTaxAccountUrl - verify(mockCacheConnector, times(0)).releaseLock(eqTo(returnId))(any()) + verify(mockUserAnswersConnector, times(0)).releaseLock(eqTo(returnId))(any()) } } "if the period key is retrieved, it must release the lock, and redirect to the business tax account page" in { - val mockCacheConnector = mock[CacheConnector] - when(mockCacheConnector.releaseLock(eqTo(returnId))(any())).thenReturn(Future.successful(HttpResponse(OK))) + val mockUserAnswersConnector = mock[UserAnswersConnector] + when(mockUserAnswersConnector.releaseLock(eqTo(returnId))(any())).thenReturn(Future.successful(HttpResponse(OK))) val application = applicationBuilder(None) - .overrides(bind[CacheConnector].toInstance(mockCacheConnector)) + .overrides(bind[UserAnswersConnector].toInstance(mockUserAnswersConnector)) .build() running(application) { @@ -73,7 +73,7 @@ class BusinessTaxAccountRedirectSpec extends SpecBase { status(result) mustEqual SEE_OTHER redirectLocation(result).value mustEqual appConfig.businessTaxAccountUrl - verify(mockCacheConnector, times(1)).releaseLock(eqTo(returnId))(any()) + verify(mockUserAnswersConnector, times(1)).releaseLock(eqTo(returnId))(any()) } } } diff --git a/test/controllers/KeepAliveControllerSpec.scala b/test/controllers/KeepAliveControllerSpec.scala index 672aa0b2..3e30f48e 100644 --- a/test/controllers/KeepAliveControllerSpec.scala +++ b/test/controllers/KeepAliveControllerSpec.scala @@ -17,7 +17,7 @@ package controllers import base.SpecBase -import connectors.CacheConnector +import connectors.UserAnswersConnector import org.mockito.ArgumentMatchers.any import org.mockito.ArgumentMatchersSugar.eqTo import play.api.inject.bind @@ -34,12 +34,13 @@ class KeepAliveControllerSpec extends SpecBase { "must keep the answers alive and return OK" in { - val mockCacheConnector = mock[CacheConnector] - when(mockCacheConnector.keepAlive(eqTo(returnId))(any())).thenReturn(Future.successful(mock[HttpResponse])) + val mockUserAnswersConnector = mock[UserAnswersConnector] + when(mockUserAnswersConnector.keepAlive(eqTo(returnId))(any())) + .thenReturn(Future.successful(mock[HttpResponse])) val application = applicationBuilder(Some(emptyUserAnswers)) - .overrides(bind[CacheConnector].toInstance(mockCacheConnector)) + .overrides(bind[UserAnswersConnector].toInstance(mockUserAnswersConnector)) .build() running(application) { @@ -55,12 +56,12 @@ class KeepAliveControllerSpec extends SpecBase { "when the user has not answered any questions" - { - val mockCacheConnector = mock[CacheConnector] - when(mockCacheConnector.keepAlive(eqTo(returnId))(any())).thenReturn(Future.successful(mock[HttpResponse])) + val mockUserAnswersConnector = mock[UserAnswersConnector] + when(mockUserAnswersConnector.keepAlive(eqTo(returnId))(any())).thenReturn(Future.successful(mock[HttpResponse])) "must return OK" in { val application = applicationBuilder(None) - .overrides(bind[CacheConnector].toInstance(mockCacheConnector)) + .overrides(bind[UserAnswersConnector].toInstance(mockUserAnswersConnector)) .build() running(application) { diff --git a/test/controllers/actions/DataRetrievalActionSpec.scala b/test/controllers/actions/DataRetrievalActionSpec.scala index 7c4e720e..3cfb3461 100644 --- a/test/controllers/actions/DataRetrievalActionSpec.scala +++ b/test/controllers/actions/DataRetrievalActionSpec.scala @@ -18,7 +18,7 @@ package controllers.actions import base.SpecBase import config.Constants.periodKeySessionKey -import connectors.CacheConnector +import connectors.UserAnswersConnector import models.requests.{IdentifierRequest, OptionalDataRequest} import org.mockito.ArgumentMatchers.any import org.mockito.ArgumentMatchersSugar.eqTo @@ -30,23 +30,24 @@ import uk.gov.hmrc.http.UpstreamErrorResponse import scala.concurrent.Future class DataRetrievalActionSpec extends SpecBase { - class Harness(cacheConnector: CacheConnector) extends DataRetrievalActionImpl(cacheConnector) { + + class Harness(userAnswersConnector: UserAnswersConnector) extends DataRetrievalActionImpl(userAnswersConnector) { def actionRefine[A](request: IdentifierRequest[A]): Future[Either[Result, OptionalDataRequest[A]]] = refine(request) } "Data Retrieval Action" - { - "when there is no data in the cache" - { + "when there is no data in the user answers" - { "must set userAnswers to 'None' in the request" in { val mockUpstreamErrorResponse = mock[UpstreamErrorResponse] when(mockUpstreamErrorResponse.statusCode).thenReturn(NOT_FOUND) - val cacheConnector = mock[CacheConnector] - when(cacheConnector.get(eqTo(appaId), eqTo(periodKey))(any())) thenReturn Future( + val userAnswersConnector = mock[UserAnswersConnector] + when(userAnswersConnector.get(eqTo(appaId), eqTo(periodKey))(any())) thenReturn Future( Left(mockUpstreamErrorResponse) ) - val action = new Harness(cacheConnector) + val action = new Harness(userAnswersConnector) val result = action.actionRefine(IdentifierRequest(FakeRequest(), appaId, groupId, internalId)).futureValue @@ -57,13 +58,13 @@ class DataRetrievalActionSpec extends SpecBase { } } - "when there is data in the cache" - { + "when there is data in the user answers" - { "must build a userAnswers object and add it to the request" in { - val cacheConnector = mock[CacheConnector] - when(cacheConnector.get(eqTo(appaId), eqTo(periodKey))(any)) thenReturn Future(Right(emptyUserAnswers)) - val action = new Harness(cacheConnector) + val userAnswersConnector = mock[UserAnswersConnector] + when(userAnswersConnector.get(eqTo(appaId), eqTo(periodKey))(any)) thenReturn Future(Right(emptyUserAnswers)) + val action = new Harness(userAnswersConnector) val result = action @@ -85,9 +86,9 @@ class DataRetrievalActionSpec extends SpecBase { "must set userAnswers to 'None' if the session does not contain the period Key" in { - val cacheConnector = mock[CacheConnector] - when(cacheConnector.get(eqTo(appaId), eqTo(periodKey))(any)) thenReturn Future(Right(emptyUserAnswers)) - val action = new Harness(cacheConnector) + val userAnswersConnector = mock[UserAnswersConnector] + when(userAnswersConnector.get(eqTo(appaId), eqTo(periodKey))(any)) thenReturn Future(Right(emptyUserAnswers)) + val action = new Harness(userAnswersConnector) val result = action @@ -108,18 +109,18 @@ class DataRetrievalActionSpec extends SpecBase { } } - "when the Cache Connector return an error" - { + "when the User Answer Connector return an error" - { "must redirect to the Return Locked controller if the error status is Locked" in { val mockUpstreamErrorResponse = mock[UpstreamErrorResponse] when(mockUpstreamErrorResponse.statusCode).thenReturn(LOCKED) - val cacheConnector = mock[CacheConnector] - when(cacheConnector.get(eqTo(appaId), eqTo(periodKey))(any())) thenReturn Future( + val userAnswersConnector = mock[UserAnswersConnector] + when(userAnswersConnector.get(eqTo(appaId), eqTo(periodKey))(any())) thenReturn Future( Left(mockUpstreamErrorResponse) ) - val action = new Harness(cacheConnector) + val action = new Harness(userAnswersConnector) val result = action.actionRefine(IdentifierRequest(FakeRequest(), appaId, groupId, internalId)) @@ -136,11 +137,11 @@ class DataRetrievalActionSpec extends SpecBase { val mockUpstreamErrorResponse = mock[UpstreamErrorResponse] when(mockUpstreamErrorResponse.statusCode).thenReturn(BAD_REQUEST) - val cacheConnector = mock[CacheConnector] - when(cacheConnector.get(eqTo(appaId), eqTo(periodKey))(any())) thenReturn Future( + val userAnswersConnector = mock[UserAnswersConnector] + when(userAnswersConnector.get(eqTo(appaId), eqTo(periodKey))(any())) thenReturn Future( Left(mockUpstreamErrorResponse) ) - val action = new Harness(cacheConnector) + val action = new Harness(userAnswersConnector) val result = action.actionRefine(IdentifierRequest(FakeRequest(), appaId, groupId, internalId)) diff --git a/test/controllers/adjustment/AdjustmentDutyDueControllerSpec.scala b/test/controllers/adjustment/AdjustmentDutyDueControllerSpec.scala index be3bb2f4..851d9c24 100644 --- a/test/controllers/adjustment/AdjustmentDutyDueControllerSpec.scala +++ b/test/controllers/adjustment/AdjustmentDutyDueControllerSpec.scala @@ -18,7 +18,7 @@ package controllers.adjustment import base.SpecBase import cats.data.NonEmptySeq -import connectors.CacheConnector +import connectors.UserAnswersConnector import models.AlcoholRegime.Beer import play.api.test.Helpers._ import uk.gov.hmrc.http.HttpResponse @@ -84,8 +84,8 @@ class AdjustmentDutyDueControllerSpec extends SpecBase { period = Some(YearMonth.of(24, 1)) ) - val mockCacheConnector = mock[CacheConnector] - when(mockCacheConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) + val mockUserAnswersConnector = mock[UserAnswersConnector] + when(mockUserAnswersConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) "must return OK and the correct view for a GET" in { @@ -95,7 +95,7 @@ class AdjustmentDutyDueControllerSpec extends SpecBase { val application = applicationBuilder(userAnswers = Some(emptyUserAnswers)) .overrides( bind[AdjustmentEntryService].toInstance(adjustmentEntryService), - bind[CacheConnector].toInstance(mockCacheConnector) + bind[UserAnswersConnector].toInstance(mockUserAnswersConnector) ) .build() @@ -132,7 +132,7 @@ class AdjustmentDutyDueControllerSpec extends SpecBase { val application = applicationBuilder(userAnswers = Some(emptyUserAnswers)) .overrides( bind[AdjustmentEntryService].toInstance(adjustmentEntryService), - bind[CacheConnector].toInstance(mockCacheConnector) + bind[UserAnswersConnector].toInstance(mockUserAnswersConnector) ) .build() @@ -193,7 +193,7 @@ class AdjustmentDutyDueControllerSpec extends SpecBase { applicationBuilder(userAnswers = Some(emptyUserAnswers)) .overrides( bind[AdjustmentEntryService].toInstance(adjustmentEntryService), - bind[CacheConnector].toInstance(mockCacheConnector) + bind[UserAnswersConnector].toInstance(mockUserAnswersConnector) ) .build() diff --git a/test/controllers/adjustment/AdjustmentListControllerSpec.scala b/test/controllers/adjustment/AdjustmentListControllerSpec.scala index aea227c8..d00e8cb7 100644 --- a/test/controllers/adjustment/AdjustmentListControllerSpec.scala +++ b/test/controllers/adjustment/AdjustmentListControllerSpec.scala @@ -26,7 +26,7 @@ import pages.adjustment.{AdjustmentEntryListPage, AdjustmentListPage, Adjustment import play.api.inject.bind import play.api.mvc.Call import play.api.test.Helpers._ -import connectors.{AlcoholDutyCalculatorConnector, CacheConnector} +import connectors.{AlcoholDutyCalculatorConnector, UserAnswersConnector} import models.AlcoholRegime.Beer import models.adjustment.{AdjustmentDuty, AdjustmentEntry} import models.adjustment.AdjustmentType.Spoilt @@ -89,8 +89,8 @@ class AdjustmentListControllerSpec extends SpecBase { "AdjustmentList Controller" - { "must return OK and the correct view for a GET" in { - val mockCacheConnector = mock[CacheConnector] - when(mockCacheConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) + val mockUserAnswersConnector = mock[UserAnswersConnector] + when(mockUserAnswersConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) val mockAlcoholDutyCalculatorConnector = mock[AlcoholDutyCalculatorConnector] when(mockAlcoholDutyCalculatorConnector.calculateTotalAdjustment(any())(any())) thenReturn Future.successful( AdjustmentDuty(total) @@ -98,7 +98,7 @@ class AdjustmentListControllerSpec extends SpecBase { val application = applicationBuilder(userAnswers = Some(userAnswsers)) .overrides( bind[AlcoholDutyCalculatorConnector].toInstance(mockAlcoholDutyCalculatorConnector), - bind[CacheConnector].toInstance(mockCacheConnector) + bind[UserAnswersConnector].toInstance(mockUserAnswersConnector) ) .build() @@ -123,8 +123,8 @@ class AdjustmentListControllerSpec extends SpecBase { } "must populate the view correctly on a GET when the question has previously been answered" in { - val mockCacheConnector = mock[CacheConnector] - when(mockCacheConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) + val mockUserAnswersConnector = mock[UserAnswersConnector] + when(mockUserAnswersConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) val updatedUserAnswers = userAnswsers.set(AdjustmentListPage, true).success.value.set(AdjustmentTotalPage, total).success.value val mockAlcoholDutyCalculatorConnector = mock[AlcoholDutyCalculatorConnector] @@ -134,7 +134,7 @@ class AdjustmentListControllerSpec extends SpecBase { val application = applicationBuilder(userAnswers = Some(updatedUserAnswers)) .overrides( bind[AlcoholDutyCalculatorConnector].toInstance(mockAlcoholDutyCalculatorConnector), - bind[CacheConnector].toInstance(mockCacheConnector) + bind[UserAnswersConnector].toInstance(mockUserAnswersConnector) ) .build() @@ -160,15 +160,15 @@ class AdjustmentListControllerSpec extends SpecBase { "must redirect to the next page when valid data is submitted" in { - val mockCacheConnector = mock[CacheConnector] + val mockUserAnswersConnector = mock[UserAnswersConnector] - when(mockCacheConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) + when(mockUserAnswersConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) val application = applicationBuilder(userAnswers = Some(emptyUserAnswers)) .overrides( bind[AdjustmentNavigator].toInstance(new FakeAdjustmentNavigator(onwardRoute, hasValueChanged = true)), - bind[CacheConnector].toInstance(mockCacheConnector) + bind[UserAnswersConnector].toInstance(mockUserAnswersConnector) ) .build() @@ -243,8 +243,8 @@ class AdjustmentListControllerSpec extends SpecBase { } "must redirect to first page of AdjustmentList for a GET if a pageNumber is out of bounds" in { - val mockCacheConnector = mock[CacheConnector] - when(mockCacheConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) + val mockUserAnswersConnector = mock[UserAnswersConnector] + when(mockUserAnswersConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) val mockAlcoholDutyCalculatorConnector = mock[AlcoholDutyCalculatorConnector] when(mockAlcoholDutyCalculatorConnector.calculateTotalAdjustment(any())(any())) thenReturn Future.successful( @@ -254,7 +254,7 @@ class AdjustmentListControllerSpec extends SpecBase { val application = applicationBuilder(userAnswers = Some(userAnswsers)) .overrides( bind[AlcoholDutyCalculatorConnector].toInstance(mockAlcoholDutyCalculatorConnector), - bind[CacheConnector].toInstance(mockCacheConnector) + bind[UserAnswersConnector].toInstance(mockUserAnswersConnector) ) .build() @@ -273,9 +273,9 @@ class AdjustmentListControllerSpec extends SpecBase { } "must redirect to Journey Recovery if calculator call fails" in { - val mockCacheConnector = mock[CacheConnector] + val mockUserAnswersConnector = mock[UserAnswersConnector] - when(mockCacheConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) + when(mockUserAnswersConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) val mockAlcoholDutyCalculatorConnector = mock[AlcoholDutyCalculatorConnector] @@ -286,7 +286,7 @@ class AdjustmentListControllerSpec extends SpecBase { val application = applicationBuilder(userAnswers = Some(userAnswsers)) .overrides( bind[AlcoholDutyCalculatorConnector].toInstance(mockAlcoholDutyCalculatorConnector), - bind[CacheConnector].toInstance(mockCacheConnector) + bind[UserAnswersConnector].toInstance(mockUserAnswersConnector) ) .build() diff --git a/test/controllers/adjustment/AdjustmentRepackagedTaxTypeControllerSpec.scala b/test/controllers/adjustment/AdjustmentRepackagedTaxTypeControllerSpec.scala index a13bdc73..09fbf143 100644 --- a/test/controllers/adjustment/AdjustmentRepackagedTaxTypeControllerSpec.scala +++ b/test/controllers/adjustment/AdjustmentRepackagedTaxTypeControllerSpec.scala @@ -26,7 +26,7 @@ import pages.adjustment.CurrentAdjustmentEntryPage import play.api.inject.bind import play.api.mvc.Call import play.api.test.Helpers._ -import connectors.{AlcoholDutyCalculatorConnector, CacheConnector} +import connectors.{AlcoholDutyCalculatorConnector, UserAnswersConnector} import models.adjustment.AdjustmentEntry import models.adjustment.AdjustmentType.Spoilt import uk.gov.hmrc.http.HttpResponse @@ -114,16 +114,16 @@ class AdjustmentRepackagedTaxTypeControllerSpec extends SpecBase { Some(rateBand) ) - val mockCacheConnector = mock[CacheConnector] + val mockUserAnswersConnector = mock[UserAnswersConnector] - when(mockCacheConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) + when(mockUserAnswersConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) val application = applicationBuilder(userAnswers = Some(userAnswers)) .overrides( bind[AdjustmentNavigator].toInstance(new FakeAdjustmentNavigator(onwardRoute, hasValueChanged = true)), bind[AlcoholDutyCalculatorConnector].toInstance(mockAlcoholDutyCalculatorConnector), - bind[CacheConnector].toInstance(mockCacheConnector) + bind[UserAnswersConnector].toInstance(mockUserAnswersConnector) ) .build() @@ -157,16 +157,16 @@ class AdjustmentRepackagedTaxTypeControllerSpec extends SpecBase { .success .value - val mockCacheConnector = mock[CacheConnector] + val mockUserAnswersConnector = mock[UserAnswersConnector] - when(mockCacheConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) + when(mockUserAnswersConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) val application = applicationBuilder(userAnswers = Some(userAnswers)) .overrides( bind[AdjustmentNavigator].toInstance(new FakeAdjustmentNavigator(onwardRoute, hasValueChanged = false)), bind[AlcoholDutyCalculatorConnector].toInstance(mockAlcoholDutyCalculatorConnector), - bind[CacheConnector].toInstance(mockCacheConnector) + bind[UserAnswersConnector].toInstance(mockUserAnswersConnector) ) .build() @@ -186,15 +186,15 @@ class AdjustmentRepackagedTaxTypeControllerSpec extends SpecBase { when(mockAlcoholDutyCalculatorConnector.rateBand(any(), any())(any())) thenReturn Future.successful( None ) - val mockCacheConnector = mock[CacheConnector] + val mockUserAnswersConnector = mock[UserAnswersConnector] - when(mockCacheConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) + when(mockUserAnswersConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) val application = applicationBuilder(userAnswers = Some(userAnswers)) .overrides( bind[AdjustmentNavigator].toInstance(new FakeAdjustmentNavigator(onwardRoute, hasValueChanged = true)), bind[AlcoholDutyCalculatorConnector].toInstance(mockAlcoholDutyCalculatorConnector), - bind[CacheConnector].toInstance(mockCacheConnector) + bind[UserAnswersConnector].toInstance(mockUserAnswersConnector) ) .build() @@ -245,12 +245,12 @@ class AdjustmentRepackagedTaxTypeControllerSpec extends SpecBase { } } "must handle non-draught rate band response error" in { - val mockCacheConnector = mock[CacheConnector] - val application = applicationBuilder(userAnswers = Some(userAnswers)) + val mockUserAnswersConnector = mock[UserAnswersConnector] + val application = applicationBuilder(userAnswers = Some(userAnswers)) .overrides( bind[AdjustmentNavigator].toInstance(new FakeAdjustmentNavigator(onwardRoute, hasValueChanged = true)), bind[AlcoholDutyCalculatorConnector].toInstance(mockAlcoholDutyCalculatorConnector), - bind[CacheConnector].toInstance(mockCacheConnector) + bind[UserAnswersConnector].toInstance(mockUserAnswersConnector) ) .build() running(application) { @@ -265,12 +265,12 @@ class AdjustmentRepackagedTaxTypeControllerSpec extends SpecBase { } "must handle invalid rate band response error" in { - val mockCacheConnector = mock[CacheConnector] - val application = applicationBuilder(userAnswers = Some(userAnswers)) + val mockUserAnswersConnector = mock[UserAnswersConnector] + val application = applicationBuilder(userAnswers = Some(userAnswers)) .overrides( bind[AdjustmentNavigator].toInstance(new FakeAdjustmentNavigator(onwardRoute, hasValueChanged = true)), bind[AlcoholDutyCalculatorConnector].toInstance(mockAlcoholDutyCalculatorConnector), - bind[CacheConnector].toInstance(mockCacheConnector) + bind[UserAnswersConnector].toInstance(mockUserAnswersConnector) ) .build() running(application) { @@ -282,17 +282,17 @@ class AdjustmentRepackagedTaxTypeControllerSpec extends SpecBase { } } - "must update cache and redirect on valid rate band response" in { - val mockCacheConnector = mock[CacheConnector] + "must update user answers and redirect on valid rate band response" in { + val mockUserAnswersConnector = mock[UserAnswersConnector] when(mockAlcoholDutyCalculatorConnector.rateBand(any(), any())(any())) thenReturn Future.successful( Some(rateBand) ) - when(mockCacheConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) - val application = applicationBuilder(userAnswers = Some(userAnswers)) + when(mockUserAnswersConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) + val application = applicationBuilder(userAnswers = Some(userAnswers)) .overrides( bind[AdjustmentNavigator].toInstance(new FakeAdjustmentNavigator(onwardRoute, hasValueChanged = true)), bind[AlcoholDutyCalculatorConnector].toInstance(mockAlcoholDutyCalculatorConnector), - bind[CacheConnector].toInstance(mockCacheConnector) + bind[UserAnswersConnector].toInstance(mockUserAnswersConnector) ) .build() running(application) { @@ -306,15 +306,15 @@ class AdjustmentRepackagedTaxTypeControllerSpec extends SpecBase { "must redirect to Journey Recovery currentAdjustmentEntry returns None" in { when(mockAlcoholDutyCalculatorConnector.rateBand(any(), any())(any())) thenReturn Future.successful(None) - val mockCacheConnector = mock[CacheConnector] - when(mockCacheConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) + val mockUserAnswersConnector = mock[UserAnswersConnector] + when(mockUserAnswersConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) val application = applicationBuilder(userAnswers = Some(emptyUserAnswers)) .overrides( bind[AdjustmentNavigator].toInstance(new FakeAdjustmentNavigator(onwardRoute, hasValueChanged = true)), bind[AlcoholDutyCalculatorConnector].toInstance(mockAlcoholDutyCalculatorConnector), - bind[CacheConnector].toInstance(mockCacheConnector) + bind[UserAnswersConnector].toInstance(mockUserAnswersConnector) ) .build() running(application) { @@ -330,15 +330,15 @@ class AdjustmentRepackagedTaxTypeControllerSpec extends SpecBase { } "must redirect to Journey Recovery when adjustment period is missing" in { - val adjustmentEntry = AdjustmentEntry(adjustmentType = Some(Spoilt)) - val userAnswers = emptyUserAnswers.set(CurrentAdjustmentEntryPage, adjustmentEntry).success.value - val mockCacheConnector = mock[CacheConnector] - val application = + val adjustmentEntry = AdjustmentEntry(adjustmentType = Some(Spoilt)) + val userAnswers = emptyUserAnswers.set(CurrentAdjustmentEntryPage, adjustmentEntry).success.value + val mockUserAnswersConnector = mock[UserAnswersConnector] + val application = applicationBuilder(userAnswers = Some(userAnswers)) .overrides( bind[AdjustmentNavigator].toInstance(new FakeAdjustmentNavigator(onwardRoute, hasValueChanged = true)), bind[AlcoholDutyCalculatorConnector].toInstance(mockAlcoholDutyCalculatorConnector), - bind[CacheConnector].toInstance(mockCacheConnector) + bind[UserAnswersConnector].toInstance(mockUserAnswersConnector) ) .build() running(application) { diff --git a/test/controllers/adjustment/AdjustmentSmallProducerReliefDutyRateControllerSpec.scala b/test/controllers/adjustment/AdjustmentSmallProducerReliefDutyRateControllerSpec.scala index 3187d0c7..b0cce0d6 100644 --- a/test/controllers/adjustment/AdjustmentSmallProducerReliefDutyRateControllerSpec.scala +++ b/test/controllers/adjustment/AdjustmentSmallProducerReliefDutyRateControllerSpec.scala @@ -26,7 +26,7 @@ import pages.adjustment.CurrentAdjustmentEntryPage import play.api.inject.bind import play.api.mvc.Call import play.api.test.Helpers._ -import connectors.CacheConnector +import connectors.UserAnswersConnector import models.AlcoholRegime.Beer import models.adjustment.AdjustmentEntry import models.adjustment.AdjustmentType.Spoilt @@ -110,15 +110,15 @@ class AdjustmentSmallProducerReliefDutyRateControllerSpec extends SpecBase { "must redirect to the next page when valid data is submitted" in { - val mockCacheConnector = mock[CacheConnector] + val mockUserAnswersConnector = mock[UserAnswersConnector] - when(mockCacheConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) + when(mockUserAnswersConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) val application = applicationBuilder(userAnswers = Some(emptyUserAnswers)) .overrides( bind[AdjustmentNavigator].toInstance(new FakeAdjustmentNavigator(onwardRoute, hasValueChanged = true)), - bind[CacheConnector].toInstance(mockCacheConnector) + bind[UserAnswersConnector].toInstance(mockUserAnswersConnector) ) .build() @@ -147,15 +147,15 @@ class AdjustmentSmallProducerReliefDutyRateControllerSpec extends SpecBase { .success .value - val mockCacheConnector = mock[CacheConnector] + val mockUserAnswersConnector = mock[UserAnswersConnector] - when(mockCacheConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) + when(mockUserAnswersConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) val application = applicationBuilder(userAnswers = Some(userAnswers)) .overrides( bind[AdjustmentNavigator].toInstance(new FakeAdjustmentNavigator(onwardRoute, hasValueChanged = false)), - bind[CacheConnector].toInstance(mockCacheConnector) + bind[UserAnswersConnector].toInstance(mockUserAnswersConnector) ) .build() diff --git a/test/controllers/adjustment/AdjustmentTaxTypeControllerSpec.scala b/test/controllers/adjustment/AdjustmentTaxTypeControllerSpec.scala index 26934b0f..a9082f61 100644 --- a/test/controllers/adjustment/AdjustmentTaxTypeControllerSpec.scala +++ b/test/controllers/adjustment/AdjustmentTaxTypeControllerSpec.scala @@ -26,7 +26,7 @@ import pages.adjustment.CurrentAdjustmentEntryPage import play.api.inject.bind import play.api.mvc.Call import play.api.test.Helpers._ -import connectors.{AlcoholDutyCalculatorConnector, CacheConnector} +import connectors.{AlcoholDutyCalculatorConnector, UserAnswersConnector} import models.RateType.Core import models.adjustment.AdjustmentType.{RepackagedDraughtProducts, Spoilt} import models.adjustment.AdjustmentEntry @@ -55,7 +55,7 @@ class AdjustmentTaxTypeControllerSpec extends SpecBase { val alcoholRegime = AlcoholRegime.Beer val rate = Some(BigDecimal(10.99)) - val rateBand = RateBand( + val rateBand = RateBand( taxCode, "some band", RateType.DraughtRelief, @@ -73,8 +73,8 @@ class AdjustmentTaxTypeControllerSpec extends SpecBase { ) ) ) - val application = applicationBuilder(userAnswers = Some(userAnswers)).build() - val mockCacheConnector = mock[CacheConnector] + val application = applicationBuilder(userAnswers = Some(userAnswers)).build() + val mockUserAnswersConnector = mock[UserAnswersConnector] "AdjustmentTaxType Controller" - { @@ -113,14 +113,14 @@ class AdjustmentTaxTypeControllerSpec extends SpecBase { Some(rateBand) ) - when(mockCacheConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) + when(mockUserAnswersConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) val application = applicationBuilder(userAnswers = Some(userAnswers)) .overrides( bind[AdjustmentNavigator].toInstance(new FakeAdjustmentNavigator(onwardRoute, hasValueChanged = true)), bind[AlcoholDutyCalculatorConnector].toInstance(mockAlcoholDutyCalculatorConnector), - bind[CacheConnector].toInstance(mockCacheConnector) + bind[UserAnswersConnector].toInstance(mockUserAnswersConnector) ) .build() @@ -149,14 +149,14 @@ class AdjustmentTaxTypeControllerSpec extends SpecBase { .success .value - when(mockCacheConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) + when(mockUserAnswersConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) val application = applicationBuilder(userAnswers = Some(newUserAnswers)) .overrides( bind[AdjustmentNavigator].toInstance(new FakeAdjustmentNavigator(onwardRoute, hasValueChanged = false)), bind[AlcoholDutyCalculatorConnector].toInstance(mockAlcoholDutyCalculatorConnector), - bind[CacheConnector].toInstance(mockCacheConnector) + bind[UserAnswersConnector].toInstance(mockUserAnswersConnector) ) .build() @@ -177,14 +177,14 @@ class AdjustmentTaxTypeControllerSpec extends SpecBase { Some(rateBand) ) - when(mockCacheConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) + when(mockUserAnswersConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) val application = applicationBuilder(userAnswers = Some(userAnswers)) .overrides( bind[AdjustmentNavigator].toInstance(new FakeAdjustmentNavigator(onwardRoute, hasValueChanged = true)), bind[AlcoholDutyCalculatorConnector].toInstance(mockAlcoholDutyCalculatorConnector), - bind[CacheConnector].toInstance(mockCacheConnector) + bind[UserAnswersConnector].toInstance(mockUserAnswersConnector) ) .build() running(application) { @@ -206,14 +206,14 @@ class AdjustmentTaxTypeControllerSpec extends SpecBase { None ) - when(mockCacheConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) + when(mockUserAnswersConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) val application = applicationBuilder(userAnswers = Some(userAnswers)) .overrides( bind[AdjustmentNavigator].toInstance(new FakeAdjustmentNavigator(onwardRoute, hasValueChanged = false)), bind[AlcoholDutyCalculatorConnector].toInstance(mockAlcoholDutyCalculatorConnector), - bind[CacheConnector].toInstance(mockCacheConnector) + bind[UserAnswersConnector].toInstance(mockUserAnswersConnector) ) .build() running(application) { @@ -240,7 +240,7 @@ class AdjustmentTaxTypeControllerSpec extends SpecBase { Some(coreRateBand) ) - when(mockCacheConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) + when(mockUserAnswersConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) val adjustmentEntry = AdjustmentEntry( adjustmentType = Some(RepackagedDraughtProducts), @@ -254,7 +254,7 @@ class AdjustmentTaxTypeControllerSpec extends SpecBase { .overrides( bind[AdjustmentNavigator].toInstance(new FakeAdjustmentNavigator(onwardRoute, hasValueChanged = false)), bind[AlcoholDutyCalculatorConnector].toInstance(mockAlcoholDutyCalculatorConnector), - bind[CacheConnector].toInstance(mockCacheConnector) + bind[UserAnswersConnector].toInstance(mockUserAnswersConnector) ) .build() running(application) { @@ -308,14 +308,14 @@ class AdjustmentTaxTypeControllerSpec extends SpecBase { "must redirect to Journey Recovery currentAdjustmentEntry returns None" in { when(mockAlcoholDutyCalculatorConnector.rateBand(any(), any())(any())) thenReturn Future.successful(None) - when(mockCacheConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) + when(mockUserAnswersConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) val application = applicationBuilder(userAnswers = Some(emptyUserAnswers)) .overrides( bind[AdjustmentNavigator].toInstance(new FakeAdjustmentNavigator(onwardRoute, hasValueChanged = true)), bind[AlcoholDutyCalculatorConnector].toInstance(mockAlcoholDutyCalculatorConnector), - bind[CacheConnector].toInstance(mockCacheConnector) + bind[UserAnswersConnector].toInstance(mockUserAnswersConnector) ) .build() running(application) { @@ -338,7 +338,7 @@ class AdjustmentTaxTypeControllerSpec extends SpecBase { .overrides( bind[AdjustmentNavigator].toInstance(new FakeAdjustmentNavigator(onwardRoute, hasValueChanged = true)), bind[AlcoholDutyCalculatorConnector].toInstance(mockAlcoholDutyCalculatorConnector), - bind[CacheConnector].toInstance(mockCacheConnector) + bind[UserAnswersConnector].toInstance(mockUserAnswersConnector) ) .build() running(application) { diff --git a/test/controllers/adjustment/AdjustmentTypeControllerSpec.scala b/test/controllers/adjustment/AdjustmentTypeControllerSpec.scala index 524cebe1..1496a0e1 100644 --- a/test/controllers/adjustment/AdjustmentTypeControllerSpec.scala +++ b/test/controllers/adjustment/AdjustmentTypeControllerSpec.scala @@ -26,7 +26,7 @@ import pages.adjustment.CurrentAdjustmentEntryPage import play.api.inject.bind import play.api.mvc.Call import play.api.test.Helpers._ -import connectors.CacheConnector +import connectors.UserAnswersConnector import models.AlcoholRegime.Beer import models.adjustment.AdjustmentType.Spoilt import uk.gov.hmrc.http.HttpResponse @@ -88,15 +88,15 @@ class AdjustmentTypeControllerSpec extends SpecBase { "must redirect to the next page when valid data is submitted" in { - val mockCacheConnector = mock[CacheConnector] + val mockUserAnswersConnector = mock[UserAnswersConnector] - when(mockCacheConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) + when(mockUserAnswersConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) val application = applicationBuilder(userAnswers = Some(emptyUserAnswers)) .overrides( bind[AdjustmentNavigator].toInstance(new FakeAdjustmentNavigator(onwardRoute, hasValueChanged = true)), - bind[CacheConnector].toInstance(mockCacheConnector) + bind[UserAnswersConnector].toInstance(mockUserAnswersConnector) ) .build() @@ -124,15 +124,15 @@ class AdjustmentTypeControllerSpec extends SpecBase { .success .value - val mockCacheConnector = mock[CacheConnector] + val mockUserAnswersConnector = mock[UserAnswersConnector] - when(mockCacheConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) + when(mockUserAnswersConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) val application = applicationBuilder(userAnswers = Some(userAnswers)) .overrides( bind[AdjustmentNavigator].toInstance(new FakeAdjustmentNavigator(onwardRoute, hasValueChanged = false)), - bind[CacheConnector].toInstance(mockCacheConnector) + bind[UserAnswersConnector].toInstance(mockUserAnswersConnector) ) .build() @@ -161,15 +161,15 @@ class AdjustmentTypeControllerSpec extends SpecBase { .success .value - val mockCacheConnector = mock[CacheConnector] + val mockUserAnswersConnector = mock[UserAnswersConnector] - when(mockCacheConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) + when(mockUserAnswersConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) val application = applicationBuilder(userAnswers = Some(userAnswers)) .overrides( bind[AdjustmentNavigator].toInstance(new FakeAdjustmentNavigator(onwardRoute, false)), - bind[CacheConnector].toInstance(mockCacheConnector) + bind[UserAnswersConnector].toInstance(mockUserAnswersConnector) ) .build() @@ -189,15 +189,15 @@ class AdjustmentTypeControllerSpec extends SpecBase { val userAnswers = emptyUserAnswers.copy(regimes = AlcoholRegimes(Set(Beer))) - val mockCacheConnector = mock[CacheConnector] + val mockUserAnswersConnector = mock[UserAnswersConnector] - when(mockCacheConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) + when(mockUserAnswersConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) val application = applicationBuilder(userAnswers = Some(userAnswers)) .overrides( bind[AdjustmentNavigator].toInstance(new FakeAdjustmentNavigator(onwardRoute, true)), - bind[CacheConnector].toInstance(mockCacheConnector) + bind[UserAnswersConnector].toInstance(mockUserAnswersConnector) ) .build() diff --git a/test/controllers/adjustment/AdjustmentVolumeControllerSpec.scala b/test/controllers/adjustment/AdjustmentVolumeControllerSpec.scala index 7f17dea7..77b5ae23 100644 --- a/test/controllers/adjustment/AdjustmentVolumeControllerSpec.scala +++ b/test/controllers/adjustment/AdjustmentVolumeControllerSpec.scala @@ -26,7 +26,7 @@ import pages.adjustment.CurrentAdjustmentEntryPage import play.api.inject.bind import play.api.mvc.Call import play.api.test.Helpers._ -import connectors.CacheConnector +import connectors.UserAnswersConnector import models.AlcoholRegime.Beer import models.adjustment.{AdjustmentEntry, AdjustmentVolume} import models.adjustment.AdjustmentType.Underdeclaration @@ -155,15 +155,15 @@ class AdjustmentVolumeControllerSpec extends SpecBase { } "must redirect to the next page when valid data is submitted" in { - val mockCacheConnector = mock[CacheConnector] + val mockUserAnswersConnector = mock[UserAnswersConnector] - when(mockCacheConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) + when(mockUserAnswersConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) val application = applicationBuilder(userAnswers = Some(userAnswers)) .overrides( bind[AdjustmentNavigator].toInstance(new FakeAdjustmentNavigator(onwardRoute, hasValueChanged = true)), - bind[CacheConnector].toInstance(mockCacheConnector) + bind[UserAnswersConnector].toInstance(mockUserAnswersConnector) ) .build() @@ -198,15 +198,15 @@ class AdjustmentVolumeControllerSpec extends SpecBase { .success .value - val mockCacheConnector = mock[CacheConnector] + val mockUserAnswersConnector = mock[UserAnswersConnector] - when(mockCacheConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) + when(mockUserAnswersConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) val application = applicationBuilder(userAnswers = Some(userAnswers)) .overrides( bind[AdjustmentNavigator].toInstance(new FakeAdjustmentNavigator(onwardRoute, hasValueChanged = false)), - bind[CacheConnector].toInstance(mockCacheConnector) + bind[UserAnswersConnector].toInstance(mockUserAnswersConnector) ) .build() @@ -241,15 +241,15 @@ class AdjustmentVolumeControllerSpec extends SpecBase { .success .value - val mockCacheConnector = mock[CacheConnector] + val mockUserAnswersConnector = mock[UserAnswersConnector] - when(mockCacheConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) + when(mockUserAnswersConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) val application = applicationBuilder(userAnswers = Some(userAnswers)) .overrides( bind[AdjustmentNavigator].toInstance(new FakeAdjustmentNavigator(onwardRoute, hasValueChanged = false)), - bind[CacheConnector].toInstance(mockCacheConnector) + bind[UserAnswersConnector].toInstance(mockUserAnswersConnector) ) .build() diff --git a/test/controllers/adjustment/AdjustmentVolumeWithSPRControllerSpec.scala b/test/controllers/adjustment/AdjustmentVolumeWithSPRControllerSpec.scala index 9c169d22..89782efd 100644 --- a/test/controllers/adjustment/AdjustmentVolumeWithSPRControllerSpec.scala +++ b/test/controllers/adjustment/AdjustmentVolumeWithSPRControllerSpec.scala @@ -18,7 +18,7 @@ package controllers.adjustment import base.SpecBase import cats.data.NonEmptySeq -import connectors.CacheConnector +import connectors.UserAnswersConnector import forms.adjustment.AdjustmentVolumeWithSPRFormProvider import models.AlcoholRegime.Beer import models.adjustment.AdjustmentType.Spoilt @@ -159,15 +159,15 @@ class AdjustmentVolumeWithSPRControllerSpec extends SpecBase { } "must redirect to the next page when valid data is submitted" in { - val mockCacheConnector = mock[CacheConnector] + val mockUserAnswersConnector = mock[UserAnswersConnector] - when(mockCacheConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) + when(mockUserAnswersConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) val application = applicationBuilder(userAnswers = Some(userAnswers)) .overrides( bind[AdjustmentNavigator].toInstance(new FakeAdjustmentNavigator(onwardRoute, hasValueChanged = true)), - bind[CacheConnector].toInstance(mockCacheConnector) + bind[UserAnswersConnector].toInstance(mockUserAnswersConnector) ) .build() @@ -204,15 +204,15 @@ class AdjustmentVolumeWithSPRControllerSpec extends SpecBase { .success .value - val mockCacheConnector = mock[CacheConnector] + val mockUserAnswersConnector = mock[UserAnswersConnector] - when(mockCacheConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) + when(mockUserAnswersConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) val application = applicationBuilder(userAnswers = Some(userAnswers)) .overrides( bind[AdjustmentNavigator].toInstance(new FakeAdjustmentNavigator(onwardRoute, hasValueChanged = false)), - bind[CacheConnector].toInstance(mockCacheConnector) + bind[UserAnswersConnector].toInstance(mockUserAnswersConnector) ) .build() @@ -249,15 +249,15 @@ class AdjustmentVolumeWithSPRControllerSpec extends SpecBase { .success .value - val mockCacheConnector = mock[CacheConnector] + val mockUserAnswersConnector = mock[UserAnswersConnector] - when(mockCacheConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) + when(mockUserAnswersConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) val application = applicationBuilder(userAnswers = Some(userAnswers)) .overrides( bind[AdjustmentNavigator].toInstance(new FakeAdjustmentNavigator(onwardRoute, hasValueChanged = false)), - bind[CacheConnector].toInstance(mockCacheConnector) + bind[UserAnswersConnector].toInstance(mockUserAnswersConnector) ) .build() diff --git a/test/controllers/adjustment/AlcoholicProductTypeControllerSpec.scala b/test/controllers/adjustment/AlcoholicProductTypeControllerSpec.scala index 657369b4..751e336b 100644 --- a/test/controllers/adjustment/AlcoholicProductTypeControllerSpec.scala +++ b/test/controllers/adjustment/AlcoholicProductTypeControllerSpec.scala @@ -25,7 +25,7 @@ import pages.adjustment.CurrentAdjustmentEntryPage import play.api.inject.bind import play.api.mvc.Call import play.api.test.Helpers._ -import connectors.CacheConnector +import connectors.UserAnswersConnector import models.AlcoholRegime.{Beer, Cider, OtherFermentedProduct, Spirits, Wine} import models.adjustment.AdjustmentEntry import models.adjustment.AdjustmentType.Spoilt @@ -91,9 +91,9 @@ class AlcoholicProductTypeControllerSpec extends SpecBase { "must redirect to the next page when valid data is submitted" in { - val mockCacheConnector = mock[CacheConnector] + val mockUserAnswersConnector = mock[UserAnswersConnector] - when(mockCacheConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) + when(mockUserAnswersConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) val regimes = Seq( Beer.toString, Cider.toString, @@ -107,7 +107,7 @@ class AlcoholicProductTypeControllerSpec extends SpecBase { applicationBuilder(userAnswers = Some(emptyUserAnswers)) .overrides( bind[AdjustmentNavigator].toInstance(new FakeAdjustmentNavigator(onwardRoute, true)), - bind[CacheConnector].toInstance(mockCacheConnector) + bind[UserAnswersConnector].toInstance(mockUserAnswersConnector) ) .build() @@ -137,15 +137,15 @@ class AlcoholicProductTypeControllerSpec extends SpecBase { .success .value - val mockCacheConnector = mock[CacheConnector] + val mockUserAnswersConnector = mock[UserAnswersConnector] - when(mockCacheConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) + when(mockUserAnswersConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) val application = applicationBuilder(userAnswers = Some(userAnswers)) .overrides( bind[AdjustmentNavigator].toInstance(new FakeAdjustmentNavigator(onwardRoute, hasValueChanged = false)), - bind[CacheConnector].toInstance(mockCacheConnector) + bind[UserAnswersConnector].toInstance(mockUserAnswersConnector) ) .build() @@ -216,14 +216,14 @@ class AlcoholicProductTypeControllerSpec extends SpecBase { } "must redirect to Journey Recovery for a POST if an invalid regime is submitted" in { - val userAnswers = + val userAnswers = emptyUserAnswers.set(CurrentAdjustmentEntryPage, AdjustmentEntry(spoiltRegime = Some(Beer))).success.value - val mockCacheConnector = mock[CacheConnector] - when(mockCacheConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) - val application = applicationBuilder(userAnswers = Some(userAnswers)) + val mockUserAnswersConnector = mock[UserAnswersConnector] + when(mockUserAnswersConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) + val application = applicationBuilder(userAnswers = Some(userAnswers)) .overrides( bind[AdjustmentNavigator].toInstance(new FakeAdjustmentNavigator(onwardRoute, hasValueChanged = false)), - bind[CacheConnector].toInstance(mockCacheConnector) + bind[UserAnswersConnector].toInstance(mockUserAnswersConnector) ) .build() running(application) { diff --git a/test/controllers/adjustment/CheckYourAnswersControllerSpec.scala b/test/controllers/adjustment/CheckYourAnswersControllerSpec.scala index b599545c..1cd06175 100644 --- a/test/controllers/adjustment/CheckYourAnswersControllerSpec.scala +++ b/test/controllers/adjustment/CheckYourAnswersControllerSpec.scala @@ -18,7 +18,7 @@ package controllers.adjustment import base.SpecBase import cats.data.NonEmptySeq -import connectors.CacheConnector +import connectors.UserAnswersConnector import generators.ModelGenerators import models.AlcoholRegime.Beer import models.adjustment.AdjustmentEntry @@ -113,9 +113,9 @@ class CheckYourAnswersControllerSpec extends SpecBase with ModelGenerators { "CheckYourAnswers Controller" - { "must return OK and the correct view for a GET if all necessary questions are answered" in { - val mockCacheConnector = mock[CacheConnector] + val mockUserAnswersConnector = mock[UserAnswersConnector] - when(mockCacheConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) + when(mockUserAnswersConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) val userAnswers1 = emptyUserAnswers .set(CurrentAdjustmentEntryPage, repackagedAdjustmentEntry) @@ -147,7 +147,7 @@ class CheckYourAnswersControllerSpec extends SpecBase with ModelGenerators { completeUserAnswersList.foreach { (completeUserAnswers: UserAnswers) => val application = applicationBuilder(Some(completeUserAnswers)) .overrides( - bind[CacheConnector].toInstance(mockCacheConnector) + bind[UserAnswersConnector].toInstance(mockUserAnswersConnector) ) .build() @@ -170,15 +170,15 @@ class CheckYourAnswersControllerSpec extends SpecBase with ModelGenerators { } } - "must return OK and load the saved adjustment entry from the cache if index is defined" in { + "must return OK and load the saved adjustment entry from the user answers if index is defined" in { - val mockCacheConnector = mock[CacheConnector] + val mockUserAnswersConnector = mock[UserAnswersConnector] - when(mockCacheConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) + when(mockUserAnswersConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) val application = applicationBuilder(userAnswers = Some(completeAdjustmentEntryUserAnswers)) .overrides( - bind[CacheConnector].toInstance(mockCacheConnector) + bind[UserAnswersConnector].toInstance(mockUserAnswersConnector) ) .build() @@ -199,10 +199,10 @@ class CheckYourAnswersControllerSpec extends SpecBase with ModelGenerators { } } - "must return OK and load the saved adjustment entry from the cache if index is defined inside the current adjustment entry" in { - val mockCacheConnector = mock[CacheConnector] + "must return OK and load the saved adjustment entry from the user answers if index is defined inside the current adjustment entry" in { + val mockUserAnswersConnector = mock[UserAnswersConnector] - when(mockCacheConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) + when(mockUserAnswersConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) val userAnswers = completeAdjustmentEntryUserAnswers @@ -212,7 +212,7 @@ class CheckYourAnswersControllerSpec extends SpecBase with ModelGenerators { val application = applicationBuilder(userAnswers = Some(userAnswers)) .overrides( - bind[CacheConnector].toInstance(mockCacheConnector) + bind[UserAnswersConnector].toInstance(mockUserAnswersConnector) ) .build() @@ -235,9 +235,9 @@ class CheckYourAnswersControllerSpec extends SpecBase with ModelGenerators { "must return OK and the correct view for a GET if any optional questions are not answered" in { - val mockCacheConnector = mock[CacheConnector] + val mockUserAnswersConnector = mock[UserAnswersConnector] - when(mockCacheConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) + when(mockUserAnswersConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) Seq( currentAdjustmentEntry.copy(repackagedRateBand = None), @@ -250,7 +250,7 @@ class CheckYourAnswersControllerSpec extends SpecBase with ModelGenerators { val application = applicationBuilder(userAnswers = Some(userAnswers)) .overrides( - bind[CacheConnector].toInstance(mockCacheConnector) + bind[UserAnswersConnector].toInstance(mockUserAnswersConnector) ) .build() @@ -273,9 +273,9 @@ class CheckYourAnswersControllerSpec extends SpecBase with ModelGenerators { "must return OK and the correct view for a GET if all necessary questions are answered, the TaxType contains a rate and SPR duty relief is absent" in { - val mockCacheConnector = mock[CacheConnector] + val mockUserAnswersConnector = mock[UserAnswersConnector] - when(mockCacheConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) + when(mockUserAnswersConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) val adjustmentEntry = currentAdjustmentEntry.copy( sprDutyRate = None, @@ -289,7 +289,7 @@ class CheckYourAnswersControllerSpec extends SpecBase with ModelGenerators { val application = applicationBuilder(userAnswers = Some(userAnswers)) .overrides( - bind[CacheConnector].toInstance(mockCacheConnector) + bind[UserAnswersConnector].toInstance(mockUserAnswersConnector) ) .build() @@ -395,14 +395,14 @@ class CheckYourAnswersControllerSpec extends SpecBase with ModelGenerators { "must redirect to the next page when valid data is submitted" in { - val mockCacheConnector = mock[CacheConnector] + val mockUserAnswersConnector = mock[UserAnswersConnector] - when(mockCacheConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) + when(mockUserAnswersConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) val application = applicationBuilder(userAnswers = Some(completeAdjustmentEntryUserAnswers)) .overrides( - bind[CacheConnector].toInstance(mockCacheConnector) + bind[UserAnswersConnector].toInstance(mockUserAnswersConnector) ) .build() @@ -417,7 +417,7 @@ class CheckYourAnswersControllerSpec extends SpecBase with ModelGenerators { .onPageLoad(pageNumber) .url - verify(mockCacheConnector, times(1)).set(any())(any()) + verify(mockUserAnswersConnector, times(1)).set(any())(any()) } } @@ -429,14 +429,14 @@ class CheckYourAnswersControllerSpec extends SpecBase with ModelGenerators { .success .value - val mockCacheConnector = mock[CacheConnector] + val mockUserAnswersConnector = mock[UserAnswersConnector] - when(mockCacheConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) + when(mockUserAnswersConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) val application = applicationBuilder(userAnswers = Some(userAnswers)) .overrides( - bind[CacheConnector].toInstance(mockCacheConnector) + bind[UserAnswersConnector].toInstance(mockUserAnswersConnector) ) .build() @@ -451,15 +451,15 @@ class CheckYourAnswersControllerSpec extends SpecBase with ModelGenerators { .onPageLoad(pageNumber) .url - verify(mockCacheConnector, times(1)).set(any())(any()) + verify(mockUserAnswersConnector, times(1)).set(any())(any()) } } "must redirect to the Journey Recovery page when uncompleted data is submitted" in { - val mockCacheConnector = mock[CacheConnector] + val mockUserAnswersConnector = mock[UserAnswersConnector] - when(mockCacheConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) + when(mockUserAnswersConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) val incompleteAdjustmentEntryUserAnswers: UserAnswers = emptyUserAnswers .set(CurrentAdjustmentEntryPage, currentAdjustmentEntry.copy(adjustmentType = None)) @@ -469,7 +469,7 @@ class CheckYourAnswersControllerSpec extends SpecBase with ModelGenerators { val application = applicationBuilder(userAnswers = Some(incompleteAdjustmentEntryUserAnswers)) .overrides( - bind[CacheConnector].toInstance(mockCacheConnector) + bind[UserAnswersConnector].toInstance(mockUserAnswersConnector) ) .build() @@ -482,20 +482,20 @@ class CheckYourAnswersControllerSpec extends SpecBase with ModelGenerators { status(result) mustEqual SEE_OTHER redirectLocation(result).value mustEqual controllers.routes.JourneyRecoveryController.onPageLoad().url - verify(mockCacheConnector, times(0)).set(any())(any()) + verify(mockUserAnswersConnector, times(0)).set(any())(any()) } } "must redirect to the Journey Recovery page when adjustment entry is absent" in { - val mockCacheConnector = mock[CacheConnector] + val mockUserAnswersConnector = mock[UserAnswersConnector] - when(mockCacheConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) + when(mockUserAnswersConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) val application = applicationBuilder(userAnswers = Some(emptyUserAnswers)) .overrides( - bind[CacheConnector].toInstance(mockCacheConnector) + bind[UserAnswersConnector].toInstance(mockUserAnswersConnector) ) .build() @@ -508,7 +508,7 @@ class CheckYourAnswersControllerSpec extends SpecBase with ModelGenerators { status(result) mustEqual SEE_OTHER redirectLocation(result).value mustEqual controllers.routes.JourneyRecoveryController.onPageLoad().url - verify(mockCacheConnector, times(0)).set(any())(any()) + verify(mockUserAnswersConnector, times(0)).set(any())(any()) } } diff --git a/test/controllers/adjustment/DeclareAdjustmentQuestionControllerSpec.scala b/test/controllers/adjustment/DeclareAdjustmentQuestionControllerSpec.scala index e18337eb..eddbcc25 100644 --- a/test/controllers/adjustment/DeclareAdjustmentQuestionControllerSpec.scala +++ b/test/controllers/adjustment/DeclareAdjustmentQuestionControllerSpec.scala @@ -25,7 +25,7 @@ import pages.adjustment.DeclareAdjustmentQuestionPage import play.api.inject.bind import play.api.mvc.Call import play.api.test.Helpers._ -import connectors.CacheConnector +import connectors.UserAnswersConnector import uk.gov.hmrc.http.HttpResponse import views.html.adjustment.DeclareAdjustmentQuestionView @@ -78,15 +78,15 @@ class DeclareAdjustmentQuestionControllerSpec extends SpecBase { "must redirect to the next page when valid data is submitted" in { - val mockCacheConnector = mock[CacheConnector] + val mockUserAnswersConnector = mock[UserAnswersConnector] - when(mockCacheConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) + when(mockUserAnswersConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) val application = applicationBuilder(userAnswers = Some(emptyUserAnswers)) .overrides( bind[AdjustmentNavigator].toInstance(new FakeAdjustmentNavigator(onwardRoute, hasValueChanged = true)), - bind[CacheConnector].toInstance(mockCacheConnector) + bind[UserAnswersConnector].toInstance(mockUserAnswersConnector) ) .build() @@ -104,15 +104,15 @@ class DeclareAdjustmentQuestionControllerSpec extends SpecBase { "must redirect to the Task list when valid question is answered as No" in { - val mockCacheConnector = mock[CacheConnector] + val mockUserAnswersConnector = mock[UserAnswersConnector] - when(mockCacheConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) + when(mockUserAnswersConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) val application = applicationBuilder(userAnswers = Some(emptyUserAnswers)) .overrides( bind[AdjustmentNavigator].toInstance(new FakeAdjustmentNavigator(onwardRoute, true)), - bind[CacheConnector].toInstance(mockCacheConnector) + bind[UserAnswersConnector].toInstance(mockUserAnswersConnector) ) .build() diff --git a/test/controllers/adjustment/DeleteAdjustmentControllerSpec.scala b/test/controllers/adjustment/DeleteAdjustmentControllerSpec.scala index 527c7a22..19ef8bb1 100644 --- a/test/controllers/adjustment/DeleteAdjustmentControllerSpec.scala +++ b/test/controllers/adjustment/DeleteAdjustmentControllerSpec.scala @@ -24,7 +24,7 @@ import pages.adjustment.{DeleteAdjustmentPage, OverDeclarationTotalPage, UnderDe import play.api.inject.bind import play.api.mvc.Call import play.api.test.Helpers._ -import connectors.CacheConnector +import connectors.UserAnswersConnector import uk.gov.hmrc.http.HttpResponse import viewmodels.checkAnswers.adjustment.AdjustmentOverUnderDeclarationCalculationHelper import views.html.adjustment.DeleteAdjustmentView @@ -77,15 +77,15 @@ class DeleteAdjustmentControllerSpec extends SpecBase { } "must redirect to the next page when valid data is submitted" in { - val mockCacheConnector = mock[CacheConnector] + val mockUserAnswersConnector = mock[UserAnswersConnector] - when(mockCacheConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) + when(mockUserAnswersConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) val application = applicationBuilder(userAnswers = Some(emptyUserAnswers)) .overrides( bind[AdjustmentNavigator].toInstance(new FakeAdjustmentNavigator(onwardRoute, hasValueChanged = true)), - bind[CacheConnector].toInstance(mockCacheConnector) + bind[UserAnswersConnector].toInstance(mockUserAnswersConnector) ) .build() @@ -101,7 +101,7 @@ class DeleteAdjustmentControllerSpec extends SpecBase { .onPageLoad(pageNumber) .url - verify(mockCacheConnector, times(1)).set(any())(any()) + verify(mockUserAnswersConnector, times(1)).set(any())(any()) } } @@ -130,18 +130,18 @@ class DeleteAdjustmentControllerSpec extends SpecBase { } "must not clear if total UnderDeclaration is above threshold" in { - val mockCacheConnector = mock[CacheConnector] - val mockHelper = mock[AdjustmentOverUnderDeclarationCalculationHelper] + val mockUserAnswersConnector = mock[UserAnswersConnector] + val mockHelper = mock[AdjustmentOverUnderDeclarationCalculationHelper] when(mockHelper.fetchOverUnderDeclarationTotals(any(), any())(any())) thenReturn Future.successful( emptyUserAnswers .set(UnderDeclarationTotalPage, BigDecimal(1500)) .success .value ) - when(mockCacheConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) - val application = applicationBuilder(userAnswers = Some(emptyUserAnswers)) + when(mockUserAnswersConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) + val application = applicationBuilder(userAnswers = Some(emptyUserAnswers)) .overrides( - bind[CacheConnector].toInstance(mockCacheConnector), + bind[UserAnswersConnector].toInstance(mockUserAnswersConnector), bind[AdjustmentOverUnderDeclarationCalculationHelper].toInstance(mockHelper) ) .build() @@ -154,23 +154,23 @@ class DeleteAdjustmentControllerSpec extends SpecBase { .onPageLoad(pageNumber) .url - verify(mockCacheConnector, times(1)).set(any())(any()) + verify(mockUserAnswersConnector, times(1)).set(any())(any()) } } "must clear if total UnderDeclaration is not defined or is below threshold" in { - val mockCacheConnector = mock[CacheConnector] - val mockHelper = mock[AdjustmentOverUnderDeclarationCalculationHelper] + val mockUserAnswersConnector = mock[UserAnswersConnector] + val mockHelper = mock[AdjustmentOverUnderDeclarationCalculationHelper] when(mockHelper.fetchOverUnderDeclarationTotals(any(), any())(any())) thenReturn Future.successful( emptyUserAnswers .set(OverDeclarationTotalPage, BigDecimal(1500)) .success .value ) - when(mockCacheConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) - val application = applicationBuilder(userAnswers = Some(emptyUserAnswers)) + when(mockUserAnswersConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) + val application = applicationBuilder(userAnswers = Some(emptyUserAnswers)) .overrides( - bind[CacheConnector].toInstance(mockCacheConnector), + bind[UserAnswersConnector].toInstance(mockUserAnswersConnector), bind[AdjustmentOverUnderDeclarationCalculationHelper].toInstance(mockHelper) ) .build() @@ -183,7 +183,7 @@ class DeleteAdjustmentControllerSpec extends SpecBase { .onPageLoad(pageNumber) .url - verify(mockCacheConnector, times(1)).set(any())(any()) + verify(mockUserAnswersConnector, times(1)).set(any())(any()) } } diff --git a/test/controllers/adjustment/OverDeclarationReasonControllerSpec.scala b/test/controllers/adjustment/OverDeclarationReasonControllerSpec.scala index ce0b4215..09c46f1f 100644 --- a/test/controllers/adjustment/OverDeclarationReasonControllerSpec.scala +++ b/test/controllers/adjustment/OverDeclarationReasonControllerSpec.scala @@ -25,7 +25,7 @@ import pages.adjustment.OverDeclarationReasonPage import play.api.inject.bind import play.api.mvc.Call import play.api.test.Helpers._ -import connectors.CacheConnector +import connectors.UserAnswersConnector import uk.gov.hmrc.http.HttpResponse import views.html.adjustment.OverDeclarationReasonView @@ -82,15 +82,15 @@ class OverDeclarationReasonControllerSpec extends SpecBase { "must redirect to the next page when valid data is submitted" in { - val mockCacheConnector = mock[CacheConnector] + val mockUserAnswersConnector = mock[UserAnswersConnector] - when(mockCacheConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) + when(mockUserAnswersConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) val application = applicationBuilder(userAnswers = Some(emptyUserAnswers)) .overrides( bind[AdjustmentNavigator].toInstance(new FakeAdjustmentNavigator(onwardRoute, true)), - bind[CacheConnector].toInstance(mockCacheConnector) + bind[UserAnswersConnector].toInstance(mockUserAnswersConnector) ) .build() diff --git a/test/controllers/adjustment/SpoiltVolumeWithDutyControllerSpec.scala b/test/controllers/adjustment/SpoiltVolumeWithDutyControllerSpec.scala index 7e5bbb32..2bc5e984 100644 --- a/test/controllers/adjustment/SpoiltVolumeWithDutyControllerSpec.scala +++ b/test/controllers/adjustment/SpoiltVolumeWithDutyControllerSpec.scala @@ -18,7 +18,7 @@ package controllers.adjustment import base.SpecBase import cats.data.NonEmptySeq -import connectors.CacheConnector +import connectors.UserAnswersConnector import forms.adjustment.SpoiltVolumeWithDutyFormProvider import models.AlcoholRegime.Beer import models.adjustment.AdjustmentType.Spoilt @@ -141,15 +141,15 @@ class SpoiltVolumeWithDutyControllerSpec extends SpecBase { } "must redirect to the next page when valid data is submitted" in { - val mockCacheConnector = mock[CacheConnector] + val mockUserAnswersConnector = mock[UserAnswersConnector] - when(mockCacheConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) + when(mockUserAnswersConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) val application = applicationBuilder(userAnswers = Some(userAnswers)) .overrides( bind[AdjustmentNavigator].toInstance(new FakeAdjustmentNavigator(onwardRoute, hasValueChanged = true)), - bind[CacheConnector].toInstance(mockCacheConnector) + bind[UserAnswersConnector].toInstance(mockUserAnswersConnector) ) .build() @@ -186,15 +186,15 @@ class SpoiltVolumeWithDutyControllerSpec extends SpecBase { .success .value - val mockCacheConnector = mock[CacheConnector] + val mockUserAnswersConnector = mock[UserAnswersConnector] - when(mockCacheConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) + when(mockUserAnswersConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) val application = applicationBuilder(userAnswers = Some(userAnswers)) .overrides( bind[AdjustmentNavigator].toInstance(new FakeAdjustmentNavigator(onwardRoute, hasValueChanged = true)), - bind[CacheConnector].toInstance(mockCacheConnector) + bind[UserAnswersConnector].toInstance(mockUserAnswersConnector) ) .build() @@ -231,15 +231,15 @@ class SpoiltVolumeWithDutyControllerSpec extends SpecBase { .success .value - val mockCacheConnector = mock[CacheConnector] + val mockUserAnswersConnector = mock[UserAnswersConnector] - when(mockCacheConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) + when(mockUserAnswersConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) val application = applicationBuilder(userAnswers = Some(userAnswers)) .overrides( bind[AdjustmentNavigator].toInstance(new FakeAdjustmentNavigator(onwardRoute, hasValueChanged = false)), - bind[CacheConnector].toInstance(mockCacheConnector) + bind[UserAnswersConnector].toInstance(mockUserAnswersConnector) ) .build() @@ -332,9 +332,9 @@ class SpoiltVolumeWithDutyControllerSpec extends SpecBase { } "must use an empty AdjustmentEntry as a fallback if CurrentAdjustmentEntryPage returns None for POST" in { - val application = applicationBuilder(userAnswers = Some(emptyUserAnswers)).build() - val mockCacheConnector = mock[CacheConnector] - when(mockCacheConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) + val application = applicationBuilder(userAnswers = Some(emptyUserAnswers)).build() + val mockUserAnswersConnector = mock[UserAnswersConnector] + when(mockUserAnswersConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) running(application) { val request = FakeRequest(POST, spoiltVolumeWithDutyRoute) diff --git a/test/controllers/adjustment/UnderDeclarationReasonControllerSpec.scala b/test/controllers/adjustment/UnderDeclarationReasonControllerSpec.scala index 5f3ffbab..6017ec82 100644 --- a/test/controllers/adjustment/UnderDeclarationReasonControllerSpec.scala +++ b/test/controllers/adjustment/UnderDeclarationReasonControllerSpec.scala @@ -25,7 +25,7 @@ import pages.adjustment.UnderDeclarationReasonPage import play.api.inject.bind import play.api.mvc.Call import play.api.test.Helpers._ -import connectors.CacheConnector +import connectors.UserAnswersConnector import uk.gov.hmrc.http.HttpResponse import views.html.adjustment.UnderDeclarationReasonView @@ -82,15 +82,15 @@ class UnderDeclarationReasonControllerSpec extends SpecBase { "must redirect to the next page when valid data is submitted" in { - val mockCacheConnector = mock[CacheConnector] + val mockUserAnswersConnector = mock[UserAnswersConnector] - when(mockCacheConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) + when(mockUserAnswersConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) val application = applicationBuilder(userAnswers = Some(emptyUserAnswers)) .overrides( bind[AdjustmentNavigator].toInstance(new FakeAdjustmentNavigator(onwardRoute, hasValueChanged = true)), - bind[CacheConnector].toInstance(mockCacheConnector) + bind[UserAnswersConnector].toInstance(mockUserAnswersConnector) ) .build() diff --git a/test/controllers/adjustment/WhenDidYouPayDutyControllerSpec.scala b/test/controllers/adjustment/WhenDidYouPayDutyControllerSpec.scala index 88b5024b..0e069f27 100644 --- a/test/controllers/adjustment/WhenDidYouPayDutyControllerSpec.scala +++ b/test/controllers/adjustment/WhenDidYouPayDutyControllerSpec.scala @@ -24,7 +24,7 @@ import org.mockito.ArgumentMatchers.any import play.api.inject.bind import play.api.mvc.Call import play.api.test.Helpers._ -import connectors.CacheConnector +import connectors.UserAnswersConnector import models.adjustment.AdjustmentType.Spoilt import models.adjustment.{AdjustmentEntry, AdjustmentType} import pages.adjustment.CurrentAdjustmentEntryPage @@ -104,15 +104,15 @@ class WhenDidYouPayDutyControllerSpec extends SpecBase { "must redirect to the next page when valid data is submitted" in { - val mockCacheConnector = mock[CacheConnector] + val mockUserAnswersConnector = mock[UserAnswersConnector] - when(mockCacheConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) + when(mockUserAnswersConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) val application = applicationBuilder(userAnswers = Some(validEmptyUserAnswers)) .overrides( bind[AdjustmentNavigator].toInstance(new FakeAdjustmentNavigator(onwardRoute, hasValueChanged = true)), - bind[CacheConnector].toInstance(mockCacheConnector) + bind[UserAnswersConnector].toInstance(mockUserAnswersConnector) ) .build() @@ -133,15 +133,15 @@ class WhenDidYouPayDutyControllerSpec extends SpecBase { "must redirect to the next page when valid data is submitted and the user answers are empty" in { - val mockCacheConnector = mock[CacheConnector] + val mockUserAnswersConnector = mock[UserAnswersConnector] - when(mockCacheConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) + when(mockUserAnswersConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) val application = applicationBuilder(userAnswers = Some(emptyUserAnswers)) .overrides( bind[AdjustmentNavigator].toInstance(new FakeAdjustmentNavigator(onwardRoute, hasValueChanged = true)), - bind[CacheConnector].toInstance(mockCacheConnector) + bind[UserAnswersConnector].toInstance(mockUserAnswersConnector) ) .build() @@ -173,15 +173,15 @@ class WhenDidYouPayDutyControllerSpec extends SpecBase { .success .value - val mockCacheConnector = mock[CacheConnector] + val mockUserAnswersConnector = mock[UserAnswersConnector] - when(mockCacheConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) + when(mockUserAnswersConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) val application = applicationBuilder(userAnswers = Some(userAnswers)) .overrides( bind[AdjustmentNavigator].toInstance(new FakeAdjustmentNavigator(onwardRoute, hasValueChanged = false)), - bind[CacheConnector].toInstance(mockCacheConnector) + bind[UserAnswersConnector].toInstance(mockUserAnswersConnector) ) .build() diff --git a/test/controllers/auth/AuthControllerSpec.scala b/test/controllers/auth/AuthControllerSpec.scala index af00a267..487bf87b 100644 --- a/test/controllers/auth/AuthControllerSpec.scala +++ b/test/controllers/auth/AuthControllerSpec.scala @@ -18,7 +18,7 @@ package controllers.auth import base.SpecBase import config.FrontendAppConfig -import connectors.CacheConnector +import connectors.UserAnswersConnector import org.mockito.ArgumentMatchers.any import org.mockito.ArgumentMatchersSugar.eqTo import play.api.http.Status.OK @@ -35,11 +35,11 @@ class AuthControllerSpec extends SpecBase { "must clear user answers and redirect to sign out, specifying the exit survey as the continue URL" in { - val mockCacheConnector = mock[CacheConnector] + val mockUserAnswersConnector = mock[UserAnswersConnector] val application = applicationBuilder(None) - .overrides(bind[CacheConnector].toInstance(mockCacheConnector)) + .overrides(bind[UserAnswersConnector].toInstance(mockUserAnswersConnector)) .build() running(application) { @@ -54,18 +54,18 @@ class AuthControllerSpec extends SpecBase { status(result) mustEqual SEE_OTHER redirectLocation(result).value mustEqual expectedRedirectUrl - verify(mockCacheConnector, times(0)).releaseLock(eqTo(returnId))(any()) + verify(mockUserAnswersConnector, times(0)).releaseLock(eqTo(returnId))(any()) } } "must clear user answers, release the lock, and redirect to sign out, specifying the exit survey as the continue URL" in { - val mockCacheConnector = mock[CacheConnector] - when(mockCacheConnector.releaseLock(eqTo(returnId))(any())).thenReturn(Future.successful(HttpResponse(OK))) + val mockUserAnswersConnector = mock[UserAnswersConnector] + when(mockUserAnswersConnector.releaseLock(eqTo(returnId))(any())).thenReturn(Future.successful(HttpResponse(OK))) val application = applicationBuilder(None) - .overrides(bind[CacheConnector].toInstance(mockCacheConnector)) + .overrides(bind[UserAnswersConnector].toInstance(mockUserAnswersConnector)) .build() running(application) { @@ -80,7 +80,7 @@ class AuthControllerSpec extends SpecBase { status(result) mustEqual SEE_OTHER redirectLocation(result).value mustEqual expectedRedirectUrl - verify(mockCacheConnector, times(1)).releaseLock(eqTo(returnId))(any()) + verify(mockUserAnswersConnector, times(1)).releaseLock(eqTo(returnId))(any()) } } } diff --git a/test/controllers/declareDuty/AlcoholTypeControllerSpec.scala b/test/controllers/declareDuty/AlcoholTypeControllerSpec.scala index 2506f4fd..af7ac252 100644 --- a/test/controllers/declareDuty/AlcoholTypeControllerSpec.scala +++ b/test/controllers/declareDuty/AlcoholTypeControllerSpec.scala @@ -25,7 +25,7 @@ import pages.declareDuty.AlcoholTypePage import play.api.inject.bind import play.api.mvc.Call import play.api.test.Helpers._ -import connectors.CacheConnector +import connectors.UserAnswersConnector import models.AlcoholRegime.{Beer, Cider, Wine} import uk.gov.hmrc.http.HttpResponse import views.html.declareDuty.AlcoholTypeView @@ -89,15 +89,15 @@ class AlcoholTypeControllerSpec extends SpecBase { "must redirect to the next page when valid data is submitted" in { - val mockCacheConnector = mock[CacheConnector] + val mockUserAnswersConnector = mock[UserAnswersConnector] - when(mockCacheConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) + when(mockUserAnswersConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) val application = applicationBuilder(userAnswers = Some(emptyUserAnswers)) .overrides( bind[ReturnsNavigator].toInstance(new FakeReturnsNavigator(onwardRoute)), - bind[CacheConnector].toInstance(mockCacheConnector) + bind[UserAnswersConnector].toInstance(mockUserAnswersConnector) ) .build() diff --git a/test/controllers/declareDuty/CheckYourAnswersSPRControllerSpec.scala b/test/controllers/declareDuty/CheckYourAnswersSPRControllerSpec.scala index 0b853007..1564bc8c 100644 --- a/test/controllers/declareDuty/CheckYourAnswersSPRControllerSpec.scala +++ b/test/controllers/declareDuty/CheckYourAnswersSPRControllerSpec.scala @@ -17,7 +17,7 @@ package controllers.declareDuty import base.SpecBase -import connectors.CacheConnector +import connectors.UserAnswersConnector import navigation.{FakeReturnsNavigator, ReturnsNavigator} import org.mockito.ArgumentMatchers.any import pages.declareDuty.{TellUsAboutMultipleSPRRatePage, WhatDoYouNeedToDeclarePage} @@ -100,14 +100,14 @@ class CheckYourAnswersSPRControllerSpec extends SpecBase { "must redirect to the MultipleSPRList page if there is data for a POST" in { - val mockCacheConnector = mock[CacheConnector] + val mockUserAnswersConnector = mock[UserAnswersConnector] - when(mockCacheConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) + when(mockUserAnswersConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) val application = applicationBuilder(userAnswers = Some(userAnswers)) .overrides( bind[ReturnsNavigator].toInstance(new FakeReturnsNavigator(onwardRoute)), - bind[CacheConnector].toInstance(mockCacheConnector) + bind[UserAnswersConnector].toInstance(mockUserAnswersConnector) ) .build() @@ -128,14 +128,14 @@ class CheckYourAnswersSPRControllerSpec extends SpecBase { val index = Some(0) - val mockCacheConnector = mock[CacheConnector] + val mockUserAnswersConnector = mock[UserAnswersConnector] - when(mockCacheConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) + when(mockUserAnswersConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) val application = applicationBuilder(userAnswers = Some(userAnswers)) .overrides( bind[ReturnsNavigator].toInstance(new FakeReturnsNavigator(onwardRoute)), - bind[CacheConnector].toInstance(mockCacheConnector) + bind[UserAnswersConnector].toInstance(mockUserAnswersConnector) ) .build() diff --git a/test/controllers/declareDuty/DeclareAlcoholDutyQuestionControllerSpec.scala b/test/controllers/declareDuty/DeclareAlcoholDutyQuestionControllerSpec.scala index 63115057..5a3c8fae 100644 --- a/test/controllers/declareDuty/DeclareAlcoholDutyQuestionControllerSpec.scala +++ b/test/controllers/declareDuty/DeclareAlcoholDutyQuestionControllerSpec.scala @@ -17,7 +17,7 @@ package controllers.declareDuty import base.SpecBase -import connectors.CacheConnector +import connectors.UserAnswersConnector import forms.declareDuty.DeclareAlcoholDutyQuestionFormProvider import models.AlcoholRegime.Beer import models.{AlcoholRegimes, NormalMode} @@ -83,15 +83,15 @@ class DeclareAlcoholDutyQuestionControllerSpec extends SpecBase { "must redirect to the next page when valid data is submitted" in { - val mockCacheConnector = mock[CacheConnector] + val mockUserAnswersConnector = mock[UserAnswersConnector] - when(mockCacheConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) + when(mockUserAnswersConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) val application = applicationBuilder(userAnswers = Some(emptyUserAnswers)) .overrides( bind[ReturnsNavigator].toInstance(new FakeReturnsNavigator(onwardRoute)), - bind[CacheConnector].toInstance(mockCacheConnector) + bind[UserAnswersConnector].toInstance(mockUserAnswersConnector) ) .build() @@ -109,16 +109,16 @@ class DeclareAlcoholDutyQuestionControllerSpec extends SpecBase { "must redirect to the next page when valid data is submitted and user is approved for a single regime" in { - val userAnswers = emptyUserAnswers.copy(regimes = AlcoholRegimes(Set(Beer))) - val mockCacheConnector = mock[CacheConnector] + val userAnswers = emptyUserAnswers.copy(regimes = AlcoholRegimes(Set(Beer))) + val mockUserAnswersConnector = mock[UserAnswersConnector] - when(mockCacheConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) + when(mockUserAnswersConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) val application = applicationBuilder(userAnswers = Some(userAnswers)) .overrides( bind[ReturnsNavigator].toInstance(new FakeReturnsNavigator(onwardRoute)), - bind[CacheConnector].toInstance(mockCacheConnector) + bind[UserAnswersConnector].toInstance(mockUserAnswersConnector) ) .build() @@ -136,15 +136,15 @@ class DeclareAlcoholDutyQuestionControllerSpec extends SpecBase { "must redirect to the index page when valid question is answered as No" in { - val mockCacheConnector = mock[CacheConnector] + val mockUserAnswersConnector = mock[UserAnswersConnector] - when(mockCacheConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) + when(mockUserAnswersConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) val application = applicationBuilder(userAnswers = Some(emptyUserAnswers)) .overrides( bind[ReturnsNavigator].toInstance(new FakeReturnsNavigator(onwardRoute)), - bind[CacheConnector].toInstance(mockCacheConnector) + bind[UserAnswersConnector].toInstance(mockUserAnswersConnector) ) .build() diff --git a/test/controllers/declareDuty/DeleteMultipleSPREntryControllerSpec.scala b/test/controllers/declareDuty/DeleteMultipleSPREntryControllerSpec.scala index f24877fd..d77c8ec7 100644 --- a/test/controllers/declareDuty/DeleteMultipleSPREntryControllerSpec.scala +++ b/test/controllers/declareDuty/DeleteMultipleSPREntryControllerSpec.scala @@ -22,7 +22,7 @@ import org.mockito.ArgumentMatchers.any import pages.declareDuty.{MultipleSPRListPage, WhatDoYouNeedToDeclarePage} import play.api.inject.bind import play.api.test.Helpers._ -import connectors.CacheConnector +import connectors.UserAnswersConnector import models.NormalMode import uk.gov.hmrc.http.HttpResponse import views.html.declareDuty.DeleteMultipleSPREntryView @@ -91,14 +91,14 @@ class DeleteMultipleSPREntryControllerSpec extends SpecBase { } "must redirect to the Multiple SPR list page when valid data is submitted and the list is not empty" in { - val mockCacheConnector = mock[CacheConnector] + val mockUserAnswersConnector = mock[UserAnswersConnector] - when(mockCacheConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) + when(mockUserAnswersConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) val application = applicationBuilder(userAnswers = Some(userAnswers)) .overrides( - bind[CacheConnector].toInstance(mockCacheConnector) + bind[UserAnswersConnector].toInstance(mockUserAnswersConnector) ) .build() @@ -118,14 +118,14 @@ class DeleteMultipleSPREntryControllerSpec extends SpecBase { } "must redirect to the DoYouHaveMultipleSPRDutyRates page when 'yes' is submitted and the list is empty" in { - val mockCacheConnector = mock[CacheConnector] + val mockUserAnswersConnector = mock[UserAnswersConnector] - when(mockCacheConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) + when(mockUserAnswersConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) val application = applicationBuilder(userAnswers = Some(userAnswersWithSingleSPREntry)) .overrides( - bind[CacheConnector].toInstance(mockCacheConnector) + bind[UserAnswersConnector].toInstance(mockUserAnswersConnector) ) .build() diff --git a/test/controllers/declareDuty/DoYouHaveMultipleSPRDutyRatesControllerSpec.scala b/test/controllers/declareDuty/DoYouHaveMultipleSPRDutyRatesControllerSpec.scala index 938d41fc..40ec68e4 100644 --- a/test/controllers/declareDuty/DoYouHaveMultipleSPRDutyRatesControllerSpec.scala +++ b/test/controllers/declareDuty/DoYouHaveMultipleSPRDutyRatesControllerSpec.scala @@ -25,7 +25,7 @@ import pages.declareDuty.DoYouHaveMultipleSPRDutyRatesPage import play.api.inject.bind import play.api.mvc.Call import play.api.test.Helpers._ -import connectors.CacheConnector +import connectors.UserAnswersConnector import uk.gov.hmrc.http.HttpResponse import views.html.declareDuty.DoYouHaveMultipleSPRDutyRatesView @@ -85,15 +85,15 @@ class DoYouHaveMultipleSPRDutyRatesControllerSpec extends SpecBase { "must redirect to the next page when valid data is submitted" in { - val mockCacheConnector = mock[CacheConnector] + val mockUserAnswersConnector = mock[UserAnswersConnector] - when(mockCacheConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) + when(mockUserAnswersConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) val application = applicationBuilder(userAnswers = Some(emptyUserAnswers)) .overrides( bind[ReturnsNavigator].toInstance(new FakeReturnsNavigator(onwardRoute)), - bind[CacheConnector].toInstance(mockCacheConnector) + bind[UserAnswersConnector].toInstance(mockUserAnswersConnector) ) .build() @@ -112,15 +112,15 @@ class DoYouHaveMultipleSPRDutyRatesControllerSpec extends SpecBase { "must redirect to the next page when valid data is submitted in Check Mode and the value has not changed" in { val userAnswers = emptyUserAnswers.setByKey(DoYouHaveMultipleSPRDutyRatesPage, regime, true).success.value - val mockCacheConnector = mock[CacheConnector] + val mockUserAnswersConnector = mock[UserAnswersConnector] - when(mockCacheConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) + when(mockUserAnswersConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) val application = applicationBuilder(userAnswers = Some(userAnswers)) .overrides( bind[ReturnsNavigator].toInstance(new FakeReturnsNavigator(onwardRoute)), - bind[CacheConnector].toInstance(mockCacheConnector) + bind[UserAnswersConnector].toInstance(mockUserAnswersConnector) ) .build() @@ -139,15 +139,15 @@ class DoYouHaveMultipleSPRDutyRatesControllerSpec extends SpecBase { "must redirect to the next page when valid data is submitted in Check Mode and the value has changed" in { val userAnswers = emptyUserAnswers.setByKey(DoYouHaveMultipleSPRDutyRatesPage, regime, true).success.value - val mockCacheConnector = mock[CacheConnector] + val mockUserAnswersConnector = mock[UserAnswersConnector] - when(mockCacheConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) + when(mockUserAnswersConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) val application = applicationBuilder(userAnswers = Some(userAnswers)) .overrides( bind[ReturnsNavigator].toInstance(new FakeReturnsNavigator(onwardRoute, hasAnswerChangeValue = true)), - bind[CacheConnector].toInstance(mockCacheConnector) + bind[UserAnswersConnector].toInstance(mockUserAnswersConnector) ) .build() diff --git a/test/controllers/declareDuty/DutyCalculationControllerSpec.scala b/test/controllers/declareDuty/DutyCalculationControllerSpec.scala index 88f54829..aaa6d5a2 100644 --- a/test/controllers/declareDuty/DutyCalculationControllerSpec.scala +++ b/test/controllers/declareDuty/DutyCalculationControllerSpec.scala @@ -17,7 +17,7 @@ package controllers.declareDuty import base.SpecBase -import connectors.{AlcoholDutyCalculatorConnector, CacheConnector} +import connectors.{AlcoholDutyCalculatorConnector, UserAnswersConnector} import models.declareDuty.{AlcoholDuty, DutyByTaxType} import org.mockito.ArgumentMatchers.any import pages.declareDuty.{DoYouHaveMultipleSPRDutyRatesPage, DutyCalculationPage, HowMuchDoYouNeedToDeclarePage, WhatDoYouNeedToDeclarePage} @@ -70,14 +70,14 @@ class DutyCalculationControllerSpec extends SpecBase { "must return OK and the correct view for a GET if No is selected for add Multiple SPR option" in { - val mockCacheConnector = mock[CacheConnector] + val mockUserAnswersConnector = mock[UserAnswersConnector] - when(mockCacheConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) + when(mockUserAnswersConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) val application = applicationBuilder(userAnswers = Some(userAnswers)) .overrides( bind[AlcoholDutyCalculatorConnector].toInstance(calculatorMock), - bind[CacheConnector].toInstance(mockCacheConnector) + bind[UserAnswersConnector].toInstance(mockUserAnswersConnector) ) .build() @@ -106,14 +106,14 @@ class DutyCalculationControllerSpec extends SpecBase { val updatedUserAnswer = userAnswers.setByKey(DoYouHaveMultipleSPRDutyRatesPage, regime, true).success.value - val mockCacheConnector = mock[CacheConnector] + val mockUserAnswersConnector = mock[UserAnswersConnector] - when(mockCacheConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) + when(mockUserAnswersConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) val application = applicationBuilder(userAnswers = Some(updatedUserAnswer)) .overrides( bind[AlcoholDutyCalculatorConnector].toInstance(calculatorMock), - bind[CacheConnector].toInstance(mockCacheConnector) + bind[UserAnswersConnector].toInstance(mockUserAnswersConnector) ) .build() @@ -140,14 +140,14 @@ class DutyCalculationControllerSpec extends SpecBase { "must redirect in the Journey Recovery screen if the user answers are empty" in { - val mockCacheConnector = mock[CacheConnector] + val mockUserAnswersConnector = mock[UserAnswersConnector] - when(mockCacheConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) + when(mockUserAnswersConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) val application = applicationBuilder(userAnswers = Some(emptyUserAnswers)) .overrides( bind[AlcoholDutyCalculatorConnector].toInstance(calculatorMock), - bind[CacheConnector].toInstance(mockCacheConnector) + bind[UserAnswersConnector].toInstance(mockUserAnswersConnector) ) .build() @@ -165,14 +165,14 @@ class DutyCalculationControllerSpec extends SpecBase { val updatedUserAnswers = userAnswers.setByKey(DutyCalculationPage, regime, alcoholDuty).success.value - val mockCacheConnector = mock[CacheConnector] + val mockUserAnswersConnector = mock[UserAnswersConnector] - when(mockCacheConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) + when(mockUserAnswersConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) val application = applicationBuilder(userAnswers = Some(updatedUserAnswers)) .overrides( bind[AlcoholDutyCalculatorConnector].toInstance(calculatorMock), - bind[CacheConnector].toInstance(mockCacheConnector) + bind[UserAnswersConnector].toInstance(mockUserAnswersConnector) ) .build() @@ -188,14 +188,14 @@ class DutyCalculationControllerSpec extends SpecBase { "must redirect to the Journey Recover page if there is no data for a POST" in { - val mockCacheConnector = mock[CacheConnector] + val mockUserAnswersConnector = mock[UserAnswersConnector] - when(mockCacheConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) + when(mockUserAnswersConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) val application = applicationBuilder(userAnswers = Some(userAnswers)) .overrides( bind[AlcoholDutyCalculatorConnector].toInstance(calculatorMock), - bind[CacheConnector].toInstance(mockCacheConnector) + bind[UserAnswersConnector].toInstance(mockUserAnswersConnector) ) .build() diff --git a/test/controllers/declareDuty/HowMuchDoYouNeedToDeclareControllerSpec.scala b/test/controllers/declareDuty/HowMuchDoYouNeedToDeclareControllerSpec.scala index 25a01391..5ce4123e 100644 --- a/test/controllers/declareDuty/HowMuchDoYouNeedToDeclareControllerSpec.scala +++ b/test/controllers/declareDuty/HowMuchDoYouNeedToDeclareControllerSpec.scala @@ -25,7 +25,7 @@ import pages.declareDuty.{HowMuchDoYouNeedToDeclarePage, WhatDoYouNeedToDeclareP import play.api.inject.bind import play.api.mvc.Call import play.api.test.Helpers._ -import connectors.CacheConnector +import connectors.UserAnswersConnector import org.scalacheck.Arbitrary._ import uk.gov.hmrc.http.HttpResponse import viewmodels.declareDuty.CategoriesByRateTypeHelper @@ -113,15 +113,15 @@ class HowMuchDoYouNeedToDeclareControllerSpec extends SpecBase { "must redirect to the next page when valid data is submitted" in { - val mockCacheConnector = mock[CacheConnector] + val mockUserAnswersConnector = mock[UserAnswersConnector] - when(mockCacheConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) + when(mockUserAnswersConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) val application = applicationBuilder(userAnswers = Some(userAnswers)) .overrides( bind[ReturnsNavigator].toInstance(new FakeReturnsNavigator(onwardRoute)), - bind[CacheConnector].toInstance(mockCacheConnector) + bind[UserAnswersConnector].toInstance(mockUserAnswersConnector) ) .build() @@ -235,15 +235,15 @@ class HowMuchDoYouNeedToDeclareControllerSpec extends SpecBase { "must redirect to Journey Recovery for a POST if incoherent data is found" in { - val mockCacheConnector = mock[CacheConnector] + val mockUserAnswersConnector = mock[UserAnswersConnector] - when(mockCacheConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) + when(mockUserAnswersConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) val application = applicationBuilder(userAnswers = Some(userAnswers)) .overrides( bind[ReturnsNavigator].toInstance(new FakeReturnsNavigator(onwardRoute)), - bind[CacheConnector].toInstance(mockCacheConnector) + bind[UserAnswersConnector].toInstance(mockUserAnswersConnector) ) .build() diff --git a/test/controllers/declareDuty/MultipleSPRListControllerSpec.scala b/test/controllers/declareDuty/MultipleSPRListControllerSpec.scala index ae8f0dd2..b5b13144 100644 --- a/test/controllers/declareDuty/MultipleSPRListControllerSpec.scala +++ b/test/controllers/declareDuty/MultipleSPRListControllerSpec.scala @@ -24,7 +24,7 @@ import pages.declareDuty.{DoYouWantToAddMultipleSPRToListPage, MultipleSPRListPa import play.api.inject.bind import play.api.mvc.Call import play.api.test.Helpers._ -import connectors.CacheConnector +import connectors.UserAnswersConnector import uk.gov.hmrc.http.HttpResponse import viewmodels.declareDuty.MultipleSPRListHelper import views.html.declareDuty.MultipleSPRListView @@ -102,15 +102,15 @@ class MultipleSPRListControllerSpec extends SpecBase { "must redirect to the next page when valid data is submitted" in { - val mockCacheConnector = mock[CacheConnector] + val mockUserAnswersConnector = mock[UserAnswersConnector] - when(mockCacheConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) + when(mockUserAnswersConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) val application = applicationBuilder(userAnswers = Some(userAnswers)) .overrides( bind[ReturnsNavigator].toInstance(new FakeReturnsNavigator(onwardRoute)), - bind[CacheConnector].toInstance(mockCacheConnector) + bind[UserAnswersConnector].toInstance(mockUserAnswersConnector) ) .build() diff --git a/test/controllers/declareDuty/TellUsAboutMultipleSPRRateControllerSpec.scala b/test/controllers/declareDuty/TellUsAboutMultipleSPRRateControllerSpec.scala index a2665a2b..779fcec5 100644 --- a/test/controllers/declareDuty/TellUsAboutMultipleSPRRateControllerSpec.scala +++ b/test/controllers/declareDuty/TellUsAboutMultipleSPRRateControllerSpec.scala @@ -25,7 +25,7 @@ import pages.declareDuty.{MultipleSPRListPage, TellUsAboutMultipleSPRRatePage, W import play.api.inject.bind import play.api.mvc.Call import play.api.test.Helpers._ -import connectors.CacheConnector +import connectors.UserAnswersConnector import models.declareDuty.VolumeAndRateByTaxType import uk.gov.hmrc.http.HttpResponse import viewmodels.declareDuty.TellUsAboutMultipleSPRRateHelper @@ -178,15 +178,15 @@ class TellUsAboutMultipleSPRRateControllerSpec extends SpecBase { "must redirect to the next page when valid data is submitted" in { - val mockCacheConnector = mock[CacheConnector] + val mockUserAnswersConnector = mock[UserAnswersConnector] - when(mockCacheConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) + when(mockUserAnswersConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) val application = applicationBuilder(userAnswers = Some(userAnswers)) .overrides( bind[ReturnsNavigator].toInstance(new FakeReturnsNavigator(onwardRoute)), - bind[CacheConnector].toInstance(mockCacheConnector) + bind[UserAnswersConnector].toInstance(mockUserAnswersConnector) ) .build() @@ -224,15 +224,15 @@ class TellUsAboutMultipleSPRRateControllerSpec extends SpecBase { val filledUserAnswers = userAnswers.setByKey(MultipleSPRListPage, regime, Seq(volumeAndRateByTaxType)).success.value - val mockCacheConnector = mock[CacheConnector] + val mockUserAnswersConnector = mock[UserAnswersConnector] - when(mockCacheConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) + when(mockUserAnswersConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) val application = applicationBuilder(userAnswers = Some(filledUserAnswers)) .overrides( bind[ReturnsNavigator].toInstance(new FakeReturnsNavigator(onwardRoute, hasAnswerChangeValue = true)), - bind[CacheConnector].toInstance(mockCacheConnector) + bind[UserAnswersConnector].toInstance(mockUserAnswersConnector) ) .build() @@ -270,15 +270,15 @@ class TellUsAboutMultipleSPRRateControllerSpec extends SpecBase { val filledUserAnswers = userAnswers.setByKey(MultipleSPRListPage, regime, Seq(volumeAndRateByTaxType)).success.value - val mockCacheConnector = mock[CacheConnector] + val mockUserAnswersConnector = mock[UserAnswersConnector] - when(mockCacheConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) + when(mockUserAnswersConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) val application = applicationBuilder(userAnswers = Some(filledUserAnswers)) .overrides( bind[ReturnsNavigator].toInstance(new FakeReturnsNavigator(onwardRoute, hasAnswerChangeValue = true)), - bind[CacheConnector].toInstance(mockCacheConnector) + bind[UserAnswersConnector].toInstance(mockUserAnswersConnector) ) .build() @@ -316,15 +316,15 @@ class TellUsAboutMultipleSPRRateControllerSpec extends SpecBase { val filledUserAnswers = userAnswers.setByKey(MultipleSPRListPage, regime, Seq(volumeAndRateByTaxType)).success.value - val mockCacheConnector = mock[CacheConnector] + val mockUserAnswersConnector = mock[UserAnswersConnector] - when(mockCacheConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) + when(mockUserAnswersConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) val application = applicationBuilder(userAnswers = Some(filledUserAnswers)) .overrides( bind[ReturnsNavigator].toInstance(new FakeReturnsNavigator(onwardRoute)), - bind[CacheConnector].toInstance(mockCacheConnector) + bind[UserAnswersConnector].toInstance(mockUserAnswersConnector) ) .build() @@ -359,15 +359,15 @@ class TellUsAboutMultipleSPRRateControllerSpec extends SpecBase { taxType = rateBands.head.taxTypeCode ) - val mockCacheConnector = mock[CacheConnector] + val mockUserAnswersConnector = mock[UserAnswersConnector] - when(mockCacheConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) + when(mockUserAnswersConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) val application = applicationBuilder(userAnswers = Some(filledUserAnswers)) .overrides( bind[ReturnsNavigator].toInstance(new FakeReturnsNavigator(onwardRoute)), - bind[CacheConnector].toInstance(mockCacheConnector) + bind[UserAnswersConnector].toInstance(mockUserAnswersConnector) ) .build() diff --git a/test/controllers/declareDuty/TellUsAboutSingleSPRRateControllerSpec.scala b/test/controllers/declareDuty/TellUsAboutSingleSPRRateControllerSpec.scala index 8c03797b..7a74842a 100644 --- a/test/controllers/declareDuty/TellUsAboutSingleSPRRateControllerSpec.scala +++ b/test/controllers/declareDuty/TellUsAboutSingleSPRRateControllerSpec.scala @@ -25,7 +25,7 @@ import pages.declareDuty.{TellUsAboutSingleSPRRatePage, WhatDoYouNeedToDeclarePa import play.api.inject.bind import play.api.mvc.Call import play.api.test.Helpers._ -import connectors.CacheConnector +import connectors.UserAnswersConnector import models.declareDuty.VolumeAndRateByTaxType import uk.gov.hmrc.http.HttpResponse import viewmodels.declareDuty.CategoriesByRateTypeHelper @@ -108,15 +108,15 @@ class TellUsAboutSingleSPRRateControllerSpec extends SpecBase { "must redirect to the next page when valid data is submitted" in { - val mockCacheConnector = mock[CacheConnector] + val mockUserAnswersConnector = mock[UserAnswersConnector] - when(mockCacheConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) + when(mockUserAnswersConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) val application = applicationBuilder(userAnswers = Some(userAnswers)) .overrides( bind[ReturnsNavigator].toInstance(new FakeReturnsNavigator(onwardRoute)), - bind[CacheConnector].toInstance(mockCacheConnector) + bind[UserAnswersConnector].toInstance(mockUserAnswersConnector) ) .build() diff --git a/test/controllers/declareDuty/WhatDoYouNeedToDeclareControllerSpec.scala b/test/controllers/declareDuty/WhatDoYouNeedToDeclareControllerSpec.scala index faac7185..0fb858ae 100644 --- a/test/controllers/declareDuty/WhatDoYouNeedToDeclareControllerSpec.scala +++ b/test/controllers/declareDuty/WhatDoYouNeedToDeclareControllerSpec.scala @@ -25,7 +25,7 @@ import pages.declareDuty.{AlcoholTypePage, WhatDoYouNeedToDeclarePage} import play.api.inject.bind import play.api.mvc.Call import play.api.test.Helpers._ -import connectors.{AlcoholDutyCalculatorConnector, CacheConnector} +import connectors.{AlcoholDutyCalculatorConnector, UserAnswersConnector} import uk.gov.hmrc.http.HttpResponse import viewmodels.declareDuty.TaxBandsViewModel import views.html.declareDuty.WhatDoYouNeedToDeclareView @@ -50,8 +50,8 @@ class WhatDoYouNeedToDeclareControllerSpec extends SpecBase { rateBandList ) - val mockCacheConnector = mock[CacheConnector] - when(mockCacheConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) + val mockUserAnswersConnector = mock[UserAnswersConnector] + when(mockUserAnswersConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) val userAnswersWithAlcoholType = emptyUserAnswers.set(AlcoholTypePage, emptyUserAnswers.regimes.regimes).success.value @@ -62,7 +62,7 @@ class WhatDoYouNeedToDeclareControllerSpec extends SpecBase { val application = applicationBuilder(userAnswers = Some(userAnswersWithAlcoholType)) .overrides( bind[AlcoholDutyCalculatorConnector].toInstance(mockAlcoholDutyCalculatorConnector), - bind[CacheConnector].toInstance(mockCacheConnector) + bind[UserAnswersConnector].toInstance(mockUserAnswersConnector) ) .build() @@ -90,7 +90,7 @@ class WhatDoYouNeedToDeclareControllerSpec extends SpecBase { val application = applicationBuilder(userAnswers = Some(userAnswers)) .overrides( bind[AlcoholDutyCalculatorConnector].toInstance(mockAlcoholDutyCalculatorConnector), - bind[CacheConnector].toInstance(mockCacheConnector) + bind[UserAnswersConnector].toInstance(mockUserAnswersConnector) ) .build() @@ -122,7 +122,7 @@ class WhatDoYouNeedToDeclareControllerSpec extends SpecBase { .overrides( bind[ReturnsNavigator].toInstance(new FakeReturnsNavigator(onwardRoute)), bind[AlcoholDutyCalculatorConnector].toInstance(mockAlcoholDutyCalculatorConnector), - bind[CacheConnector].toInstance(mockCacheConnector) + bind[UserAnswersConnector].toInstance(mockUserAnswersConnector) ) .build() @@ -151,7 +151,7 @@ class WhatDoYouNeedToDeclareControllerSpec extends SpecBase { .overrides( bind[ReturnsNavigator].toInstance(new FakeReturnsNavigator(onwardRoute, hasAnswerChangeValue = true)), bind[AlcoholDutyCalculatorConnector].toInstance(mockAlcoholDutyCalculatorConnector), - bind[CacheConnector].toInstance(mockCacheConnector) + bind[UserAnswersConnector].toInstance(mockUserAnswersConnector) ) .build() @@ -182,7 +182,7 @@ class WhatDoYouNeedToDeclareControllerSpec extends SpecBase { .overrides( bind[ReturnsNavigator].toInstance(new FakeReturnsNavigator(onwardRoute, hasAnswerChangeValue = false)), bind[AlcoholDutyCalculatorConnector].toInstance(mockAlcoholDutyCalculatorConnector), - bind[CacheConnector].toInstance(mockCacheConnector) + bind[UserAnswersConnector].toInstance(mockUserAnswersConnector) ) .build() @@ -204,7 +204,7 @@ class WhatDoYouNeedToDeclareControllerSpec extends SpecBase { val application = applicationBuilder(userAnswers = Some(userAnswersWithAlcoholType)) .overrides( bind[AlcoholDutyCalculatorConnector].toInstance(mockAlcoholDutyCalculatorConnector), - bind[CacheConnector].toInstance(mockCacheConnector) + bind[UserAnswersConnector].toInstance(mockUserAnswersConnector) ) .build() @@ -235,7 +235,7 @@ class WhatDoYouNeedToDeclareControllerSpec extends SpecBase { val application = applicationBuilder(userAnswers = Some(userAnswersWithAlcoholType)) .overrides( bind[AlcoholDutyCalculatorConnector].toInstance(mockAlcoholDutyCalculatorConnector), - bind[CacheConnector].toInstance(mockCacheConnector) + bind[UserAnswersConnector].toInstance(mockUserAnswersConnector) ) .build() diff --git a/test/controllers/dutySuspended/DeclareDutySuspendedDeliveriesQuestionControllerSpec.scala b/test/controllers/dutySuspended/DeclareDutySuspendedDeliveriesQuestionControllerSpec.scala index 766e90c5..d9098193 100644 --- a/test/controllers/dutySuspended/DeclareDutySuspendedDeliveriesQuestionControllerSpec.scala +++ b/test/controllers/dutySuspended/DeclareDutySuspendedDeliveriesQuestionControllerSpec.scala @@ -17,7 +17,7 @@ package controllers.dutySuspended import base.SpecBase -import connectors.CacheConnector +import connectors.UserAnswersConnector import forms.dutySuspended.DeclareDutySuspendedDeliveriesQuestionFormProvider import models.NormalMode import navigation.{DeclareDutySuspendedDeliveriesNavigator, FakeDeclareDutySuspendedDeliveriesNavigator} @@ -79,9 +79,9 @@ class DeclareDutySuspendedDeliveriesQuestionControllerSpec extends SpecBase { "must redirect to the next page when valid data is submitted" in { - val mockCacheConnector = mock[CacheConnector] + val mockUserAnswersConnector = mock[UserAnswersConnector] - when(mockCacheConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) + when(mockUserAnswersConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) val application = applicationBuilder(userAnswers = Some(emptyUserAnswers)) @@ -89,7 +89,7 @@ class DeclareDutySuspendedDeliveriesQuestionControllerSpec extends SpecBase { bind[DeclareDutySuspendedDeliveriesNavigator].toInstance( new FakeDeclareDutySuspendedDeliveriesNavigator(onwardRoute) ), - bind[CacheConnector].toInstance(mockCacheConnector) + bind[UserAnswersConnector].toInstance(mockUserAnswersConnector) ) .build() @@ -156,14 +156,14 @@ class DeclareDutySuspendedDeliveriesQuestionControllerSpec extends SpecBase { } "must redirect to the Task list when declare duty suspended deliveries question is answered as No" in { - val mockCacheConnector = mock[CacheConnector] - when(mockCacheConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) - val application = + val mockUserAnswersConnector = mock[UserAnswersConnector] + when(mockUserAnswersConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) + val application = applicationBuilder(userAnswers = Some(emptyUserAnswers)) .overrides( bind[DeclareDutySuspendedDeliveriesNavigator] .toInstance(new FakeDeclareDutySuspendedDeliveriesNavigator(onwardRoute)), - bind[CacheConnector].toInstance(mockCacheConnector) + bind[UserAnswersConnector].toInstance(mockUserAnswersConnector) ) .build() running(application) { diff --git a/test/controllers/dutySuspended/DutySuspendedBeerControllerSpec.scala b/test/controllers/dutySuspended/DutySuspendedBeerControllerSpec.scala index ccac35d5..7605be3a 100644 --- a/test/controllers/dutySuspended/DutySuspendedBeerControllerSpec.scala +++ b/test/controllers/dutySuspended/DutySuspendedBeerControllerSpec.scala @@ -27,7 +27,7 @@ import play.api.inject.bind import play.api.libs.json.Json import play.api.mvc.Call import play.api.test.Helpers._ -import connectors.CacheConnector +import connectors.UserAnswersConnector import uk.gov.hmrc.http.HttpResponse import views.html.dutySuspended.DutySuspendedBeerView @@ -91,16 +91,16 @@ class DutySuspendedBeerControllerSpec extends SpecBase { } "must redirect to the next page when valid data is submitted" in { - val mockCacheConnector = mock[CacheConnector] + val mockUserAnswersConnector = mock[UserAnswersConnector] - when(mockCacheConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) + when(mockUserAnswersConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) val application = applicationBuilder(userAnswers = Some(userAnswersWithBeer)) .overrides( bind[DeclareDutySuspendedDeliveriesNavigator] .toInstance(new FakeDeclareDutySuspendedDeliveriesNavigator(onwardRoute)), - bind[CacheConnector].toInstance(mockCacheConnector) + bind[UserAnswersConnector].toInstance(mockUserAnswersConnector) ) .build() diff --git a/test/controllers/dutySuspended/DutySuspendedCiderControllerSpec.scala b/test/controllers/dutySuspended/DutySuspendedCiderControllerSpec.scala index 98fbe97c..99a668ee 100644 --- a/test/controllers/dutySuspended/DutySuspendedCiderControllerSpec.scala +++ b/test/controllers/dutySuspended/DutySuspendedCiderControllerSpec.scala @@ -27,7 +27,7 @@ import play.api.inject.bind import play.api.libs.json.Json import play.api.mvc.Call import play.api.test.Helpers._ -import connectors.CacheConnector +import connectors.UserAnswersConnector import uk.gov.hmrc.http.HttpResponse import views.html.dutySuspended.DutySuspendedCiderView @@ -87,16 +87,16 @@ class DutySuspendedCiderControllerSpec extends SpecBase { } "must redirect to the next page when valid data is submitted" in { - val mockCacheConnector = mock[CacheConnector] + val mockUserAnswersConnector = mock[UserAnswersConnector] - when(mockCacheConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) + when(mockUserAnswersConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) val application = applicationBuilder(userAnswers = Some(userAnswersWithCider)) .overrides( bind[DeclareDutySuspendedDeliveriesNavigator] .toInstance(new FakeDeclareDutySuspendedDeliveriesNavigator(onwardRoute)), - bind[CacheConnector].toInstance(mockCacheConnector) + bind[UserAnswersConnector].toInstance(mockUserAnswersConnector) ) .build() diff --git a/test/controllers/dutySuspended/DutySuspendedOtherFermentedControllerSpec.scala b/test/controllers/dutySuspended/DutySuspendedOtherFermentedControllerSpec.scala index 78fdfb34..5b3102ea 100644 --- a/test/controllers/dutySuspended/DutySuspendedOtherFermentedControllerSpec.scala +++ b/test/controllers/dutySuspended/DutySuspendedOtherFermentedControllerSpec.scala @@ -27,7 +27,7 @@ import play.api.inject.bind import play.api.libs.json.Json import play.api.mvc.Call import play.api.test.Helpers._ -import connectors.CacheConnector +import connectors.UserAnswersConnector import uk.gov.hmrc.http.HttpResponse import views.html.dutySuspended.DutySuspendedOtherFermentedView @@ -87,16 +87,16 @@ class DutySuspendedOtherFermentedControllerSpec extends SpecBase { } "must redirect to the next page when valid data is submitted" in { - val mockCacheConnector = mock[CacheConnector] + val mockUserAnswersConnector = mock[UserAnswersConnector] - when(mockCacheConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) + when(mockUserAnswersConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) val application = applicationBuilder(userAnswers = Some(userAnswersWithOtherFermentedProduct)) .overrides( bind[DeclareDutySuspendedDeliveriesNavigator] .toInstance(new FakeDeclareDutySuspendedDeliveriesNavigator(onwardRoute)), - bind[CacheConnector].toInstance(mockCacheConnector) + bind[UserAnswersConnector].toInstance(mockUserAnswersConnector) ) .build() diff --git a/test/controllers/dutySuspended/DutySuspendedSpiritsControllerSpec.scala b/test/controllers/dutySuspended/DutySuspendedSpiritsControllerSpec.scala index 8a157ff6..29a3a7f3 100644 --- a/test/controllers/dutySuspended/DutySuspendedSpiritsControllerSpec.scala +++ b/test/controllers/dutySuspended/DutySuspendedSpiritsControllerSpec.scala @@ -27,7 +27,7 @@ import play.api.inject.bind import play.api.libs.json.Json import play.api.mvc.Call import play.api.test.Helpers._ -import connectors.CacheConnector +import connectors.UserAnswersConnector import uk.gov.hmrc.http.HttpResponse import views.html.dutySuspended.DutySuspendedSpiritsView @@ -90,16 +90,16 @@ class DutySuspendedSpiritsControllerSpec extends SpecBase { } "must redirect to the next page when valid data is submitted" in { - val mockCacheConnector = mock[CacheConnector] + val mockUserAnswersConnector = mock[UserAnswersConnector] - when(mockCacheConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) + when(mockUserAnswersConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) val application = applicationBuilder(userAnswers = Some(userAnswersWithSpirits)) .overrides( bind[DeclareDutySuspendedDeliveriesNavigator] .toInstance(new FakeDeclareDutySuspendedDeliveriesNavigator(onwardRoute)), - bind[CacheConnector].toInstance(mockCacheConnector) + bind[UserAnswersConnector].toInstance(mockUserAnswersConnector) ) .build() diff --git a/test/controllers/dutySuspended/DutySuspendedWineControllerSpec.scala b/test/controllers/dutySuspended/DutySuspendedWineControllerSpec.scala index 27a68211..2a9ca82e 100644 --- a/test/controllers/dutySuspended/DutySuspendedWineControllerSpec.scala +++ b/test/controllers/dutySuspended/DutySuspendedWineControllerSpec.scala @@ -27,7 +27,7 @@ import play.api.inject.bind import play.api.libs.json.Json import play.api.mvc.Call import play.api.test.Helpers._ -import connectors.CacheConnector +import connectors.UserAnswersConnector import uk.gov.hmrc.http.HttpResponse import views.html.dutySuspended.DutySuspendedWineView @@ -87,16 +87,16 @@ class DutySuspendedWineControllerSpec extends SpecBase { } "must redirect to the next page when valid data is submitted" in { - val mockCacheConnector = mock[CacheConnector] + val mockUserAnswersConnector = mock[UserAnswersConnector] - when(mockCacheConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) + when(mockUserAnswersConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) val application = applicationBuilder(userAnswers = Some(userAnswersWithWine)) .overrides( bind[DeclareDutySuspendedDeliveriesNavigator] .toInstance(new FakeDeclareDutySuspendedDeliveriesNavigator(onwardRoute)), - bind[CacheConnector].toInstance(mockCacheConnector) + bind[UserAnswersConnector].toInstance(mockUserAnswersConnector) ) .build() diff --git a/test/controllers/spiritsQuestions/AlcoholUsedControllerSpec.scala b/test/controllers/spiritsQuestions/AlcoholUsedControllerSpec.scala index 8a5237f2..1dd46f0f 100644 --- a/test/controllers/spiritsQuestions/AlcoholUsedControllerSpec.scala +++ b/test/controllers/spiritsQuestions/AlcoholUsedControllerSpec.scala @@ -17,7 +17,7 @@ package controllers.spiritsQuestions import base.SpecBase -import connectors.CacheConnector +import connectors.UserAnswersConnector import forms.spiritsQuestions.AlcoholUsedFormProvider import models.{NormalMode, UserAnswers} import models.spiritsQuestions.AlcoholUsed @@ -87,9 +87,9 @@ class AlcoholUsedControllerSpec extends SpecBase { } "must redirect to the next page when valid data is submitted" in new SetUp(Some(emptyUserAnswers)) { - val mockCacheConnector = mock[CacheConnector] + val mockUserAnswersConnector = mock[UserAnswersConnector] - when(mockCacheConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) + when(mockUserAnswersConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) override val application = applicationBuilder(userAnswers = Some(emptyUserAnswers)) @@ -97,7 +97,7 @@ class AlcoholUsedControllerSpec extends SpecBase { .overrides( bind[QuarterlySpiritsQuestionsNavigator] .toInstance(new FakeQuarterlySpiritsQuestionsNavigator(onwardRoute, hasValueChanged = true)), - bind[CacheConnector].toInstance(mockCacheConnector) + bind[UserAnswersConnector].toInstance(mockUserAnswersConnector) ) .build() diff --git a/test/controllers/spiritsQuestions/CheckYourAnswersControllerSpec.scala b/test/controllers/spiritsQuestions/CheckYourAnswersControllerSpec.scala index 06a3ed89..ec899b79 100644 --- a/test/controllers/spiritsQuestions/CheckYourAnswersControllerSpec.scala +++ b/test/controllers/spiritsQuestions/CheckYourAnswersControllerSpec.scala @@ -17,7 +17,7 @@ package controllers.spiritsQuestions import base.SpecBase -import connectors.CacheConnector +import connectors.UserAnswersConnector import generators.ModelGenerators import models.UnitsOfMeasure.Tonnes import models.spiritsQuestions.{AlcoholUsed, EthyleneGasOrMolassesUsed, GrainsUsed, OtherIngredientsUsed, OtherMaltedGrains, Whisky} @@ -67,14 +67,14 @@ class CheckYourAnswersControllerSpec extends SpecBase with ModelGenerators { .value "must return OK and the correct view for a GET if all necessary questions are answered" in new SetUp { - val mockCacheConnector = mock[CacheConnector] + val mockUserAnswersConnector = mock[UserAnswersConnector] - when(mockCacheConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) + when(mockUserAnswersConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) val application = applicationBuilder(userAnswers = Some(completedUserAnswers)) .configure(additionalConfig) .overrides( - bind[CacheConnector].toInstance(mockCacheConnector) + bind[UserAnswersConnector].toInstance(mockUserAnswersConnector) ) .build() @@ -104,9 +104,9 @@ class CheckYourAnswersControllerSpec extends SpecBase with ModelGenerators { } "must return OK and the correct view for a GET if any optional questions are not answered" in new SetUp { - val mockCacheConnector = mock[CacheConnector] + val mockUserAnswersConnector = mock[UserAnswersConnector] - when(mockCacheConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) + when(mockUserAnswersConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) val userAnswers = completedUserAnswers .remove(List(OtherMaltedGrainsPage, OtherSpiritsProducedPage, OtherIngredientsUsedPage, SpiritTypePage)) @@ -122,7 +122,7 @@ class CheckYourAnswersControllerSpec extends SpecBase with ModelGenerators { val application = applicationBuilder(userAnswers = Some(userAnswers)) .configure(additionalConfig) .overrides( - bind[CacheConnector].toInstance(mockCacheConnector) + bind[UserAnswersConnector].toInstance(mockUserAnswersConnector) ) .build() @@ -152,9 +152,9 @@ class CheckYourAnswersControllerSpec extends SpecBase with ModelGenerators { } "must return OK and the correct view for a GET if multiple Spirit types including Other are checked" in new SetUp { - val mockCacheConnector = mock[CacheConnector] + val mockUserAnswersConnector = mock[UserAnswersConnector] - when(mockCacheConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) + when(mockUserAnswersConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) val userAnswers = completedUserAnswers .set( @@ -170,7 +170,7 @@ class CheckYourAnswersControllerSpec extends SpecBase with ModelGenerators { val application = applicationBuilder(userAnswers = Some(userAnswers)) .configure(additionalConfig) .overrides( - bind[CacheConnector].toInstance(mockCacheConnector) + bind[UserAnswersConnector].toInstance(mockUserAnswersConnector) ) .build() diff --git a/test/controllers/spiritsQuestions/DeclareQuarterlySpiritsControllerSpec.scala b/test/controllers/spiritsQuestions/DeclareQuarterlySpiritsControllerSpec.scala index d08ee829..315ac310 100644 --- a/test/controllers/spiritsQuestions/DeclareQuarterlySpiritsControllerSpec.scala +++ b/test/controllers/spiritsQuestions/DeclareQuarterlySpiritsControllerSpec.scala @@ -25,7 +25,7 @@ import pages.spiritsQuestions.DeclareQuarterlySpiritsPage import play.api.inject.bind import play.api.mvc.Call import play.api.test.Helpers._ -import connectors.CacheConnector +import connectors.UserAnswersConnector import play.api.Application import uk.gov.hmrc.http.HttpResponse import views.html.spiritsQuestions.DeclareQuarterlySpiritsView @@ -66,16 +66,16 @@ class DeclareQuarterlySpiritsControllerSpec extends SpecBase { } "must redirect to the next page when valid data is submitted" in new SetUp(Some(emptyUserAnswers), true) { - val mockCacheConnector = mock[CacheConnector] + val mockUserAnswersConnector = mock[UserAnswersConnector] - when(mockCacheConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) + when(mockUserAnswersConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) override val application = applicationBuilder(userAnswers = Some(emptyUserAnswers)) .overrides( bind[QuarterlySpiritsQuestionsNavigator] .toInstance(new FakeQuarterlySpiritsQuestionsNavigator(onwardRoute, hasValueChanged = true)), - bind[CacheConnector].toInstance(mockCacheConnector) + bind[UserAnswersConnector].toInstance(mockUserAnswersConnector) ) .build() diff --git a/test/controllers/spiritsQuestions/DeclareSpiritsTotalControllerSpec.scala b/test/controllers/spiritsQuestions/DeclareSpiritsTotalControllerSpec.scala index 922bec4f..3a78bb99 100644 --- a/test/controllers/spiritsQuestions/DeclareSpiritsTotalControllerSpec.scala +++ b/test/controllers/spiritsQuestions/DeclareSpiritsTotalControllerSpec.scala @@ -17,7 +17,7 @@ package controllers.spiritsQuestions import base.SpecBase -import connectors.CacheConnector +import connectors.UserAnswersConnector import forms.spiritsQuestions.DeclareSpiritsTotalFormProvider import models.{NormalMode, UserAnswers} import navigation.{FakeQuarterlySpiritsQuestionsNavigator, QuarterlySpiritsQuestionsNavigator} @@ -71,16 +71,16 @@ class DeclareSpiritsTotalControllerSpec extends SpecBase { } "must redirect to the next page when valid data is submitted" in new SetUp(Some(emptyUserAnswers)) { - val mockCacheConnector = mock[CacheConnector] + val mockUserAnswersConnector = mock[UserAnswersConnector] - when(mockCacheConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) + when(mockUserAnswersConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) override val application = applicationBuilder(userAnswers = Some(emptyUserAnswers)) .overrides( bind[QuarterlySpiritsQuestionsNavigator] .toInstance(new FakeQuarterlySpiritsQuestionsNavigator(onwardRoute, hasValueChanged = true)), - bind[CacheConnector].toInstance(mockCacheConnector) + bind[UserAnswersConnector].toInstance(mockUserAnswersConnector) ) .build() diff --git a/test/controllers/spiritsQuestions/EthyleneGasOrMolassesUsedControllerSpec.scala b/test/controllers/spiritsQuestions/EthyleneGasOrMolassesUsedControllerSpec.scala index f2bf4369..a2798515 100644 --- a/test/controllers/spiritsQuestions/EthyleneGasOrMolassesUsedControllerSpec.scala +++ b/test/controllers/spiritsQuestions/EthyleneGasOrMolassesUsedControllerSpec.scala @@ -27,7 +27,7 @@ import play.api.inject.bind import play.api.libs.json.Json import play.api.mvc.Call import play.api.test.Helpers._ -import connectors.CacheConnector +import connectors.UserAnswersConnector import play.api.Application import uk.gov.hmrc.http.HttpResponse import views.html.spiritsQuestions.EthyleneGasOrMolassesUsedView @@ -85,16 +85,16 @@ class EthyleneGasOrMolassesUsedControllerSpec extends SpecBase { } "must redirect to the next page when valid data is submitted" in new SetUp(Some(emptyUserAnswers)) { - val mockCacheConnector = mock[CacheConnector] + val mockUserAnswersConnector = mock[UserAnswersConnector] - when(mockCacheConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) + when(mockUserAnswersConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) override val application = applicationBuilder(userAnswers = Some(emptyUserAnswers)) .overrides( bind[QuarterlySpiritsQuestionsNavigator] .toInstance(new FakeQuarterlySpiritsQuestionsNavigator(onwardRoute, hasValueChanged = true)), - bind[CacheConnector].toInstance(mockCacheConnector) + bind[UserAnswersConnector].toInstance(mockUserAnswersConnector) ) .build() @@ -117,16 +117,16 @@ class EthyleneGasOrMolassesUsedControllerSpec extends SpecBase { "must redirect to the next page when other ingredients question is answered as No" in new SetUp( Some(emptyUserAnswers) ) { - val mockCacheConnector = mock[CacheConnector] + val mockUserAnswersConnector = mock[UserAnswersConnector] - when(mockCacheConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) + when(mockUserAnswersConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) override val application = applicationBuilder(userAnswers = Some(emptyUserAnswers)) .overrides( bind[QuarterlySpiritsQuestionsNavigator] .toInstance(new FakeQuarterlySpiritsQuestionsNavigator(onwardRoute, hasValueChanged = false)), - bind[CacheConnector].toInstance(mockCacheConnector) + bind[UserAnswersConnector].toInstance(mockUserAnswersConnector) ) .build() @@ -149,16 +149,16 @@ class EthyleneGasOrMolassesUsedControllerSpec extends SpecBase { "must redirect to the next page when other ingredients question was answered Yes previously and is now updated to No" in new SetUp( Some(userAnswers) ) { - val mockCacheConnector = mock[CacheConnector] + val mockUserAnswersConnector = mock[UserAnswersConnector] - when(mockCacheConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) + when(mockUserAnswersConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) override val application = applicationBuilder(userAnswers = Some(userAnswers)) .overrides( bind[QuarterlySpiritsQuestionsNavigator] .toInstance(new FakeQuarterlySpiritsQuestionsNavigator(onwardRoute, hasValueChanged = false)), - bind[CacheConnector].toInstance(mockCacheConnector) + bind[UserAnswersConnector].toInstance(mockUserAnswersConnector) ) .build() diff --git a/test/controllers/spiritsQuestions/GrainsUsedControllerSpec.scala b/test/controllers/spiritsQuestions/GrainsUsedControllerSpec.scala index 26895c58..b56c19d2 100644 --- a/test/controllers/spiritsQuestions/GrainsUsedControllerSpec.scala +++ b/test/controllers/spiritsQuestions/GrainsUsedControllerSpec.scala @@ -26,7 +26,7 @@ import play.api.inject.bind import play.api.libs.json.Json import play.api.mvc.Call import play.api.test.Helpers._ -import connectors.CacheConnector +import connectors.UserAnswersConnector import models.spiritsQuestions.GrainsUsed import play.api.Application import uk.gov.hmrc.http.HttpResponse @@ -97,16 +97,16 @@ class GrainsUsedControllerSpec extends SpecBase { } "must redirect to the next page when valid data is submitted" in new SetUp(Some(emptyUserAnswers)) { - val mockCacheConnector = mock[CacheConnector] + val mockUserAnswersConnector = mock[UserAnswersConnector] - when(mockCacheConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) + when(mockUserAnswersConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) override val application = applicationBuilder(userAnswers = Some(emptyUserAnswers)) .overrides( bind[QuarterlySpiritsQuestionsNavigator] .toInstance(new FakeQuarterlySpiritsQuestionsNavigator(onwardRoute, hasValueChanged = true)), - bind[CacheConnector].toInstance(mockCacheConnector) + bind[UserAnswersConnector].toInstance(mockUserAnswersConnector) ) .build() @@ -132,16 +132,16 @@ class GrainsUsedControllerSpec extends SpecBase { "must redirect to the next page when have you used Malted Grain other than Barley question is answered as No" in new SetUp( Some(emptyUserAnswers) ) { - val mockCacheConnector = mock[CacheConnector] + val mockUserAnswersConnector = mock[UserAnswersConnector] - when(mockCacheConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) + when(mockUserAnswersConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) override val application = applicationBuilder(userAnswers = Some(emptyUserAnswers)) .overrides( bind[QuarterlySpiritsQuestionsNavigator] .toInstance(new FakeQuarterlySpiritsQuestionsNavigator(onwardRoute, hasValueChanged = false)), - bind[CacheConnector].toInstance(mockCacheConnector) + bind[UserAnswersConnector].toInstance(mockUserAnswersConnector) ) .build() @@ -167,16 +167,16 @@ class GrainsUsedControllerSpec extends SpecBase { "must redirect to the next page when have you used Malted Grain other than Barley question was answered Yes previously and is now updated to No" in new SetUp( Some(userAnswers) ) { - val mockCacheConnector = mock[CacheConnector] + val mockUserAnswersConnector = mock[UserAnswersConnector] - when(mockCacheConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) + when(mockUserAnswersConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) override val application = applicationBuilder(userAnswers = Some(userAnswers)) .overrides( bind[QuarterlySpiritsQuestionsNavigator] .toInstance(new FakeQuarterlySpiritsQuestionsNavigator(onwardRoute, hasValueChanged = false)), - bind[CacheConnector].toInstance(mockCacheConnector) + bind[UserAnswersConnector].toInstance(mockUserAnswersConnector) ) .build() diff --git a/test/controllers/spiritsQuestions/OtherIngredientsUsedControllerSpec.scala b/test/controllers/spiritsQuestions/OtherIngredientsUsedControllerSpec.scala index 6d9d72d0..15e47e71 100644 --- a/test/controllers/spiritsQuestions/OtherIngredientsUsedControllerSpec.scala +++ b/test/controllers/spiritsQuestions/OtherIngredientsUsedControllerSpec.scala @@ -25,7 +25,7 @@ import play.api.inject.bind import play.api.libs.json.Json import play.api.mvc.Call import play.api.test.Helpers._ -import connectors.CacheConnector +import connectors.UserAnswersConnector import models.UnitsOfMeasure.Tonnes import models.spiritsQuestions.OtherIngredientsUsed import navigation.{FakeQuarterlySpiritsQuestionsNavigator, QuarterlySpiritsQuestionsNavigator} @@ -83,16 +83,16 @@ class OtherIngredientsUsedControllerSpec extends SpecBase { } "must redirect to the next page when valid data is submitted" in new SetUp(Some(emptyUserAnswers)) { - val mockCacheConnector = mock[CacheConnector] + val mockUserAnswersConnector = mock[UserAnswersConnector] - when(mockCacheConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) + when(mockUserAnswersConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) override val application = applicationBuilder(userAnswers = Some(emptyUserAnswers)) .overrides( bind[QuarterlySpiritsQuestionsNavigator] .toInstance(new FakeQuarterlySpiritsQuestionsNavigator(onwardRoute, hasValueChanged = true)), - bind[CacheConnector].toInstance(mockCacheConnector) + bind[UserAnswersConnector].toInstance(mockUserAnswersConnector) ) .build() diff --git a/test/controllers/spiritsQuestions/OtherMaltedGrainsControllerSpec.scala b/test/controllers/spiritsQuestions/OtherMaltedGrainsControllerSpec.scala index 180e9c33..3c850ccf 100644 --- a/test/controllers/spiritsQuestions/OtherMaltedGrainsControllerSpec.scala +++ b/test/controllers/spiritsQuestions/OtherMaltedGrainsControllerSpec.scala @@ -25,7 +25,7 @@ import play.api.inject.bind import play.api.libs.json.Json import play.api.mvc.Call import play.api.test.Helpers._ -import connectors.CacheConnector +import connectors.UserAnswersConnector import models.spiritsQuestions.OtherMaltedGrains import navigation.{FakeQuarterlySpiritsQuestionsNavigator, QuarterlySpiritsQuestionsNavigator} import play.api.Application @@ -80,16 +80,16 @@ class OtherMaltedGrainsControllerSpec extends SpecBase { } "must redirect to the next page when valid data is submitted" in new SetUp(Some(emptyUserAnswers)) { - val mockCacheConnector = mock[CacheConnector] + val mockUserAnswersConnector = mock[UserAnswersConnector] - when(mockCacheConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) + when(mockUserAnswersConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) override val application = applicationBuilder(userAnswers = Some(emptyUserAnswers)) .overrides( bind[QuarterlySpiritsQuestionsNavigator] .toInstance(new FakeQuarterlySpiritsQuestionsNavigator(onwardRoute, hasValueChanged = true)), - bind[CacheConnector].toInstance(mockCacheConnector) + bind[UserAnswersConnector].toInstance(mockUserAnswersConnector) ) .build() diff --git a/test/controllers/spiritsQuestions/OtherSpiritsProducedControllerSpec.scala b/test/controllers/spiritsQuestions/OtherSpiritsProducedControllerSpec.scala index cb96cb7b..2112f21c 100644 --- a/test/controllers/spiritsQuestions/OtherSpiritsProducedControllerSpec.scala +++ b/test/controllers/spiritsQuestions/OtherSpiritsProducedControllerSpec.scala @@ -24,7 +24,7 @@ import pages.spiritsQuestions.OtherSpiritsProducedPage import play.api.inject.bind import play.api.mvc.Call import play.api.test.Helpers._ -import connectors.CacheConnector +import connectors.UserAnswersConnector import navigation.{FakeQuarterlySpiritsQuestionsNavigator, QuarterlySpiritsQuestionsNavigator} import play.api.Application import uk.gov.hmrc.http.HttpResponse @@ -70,16 +70,16 @@ class OtherSpiritsProducedControllerSpec extends SpecBase { } "must redirect to the next page when valid data is submitted" in new SetUp(Some(emptyUserAnswers)) { - val mockCacheConnector = mock[CacheConnector] + val mockUserAnswersConnector = mock[UserAnswersConnector] - when(mockCacheConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) + when(mockUserAnswersConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) override val application = applicationBuilder(userAnswers = Some(emptyUserAnswers)) .overrides( bind[QuarterlySpiritsQuestionsNavigator] .toInstance(new FakeQuarterlySpiritsQuestionsNavigator(onwardRoute, hasValueChanged = true)), - bind[CacheConnector].toInstance(mockCacheConnector) + bind[UserAnswersConnector].toInstance(mockUserAnswersConnector) ) .build() diff --git a/test/controllers/spiritsQuestions/SpiritTypeControllerSpec.scala b/test/controllers/spiritsQuestions/SpiritTypeControllerSpec.scala index 03468c27..d6849aea 100644 --- a/test/controllers/spiritsQuestions/SpiritTypeControllerSpec.scala +++ b/test/controllers/spiritsQuestions/SpiritTypeControllerSpec.scala @@ -25,7 +25,7 @@ import pages.spiritsQuestions.SpiritTypePage import play.api.inject.bind import play.api.mvc.Call import play.api.test.Helpers._ -import connectors.CacheConnector +import connectors.UserAnswersConnector import play.api.Application import views.html.spiritsQuestions.SpiritTypeView import uk.gov.hmrc.http.HttpResponse @@ -69,16 +69,16 @@ class SpiritTypeControllerSpec extends SpecBase { } "must redirect to the next page when valid data is submitted" in new SetUp(Some(emptyUserAnswers)) { - val mockCacheConnector = mock[CacheConnector] + val mockUserAnswersConnector = mock[UserAnswersConnector] - when(mockCacheConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) + when(mockUserAnswersConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) override val application = applicationBuilder(userAnswers = Some(emptyUserAnswers)) .overrides( bind[QuarterlySpiritsQuestionsNavigator] .toInstance(new FakeQuarterlySpiritsQuestionsNavigator(onwardRoute, hasValueChanged = true)), - bind[CacheConnector].toInstance(mockCacheConnector) + bind[UserAnswersConnector].toInstance(mockUserAnswersConnector) ) .build() @@ -97,16 +97,16 @@ class SpiritTypeControllerSpec extends SpecBase { "must redirect to the next page when valid data is submitted and Other spirit type is unselected" in new SetUp( Some(emptyUserAnswers) ) { - val mockCacheConnector = mock[CacheConnector] + val mockUserAnswersConnector = mock[UserAnswersConnector] - when(mockCacheConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) + when(mockUserAnswersConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) override val application = applicationBuilder(userAnswers = Some(emptyUserAnswers)) .overrides( bind[QuarterlySpiritsQuestionsNavigator] .toInstance(new FakeQuarterlySpiritsQuestionsNavigator(onwardRoute, hasValueChanged = false)), - bind[CacheConnector].toInstance(mockCacheConnector) + bind[UserAnswersConnector].toInstance(mockUserAnswersConnector) ) .build() @@ -130,16 +130,16 @@ class SpiritTypeControllerSpec extends SpecBase { .success .value - val mockCacheConnector = mock[CacheConnector] + val mockUserAnswersConnector = mock[UserAnswersConnector] - when(mockCacheConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) + when(mockUserAnswersConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) override val application = applicationBuilder(userAnswers = Some(userAnswers)) .overrides( bind[QuarterlySpiritsQuestionsNavigator] .toInstance(new FakeQuarterlySpiritsQuestionsNavigator(onwardRoute, hasValueChanged = false)), - bind[CacheConnector].toInstance(mockCacheConnector) + bind[UserAnswersConnector].toInstance(mockUserAnswersConnector) ) .build() diff --git a/test/controllers/spiritsQuestions/WhiskyControllerSpec.scala b/test/controllers/spiritsQuestions/WhiskyControllerSpec.scala index 7cf220cb..7f90fad9 100644 --- a/test/controllers/spiritsQuestions/WhiskyControllerSpec.scala +++ b/test/controllers/spiritsQuestions/WhiskyControllerSpec.scala @@ -27,7 +27,7 @@ import play.api.inject.bind import play.api.libs.json.Json import play.api.mvc.Call import play.api.test.Helpers._ -import connectors.CacheConnector +import connectors.UserAnswersConnector import play.api.Application import uk.gov.hmrc.http.HttpResponse import views.html.spiritsQuestions.WhiskyView @@ -80,16 +80,16 @@ class WhiskyControllerSpec extends SpecBase { } "must redirect to the next page when valid data is submitted" in new SetUp(Some(emptyUserAnswers)) { - val mockCacheConnector = mock[CacheConnector] + val mockUserAnswersConnector = mock[UserAnswersConnector] - when(mockCacheConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) + when(mockUserAnswersConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) override val application = applicationBuilder(userAnswers = Some(emptyUserAnswers)) .overrides( bind[QuarterlySpiritsQuestionsNavigator] .toInstance(new FakeQuarterlySpiritsQuestionsNavigator(onwardRoute, hasValueChanged = true)), - bind[CacheConnector].toInstance(mockCacheConnector) + bind[UserAnswersConnector].toInstance(mockUserAnswersConnector) ) .build() diff --git a/test/viewmodels/BeforeStartReturnViewModelSpec.scala b/test/viewmodels/BeforeStartReturnViewModelSpec.scala index 2aefd5df..92bc54a8 100644 --- a/test/viewmodels/BeforeStartReturnViewModelSpec.scala +++ b/test/viewmodels/BeforeStartReturnViewModelSpec.scala @@ -17,7 +17,7 @@ package viewmodels import base.SpecBase -import connectors.CacheConnector +import connectors.UserAnswersConnector import models.ReturnPeriod import play.api.inject.bind import play.api.test.Helpers.running @@ -29,7 +29,7 @@ import java.time.LocalDate class BeforeStartReturnViewModelSpec extends SpecBase { "WarningTextViewModel" - { - val mockCacheConnector = mock[CacheConnector] + val mockUserAnswersConnector = mock[UserAnswersConnector] "should show the correct message when currentDate is before returnDueDate" in { val currentDate = LocalDate.of(2024, 1, 14) @@ -38,7 +38,7 @@ class BeforeStartReturnViewModelSpec extends SpecBase { val application = applicationBuilder() .overrides( - bind[CacheConnector].toInstance(mockCacheConnector) + bind[UserAnswersConnector].toInstance(mockUserAnswersConnector) ) .build() @@ -64,7 +64,7 @@ class BeforeStartReturnViewModelSpec extends SpecBase { val application = applicationBuilder() .overrides( - bind[CacheConnector].toInstance(mockCacheConnector) + bind[UserAnswersConnector].toInstance(mockUserAnswersConnector) ) .build() @@ -88,7 +88,7 @@ class BeforeStartReturnViewModelSpec extends SpecBase { val application = applicationBuilder() .overrides( - bind[CacheConnector].toInstance(mockCacheConnector) + bind[UserAnswersConnector].toInstance(mockUserAnswersConnector) ) .build() diff --git a/test/viewmodels/checkAnswers/adjustment/AdjustmentListSummaryHelperSpec.scala b/test/viewmodels/checkAnswers/adjustment/AdjustmentListSummaryHelperSpec.scala index 9cd9eeb1..be550a03 100644 --- a/test/viewmodels/checkAnswers/adjustment/AdjustmentListSummaryHelperSpec.scala +++ b/test/viewmodels/checkAnswers/adjustment/AdjustmentListSummaryHelperSpec.scala @@ -114,7 +114,7 @@ class AdjustmentListSummaryHelperSpec extends SpecBase with ScalaCheckPropertyCh val exception = intercept[RuntimeException] { AdjustmentListSummaryHelper.adjustmentEntryTable(userAnswers, total, pageNumber)(getMessages(app)) } - exception.getMessage shouldBe "Couldn't fetch adjustment type value from cache" + exception.getMessage shouldBe "Couldn't fetch adjustment type value from user answers" } }