Skip to content

Commit

Permalink
ADR-1401: Cache renamed as User Answers (#196)
Browse files Browse the repository at this point in the history
  • Loading branch information
msatta authored Nov 8, 2024
1 parent e9a3ac4 commit 5da747d
Show file tree
Hide file tree
Showing 124 changed files with 748 additions and 742 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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))
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ 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,
userAnswersConnector: UserAnswersConnector,
navigator: $section;format="cap"$Navigator,
identify: IdentifyWithEnrolmentAction,
getData: DataRetrievalAction,
Expand Down Expand Up @@ -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))
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ 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,
userAnswersConnector: UserAnswersConnector,
navigator: $section;format="cap"$Navigator,
identify: IdentifyWithEnrolmentAction,
getData: DataRetrievalAction,
Expand Down Expand Up @@ -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))
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ 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,
userAnswersConnector: UserAnswersConnector,
navigator: $section;format="cap"$Navigator,
identify: IdentifyWithEnrolmentAction,
getData: DataRetrievalAction,
Expand Down Expand Up @@ -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))
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ 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,
userAnswersConnector: UserAnswersConnector,
navigator: $section;format="cap"$Navigator,
identify: IdentifyWithEnrolmentAction,
getData: DataRetrievalAction,
Expand Down Expand Up @@ -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))
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ 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,
userAnswersConnector: UserAnswersConnector,
navigator: $section;format="cap"$Navigator,
identify: IdentifyWithEnrolmentAction,
getData: DataRetrievalAction,
Expand Down Expand Up @@ -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))
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ 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,
userAnswersConnector: UserAnswersConnector,
navigator: $section;format="cap"$Navigator,
identify: IdentifyWithEnrolmentAction,
getData: DataRetrievalAction,
Expand Down Expand Up @@ -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))
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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()

Expand Down
Loading

0 comments on commit 5da747d

Please sign in to comment.