diff --git a/app/uk/gov/hmrc/openidconnect/userinfo/config/APIAccessConfig.scala b/app/config/APIAccessConfig.scala similarity index 97% rename from app/uk/gov/hmrc/openidconnect/userinfo/config/APIAccessConfig.scala rename to app/config/APIAccessConfig.scala index d21e4e2..8aa71e5 100644 --- a/app/uk/gov/hmrc/openidconnect/userinfo/config/APIAccessConfig.scala +++ b/app/config/APIAccessConfig.scala @@ -14,7 +14,7 @@ * limitations under the License. */ -package uk.gov.hmrc.openidconnect.userinfo.config +package config import com.typesafe.config.{Config, ConfigObject} diff --git a/app/uk/gov/hmrc/openidconnect/userinfo/config/AppContext.scala b/app/config/AppContext.scala similarity index 97% rename from app/uk/gov/hmrc/openidconnect/userinfo/config/AppContext.scala rename to app/config/AppContext.scala index 0eecc98..854e5ac 100644 --- a/app/uk/gov/hmrc/openidconnect/userinfo/config/AppContext.scala +++ b/app/config/AppContext.scala @@ -14,7 +14,7 @@ * limitations under the License. */ -package uk.gov.hmrc.openidconnect.userinfo.config +package config import javax.inject.{Inject, Singleton} import com.typesafe.config.ConfigObject diff --git a/app/uk/gov/hmrc/openidconnect/userinfo/config/FeatureSwitch.scala b/app/config/FeatureSwitch.scala similarity index 96% rename from app/uk/gov/hmrc/openidconnect/userinfo/config/FeatureSwitch.scala rename to app/config/FeatureSwitch.scala index 12dbf9b..a94787b 100644 --- a/app/uk/gov/hmrc/openidconnect/userinfo/config/FeatureSwitch.scala +++ b/app/config/FeatureSwitch.scala @@ -14,7 +14,7 @@ * limitations under the License. */ -package uk.gov.hmrc.openidconnect.userinfo.config +package config case class FeatureSwitch(name: String, isEnabled: Boolean) diff --git a/app/uk/gov/hmrc/openidconnect/userinfo/config/GuiceModule.scala b/app/config/GuiceModule.scala similarity index 89% rename from app/uk/gov/hmrc/openidconnect/userinfo/config/GuiceModule.scala rename to app/config/GuiceModule.scala index 45eba58..04fee74 100644 --- a/app/uk/gov/hmrc/openidconnect/userinfo/config/GuiceModule.scala +++ b/app/config/GuiceModule.scala @@ -14,15 +14,15 @@ * limitations under the License. */ -package uk.gov.hmrc.openidconnect.userinfo.config +package config import com.google.inject.AbstractModule import com.google.inject.name.Names import com.typesafe.config.Config import play.api.{Configuration, Environment} import uk.gov.hmrc.http.{CorePost, HttpGet} -import uk.gov.hmrc.openidconnect.userinfo.connectors._ -import uk.gov.hmrc.openidconnect.userinfo.services.{LiveUserInfoService, SandboxUserInfoService, UserInfoService} +import connectors._ +import services.{LiveUserInfoService, SandboxUserInfoService, UserInfoService} import uk.gov.hmrc.play.bootstrap.http.{DefaultHttpClient, HttpClient} import uk.gov.hmrc.play.bootstrap.config.ControllerConfig diff --git a/app/uk/gov/hmrc/openidconnect/userinfo/connectors/AuthConnector.scala b/app/connectors/AuthConnector.scala similarity index 93% rename from app/uk/gov/hmrc/openidconnect/userinfo/connectors/AuthConnector.scala rename to app/connectors/AuthConnector.scala index 9e4492e..779a0f1 100644 --- a/app/uk/gov/hmrc/openidconnect/userinfo/connectors/AuthConnector.scala +++ b/app/connectors/AuthConnector.scala @@ -14,7 +14,7 @@ * limitations under the License. */ -package uk.gov.hmrc.openidconnect.userinfo.connectors +package connectors import javax.inject.{Inject, Singleton} @@ -22,8 +22,8 @@ import com.github.ghik.silencer.silent import uk.gov.hmrc.auth.core.retrieve.{Retrievals, ~} import uk.gov.hmrc.auth.core.{AuthorisedFunctions, Enrolments, PlayAuthConnector} import uk.gov.hmrc.http.{CorePost, HeaderCarrier, NotFoundException} -import uk.gov.hmrc.openidconnect.userinfo.domain.{Authority, DesUserInfo, UserDetails} -import uk.gov.hmrc.openidconnect.userinfo.config.AppContext +import domain.{Authority, DesUserInfo, UserDetails} +import config.AppContext import scala.concurrent.{ExecutionContext, Future} diff --git a/app/uk/gov/hmrc/openidconnect/userinfo/connectors/AuthV1UserDetailsFetcher.scala b/app/connectors/AuthV1UserDetailsFetcher.scala similarity index 95% rename from app/uk/gov/hmrc/openidconnect/userinfo/connectors/AuthV1UserDetailsFetcher.scala rename to app/connectors/AuthV1UserDetailsFetcher.scala index 0859cf3..f470dbc 100644 --- a/app/uk/gov/hmrc/openidconnect/userinfo/connectors/AuthV1UserDetailsFetcher.scala +++ b/app/connectors/AuthV1UserDetailsFetcher.scala @@ -14,13 +14,13 @@ * limitations under the License. */ -package uk.gov.hmrc.openidconnect.userinfo.connectors +package connectors import com.github.ghik.silencer.silent import uk.gov.hmrc.auth.core.AuthorisedFunctions import uk.gov.hmrc.auth.core.retrieve.{Retrievals, ~} import uk.gov.hmrc.http.{HeaderCarrier, NotFoundException} -import uk.gov.hmrc.openidconnect.userinfo.domain.UserDetails +import domain.UserDetails import scala.concurrent.{ExecutionContext, Future} diff --git a/app/uk/gov/hmrc/openidconnect/userinfo/connectors/AuthV2UserDetailsFetcher.scala b/app/connectors/AuthV2UserDetailsFetcher.scala similarity index 95% rename from app/uk/gov/hmrc/openidconnect/userinfo/connectors/AuthV2UserDetailsFetcher.scala rename to app/connectors/AuthV2UserDetailsFetcher.scala index f31f5d6..e68dad3 100644 --- a/app/uk/gov/hmrc/openidconnect/userinfo/connectors/AuthV2UserDetailsFetcher.scala +++ b/app/connectors/AuthV2UserDetailsFetcher.scala @@ -14,13 +14,13 @@ * limitations under the License. */ -package uk.gov.hmrc.openidconnect.userinfo.connectors +package connectors import uk.gov.hmrc.auth.core.AuthorisedFunctions import uk.gov.hmrc.auth.core.retrieve.v2.Retrievals import uk.gov.hmrc.auth.core.retrieve.~ import uk.gov.hmrc.http.{HeaderCarrier, NotFoundException} -import uk.gov.hmrc.openidconnect.userinfo.domain.UserDetails +import domain.UserDetails import scala.concurrent.{ExecutionContext, Future} diff --git a/app/uk/gov/hmrc/openidconnect/userinfo/connectors/ThirdPartyDelegatedAuthorityConnector.scala b/app/connectors/ThirdPartyDelegatedAuthorityConnector.scala similarity index 92% rename from app/uk/gov/hmrc/openidconnect/userinfo/connectors/ThirdPartyDelegatedAuthorityConnector.scala rename to app/connectors/ThirdPartyDelegatedAuthorityConnector.scala index 9d8b87f..02a8164 100644 --- a/app/uk/gov/hmrc/openidconnect/userinfo/connectors/ThirdPartyDelegatedAuthorityConnector.scala +++ b/app/connectors/ThirdPartyDelegatedAuthorityConnector.scala @@ -14,14 +14,14 @@ * limitations under the License. */ -package uk.gov.hmrc.openidconnect.userinfo.connectors +package connectors import javax.inject.{Inject, Singleton} import play.api.http.Status import scala.concurrent.{ExecutionContext, Future} import uk.gov.hmrc.http.{HeaderCarrier, HttpGet, HttpResponse, NotFoundException} -import uk.gov.hmrc.openidconnect.userinfo.config.AppContext +import config.AppContext import uk.gov.hmrc.http.HttpReads.Implicits.readRaw import scala.util.control.NonFatal diff --git a/app/uk/gov/hmrc/openidconnect/userinfo/connectors/UserDetailsFetcher.scala b/app/connectors/UserDetailsFetcher.scala similarity index 87% rename from app/uk/gov/hmrc/openidconnect/userinfo/connectors/UserDetailsFetcher.scala rename to app/connectors/UserDetailsFetcher.scala index 3949b6b..43bf5dc 100644 --- a/app/uk/gov/hmrc/openidconnect/userinfo/connectors/UserDetailsFetcher.scala +++ b/app/connectors/UserDetailsFetcher.scala @@ -14,10 +14,10 @@ * limitations under the License. */ -package uk.gov.hmrc.openidconnect.userinfo.connectors +package connectors import uk.gov.hmrc.http.HeaderCarrier -import uk.gov.hmrc.openidconnect.userinfo.domain.UserDetails +import domain.UserDetails import scala.concurrent.{ExecutionContext, Future} diff --git a/app/uk/gov/hmrc/openidconnect/userinfo/controllers/DocumentationController.scala b/app/controllers/DocumentationController.scala similarity index 86% rename from app/uk/gov/hmrc/openidconnect/userinfo/controllers/DocumentationController.scala rename to app/controllers/DocumentationController.scala index e61629b..3169df5 100644 --- a/app/uk/gov/hmrc/openidconnect/userinfo/controllers/DocumentationController.scala +++ b/app/controllers/DocumentationController.scala @@ -14,14 +14,13 @@ * limitations under the License. */ -package uk.gov.hmrc.openidconnect.userinfo.controllers +package controllers import javax.inject.{Inject, Singleton} -import controllers.Assets import play.api.http.HttpErrorHandler import play.api.mvc.{Action, AnyContent, ControllerComponents} -import uk.gov.hmrc.openidconnect.userinfo.config.{APIAccessVersions, AppContext} -import uk.gov.hmrc.openidconnect.userinfo.views._ +import config.{APIAccessVersions, AppContext} +import views._ import scala.language.dynamics diff --git a/app/uk/gov/hmrc/openidconnect/userinfo/controllers/ErrorResponses.scala b/app/controllers/ErrorResponses.scala similarity index 96% rename from app/uk/gov/hmrc/openidconnect/userinfo/controllers/ErrorResponses.scala rename to app/controllers/ErrorResponses.scala index 8a87589..0763c5f 100644 --- a/app/uk/gov/hmrc/openidconnect/userinfo/controllers/ErrorResponses.scala +++ b/app/controllers/ErrorResponses.scala @@ -14,7 +14,7 @@ * limitations under the License. */ -package uk.gov.hmrc.openidconnect.userinfo.controllers +package controllers import play.mvc.Http.Status._ diff --git a/app/uk/gov/hmrc/openidconnect/userinfo/controllers/UserInfoController.scala b/app/controllers/UserInfoController.scala similarity index 93% rename from app/uk/gov/hmrc/openidconnect/userinfo/controllers/UserInfoController.scala rename to app/controllers/UserInfoController.scala index e1fa7af..f29dc1f 100644 --- a/app/uk/gov/hmrc/openidconnect/userinfo/controllers/UserInfoController.scala +++ b/app/controllers/UserInfoController.scala @@ -14,7 +14,7 @@ * limitations under the License. */ -package uk.gov.hmrc.openidconnect.userinfo.controllers +package controllers import javax.inject.{Inject, Singleton} import com.google.inject.name.Named @@ -23,8 +23,8 @@ import play.api.libs.json.Json import play.api.mvc.{AnyContent, BodyParser, ControllerComponents} import uk.gov.hmrc.api.controllers.HeaderValidator import uk.gov.hmrc.http.{BadRequestException, Upstream4xxResponse, Upstream5xxResponse} -import uk.gov.hmrc.openidconnect.userinfo.config.AppContext -import uk.gov.hmrc.openidconnect.userinfo.services.{LiveUserInfoService, SandboxUserInfoService, UserInfoService} +import config.AppContext +import services.{LiveUserInfoService, SandboxUserInfoService, UserInfoService} import uk.gov.hmrc.play.bootstrap.controller.BackendBaseController import scala.concurrent.ExecutionContext diff --git a/app/uk/gov/hmrc/openidconnect/userinfo/controllers/package.scala b/app/controllers/package.scala similarity index 95% rename from app/uk/gov/hmrc/openidconnect/userinfo/controllers/package.scala rename to app/controllers/package.scala index 2cc403c..29cd255 100644 --- a/app/uk/gov/hmrc/openidconnect/userinfo/controllers/package.scala +++ b/app/controllers/package.scala @@ -14,8 +14,6 @@ * limitations under the License. */ -package uk.gov.hmrc.openidconnect.userinfo - import play.api.libs.json.{JsValue, Json, Writes} package object controllers { diff --git a/app/uk/gov/hmrc/openidconnect/userinfo/controllers/testOnly/FeatureSwitchController.scala b/app/controllers/testOnly/FeatureSwitchController.scala similarity index 93% rename from app/uk/gov/hmrc/openidconnect/userinfo/controllers/testOnly/FeatureSwitchController.scala rename to app/controllers/testOnly/FeatureSwitchController.scala index 55700bf..6ab05d1 100644 --- a/app/uk/gov/hmrc/openidconnect/userinfo/controllers/testOnly/FeatureSwitchController.scala +++ b/app/controllers/testOnly/FeatureSwitchController.scala @@ -14,12 +14,12 @@ * limitations under the License. */ -package uk.gov.hmrc.openidconnect.userinfo.controllers.testOnly +package controllers.testOnly import javax.inject.{Inject, Singleton} import play.api.libs.json.Json import play.api.mvc.{Action, ControllerComponents} -import uk.gov.hmrc.openidconnect.userinfo.config.{FeatureSwitch, UserInfoFeatureSwitches} +import config.{FeatureSwitch, UserInfoFeatureSwitches} import uk.gov.hmrc.play.bootstrap.controller.BackendController import scala.concurrent.ExecutionContext.Implicits.global diff --git a/app/uk/gov/hmrc/openidconnect/userinfo/data/UserInfoGenerator.scala b/app/data/UserInfoGenerator.scala similarity index 95% rename from app/uk/gov/hmrc/openidconnect/userinfo/data/UserInfoGenerator.scala rename to app/data/UserInfoGenerator.scala index 99d52ef..3ff79b4 100644 --- a/app/uk/gov/hmrc/openidconnect/userinfo/data/UserInfoGenerator.scala +++ b/app/data/UserInfoGenerator.scala @@ -14,14 +14,14 @@ * limitations under the License. */ -package uk.gov.hmrc.openidconnect.userinfo.data +package data import javax.inject.Singleton import org.joda.time._ import org.scalacheck.Gen import uk.gov.hmrc.auth.core.{Enrolment, EnrolmentIdentifier} -import uk.gov.hmrc.openidconnect.userinfo.config.UserInfoFeatureSwitches -import uk.gov.hmrc.openidconnect.userinfo.domain.{Address, GovernmentGatewayDetails, Mdtp, UserInfo} +import config.UserInfoFeatureSwitches +import domain.{Address, GovernmentGatewayDetails, Mdtp, UserInfo} @Singleton class UserInfoGenerator { diff --git a/app/uk/gov/hmrc/openidconnect/userinfo/domain/APIDefinition.scala b/app/domain/APIDefinition.scala similarity index 93% rename from app/uk/gov/hmrc/openidconnect/userinfo/domain/APIDefinition.scala rename to app/domain/APIDefinition.scala index d4773f2..9c68d62 100644 --- a/app/uk/gov/hmrc/openidconnect/userinfo/domain/APIDefinition.scala +++ b/app/domain/APIDefinition.scala @@ -14,6 +14,6 @@ * limitations under the License. */ -package uk.gov.hmrc.openidconnect.userinfo.domain +package domain case class APIAccess(`type`: String, allowlistedApplicationIds: Option[Seq[String]]) diff --git a/app/uk/gov/hmrc/openidconnect/userinfo/domain/Authority.scala b/app/domain/Authority.scala similarity index 93% rename from app/uk/gov/hmrc/openidconnect/userinfo/domain/Authority.scala rename to app/domain/Authority.scala index ba61b4d..0e564ca 100644 --- a/app/uk/gov/hmrc/openidconnect/userinfo/domain/Authority.scala +++ b/app/domain/Authority.scala @@ -14,7 +14,7 @@ * limitations under the License. */ -package uk.gov.hmrc.openidconnect.userinfo.domain +package domain case class Authority(credId: String, nino: Option[String] = None) diff --git a/app/uk/gov/hmrc/openidconnect/userinfo/domain/Enrolment.scala b/app/domain/Enrolment.scala similarity index 94% rename from app/uk/gov/hmrc/openidconnect/userinfo/domain/Enrolment.scala rename to app/domain/Enrolment.scala index 2f65588..13b0f50 100644 --- a/app/uk/gov/hmrc/openidconnect/userinfo/domain/Enrolment.scala +++ b/app/domain/Enrolment.scala @@ -14,7 +14,7 @@ * limitations under the License. */ -package uk.gov.hmrc.openidconnect.userinfo.domain +package domain import uk.gov.hmrc.auth.core.Enrolment diff --git a/app/uk/gov/hmrc/openidconnect/userinfo/domain/GovernmentGatewayDetails.scala b/app/domain/GovernmentGatewayDetails.scala similarity index 95% rename from app/uk/gov/hmrc/openidconnect/userinfo/domain/GovernmentGatewayDetails.scala rename to app/domain/GovernmentGatewayDetails.scala index 0f439b3..68eda0a 100644 --- a/app/uk/gov/hmrc/openidconnect/userinfo/domain/GovernmentGatewayDetails.scala +++ b/app/domain/GovernmentGatewayDetails.scala @@ -14,7 +14,7 @@ * limitations under the License. */ -package uk.gov.hmrc.openidconnect.userinfo.domain +package domain case class GovernmentGatewayDetails( user_id: Option[String], diff --git a/app/uk/gov/hmrc/openidconnect/userinfo/domain/NinoNotFoundException.scala b/app/domain/NinoNotFoundException.scala similarity index 92% rename from app/uk/gov/hmrc/openidconnect/userinfo/domain/NinoNotFoundException.scala rename to app/domain/NinoNotFoundException.scala index 2310cfe..1a8be7e 100644 --- a/app/uk/gov/hmrc/openidconnect/userinfo/domain/NinoNotFoundException.scala +++ b/app/domain/NinoNotFoundException.scala @@ -14,6 +14,6 @@ * limitations under the License. */ -package uk.gov.hmrc.openidconnect.userinfo.domain +package domain case class NinoNotFoundException() extends Exception diff --git a/app/uk/gov/hmrc/openidconnect/userinfo/domain/UserDetails.scala b/app/domain/UserDetails.scala similarity index 97% rename from app/uk/gov/hmrc/openidconnect/userinfo/domain/UserDetails.scala rename to app/domain/UserDetails.scala index b8cbfdf..4511951 100644 --- a/app/uk/gov/hmrc/openidconnect/userinfo/domain/UserDetails.scala +++ b/app/domain/UserDetails.scala @@ -14,7 +14,7 @@ * limitations under the License. */ -package uk.gov.hmrc.openidconnect.userinfo.domain +package domain import org.joda.time.LocalDate import uk.gov.hmrc.auth.core.retrieve.{GatewayInformation, MdtpInformation} diff --git a/app/uk/gov/hmrc/openidconnect/userinfo/domain/UserInfo.scala b/app/domain/UserInfo.scala similarity index 98% rename from app/uk/gov/hmrc/openidconnect/userinfo/domain/UserInfo.scala rename to app/domain/UserInfo.scala index d0135a2..03a5d91 100644 --- a/app/uk/gov/hmrc/openidconnect/userinfo/domain/UserInfo.scala +++ b/app/domain/UserInfo.scala @@ -14,7 +14,7 @@ * limitations under the License. */ -package uk.gov.hmrc.openidconnect.userinfo.domain +package domain import org.joda.time.LocalDate import uk.gov.hmrc.auth.core.Enrolment diff --git a/app/uk/gov/hmrc/openidconnect/userinfo/domain/package.scala b/app/domain/package.scala similarity index 97% rename from app/uk/gov/hmrc/openidconnect/userinfo/domain/package.scala rename to app/domain/package.scala index 05b6fbb..fe3876d 100644 --- a/app/uk/gov/hmrc/openidconnect/userinfo/domain/package.scala +++ b/app/domain/package.scala @@ -14,8 +14,6 @@ * limitations under the License. */ -package uk.gov.hmrc.openidconnect.userinfo - import org.joda.time._ import play.api.libs.json._ import uk.gov.hmrc.auth.core.retrieve.{GatewayInformation, ItmpAddress, ItmpName, MdtpInformation} diff --git a/app/uk/gov/hmrc/openidconnect/userinfo/filters/MicroserviceAuthFilter.scala b/app/filters/MicroserviceAuthFilter.scala similarity index 91% rename from app/uk/gov/hmrc/openidconnect/userinfo/filters/MicroserviceAuthFilter.scala rename to app/filters/MicroserviceAuthFilter.scala index 6ff0b84..d19027c 100644 --- a/app/uk/gov/hmrc/openidconnect/userinfo/filters/MicroserviceAuthFilter.scala +++ b/app/filters/MicroserviceAuthFilter.scala @@ -14,7 +14,7 @@ * limitations under the License. */ -package uk.gov.hmrc.openidconnect.userinfo.filters +package filters import akka.stream.Materializer import javax.inject.{Inject, Singleton} @@ -23,8 +23,8 @@ import play.api.libs.json.Json import play.api.mvc.{Filter, RequestHeader, Result, Results} import play.api.routing.Router import uk.gov.hmrc.auth.core.{AuthorisationException, AuthorisedFunctions} -import uk.gov.hmrc.openidconnect.userinfo.connectors.AuthConnector -import uk.gov.hmrc.openidconnect.userinfo.controllers.ErrorUnauthorized +import connectors.AuthConnector +import controllers.ErrorUnauthorized import uk.gov.hmrc.play.HeaderCarrierConverter import scala.concurrent.{ExecutionContext, Future} diff --git a/app/uk/gov/hmrc/openidconnect/userinfo/filters/MicroserviceFilters.scala b/app/filters/MicroserviceFilters.scala similarity index 95% rename from app/uk/gov/hmrc/openidconnect/userinfo/filters/MicroserviceFilters.scala rename to app/filters/MicroserviceFilters.scala index 3abdc87..ff44839 100644 --- a/app/uk/gov/hmrc/openidconnect/userinfo/filters/MicroserviceFilters.scala +++ b/app/filters/MicroserviceFilters.scala @@ -14,7 +14,7 @@ * limitations under the License. */ -package uk.gov.hmrc.openidconnect.userinfo.filters +package filters import javax.inject.{Inject, Singleton} import com.kenshoo.play.metrics.MetricsFilter diff --git a/app/uk/gov/hmrc/openidconnect/userinfo/handlers/ErrorHandler.scala b/app/handlers/ErrorHandler.scala similarity index 92% rename from app/uk/gov/hmrc/openidconnect/userinfo/handlers/ErrorHandler.scala rename to app/handlers/ErrorHandler.scala index fa7f3dc..be2c54f 100644 --- a/app/uk/gov/hmrc/openidconnect/userinfo/handlers/ErrorHandler.scala +++ b/app/handlers/ErrorHandler.scala @@ -14,7 +14,7 @@ * limitations under the License. */ -package uk.gov.hmrc.openidconnect.userinfo.handlers +package handlers import javax.inject.{Inject, Singleton} import com.google.inject.Provider @@ -24,7 +24,7 @@ import play.api.mvc.Results.Status import play.api.mvc.{RequestHeader, Result} import play.api.routing.Router import play.api.{Configuration, Environment, OptionalSourceMapper} -import uk.gov.hmrc.openidconnect.userinfo.controllers.{ErrorBadGateway, ErrorUnauthorized} +import controllers.{ErrorBadGateway, ErrorUnauthorized} import scala.concurrent.{ExecutionContext, Future} @Singleton diff --git a/app/uk/gov/hmrc/openidconnect/userinfo/services/UserInfoService.scala b/app/services/UserInfoService.scala similarity index 92% rename from app/uk/gov/hmrc/openidconnect/userinfo/services/UserInfoService.scala rename to app/services/UserInfoService.scala index b3d1183..97cd115 100644 --- a/app/uk/gov/hmrc/openidconnect/userinfo/services/UserInfoService.scala +++ b/app/services/UserInfoService.scala @@ -14,7 +14,7 @@ * limitations under the License. */ -package uk.gov.hmrc.openidconnect.userinfo.services +package services import javax.inject.{Inject, Named, Singleton} @@ -22,10 +22,10 @@ import org.scalacheck.Gen import uk.gov.hmrc.auth.core.Enrolments import uk.gov.hmrc.http.logging.Authorization import uk.gov.hmrc.http.{BadRequestException, HeaderCarrier, UnauthorizedException} -import uk.gov.hmrc.openidconnect.userinfo.connectors._ -import uk.gov.hmrc.openidconnect.userinfo.controllers.{Version, Version_1_0, Version_1_1} -import uk.gov.hmrc.openidconnect.userinfo.data.UserInfoGenerator -import uk.gov.hmrc.openidconnect.userinfo.domain._ +import connectors._ +import controllers.{Version, Version_1_0, Version_1_1} +import data.UserInfoGenerator +import domain._ import scala.concurrent.ExecutionContext.Implicits.global import scala.concurrent.Future diff --git a/app/uk/gov/hmrc/openidconnect/userinfo/services/UserInfoTransformer.scala b/app/services/UserInfoTransformer.scala similarity index 96% rename from app/uk/gov/hmrc/openidconnect/userinfo/services/UserInfoTransformer.scala rename to app/services/UserInfoTransformer.scala index 274d728..edc343e 100644 --- a/app/uk/gov/hmrc/openidconnect/userinfo/services/UserInfoTransformer.scala +++ b/app/services/UserInfoTransformer.scala @@ -14,14 +14,14 @@ * limitations under the License. */ -package uk.gov.hmrc.openidconnect.userinfo.services +package services import javax.inject.Singleton import org.joda.time.LocalDate import uk.gov.hmrc.auth.core.Enrolments import uk.gov.hmrc.auth.core.retrieve.ItmpAddress -import uk.gov.hmrc.openidconnect.userinfo.config.UserInfoFeatureSwitches -import uk.gov.hmrc.openidconnect.userinfo.domain._ +import config.UserInfoFeatureSwitches +import domain._ @Singleton class UserInfoTransformer { diff --git a/app/uk/gov/hmrc/openidconnect/userinfo/views/definition.scala.txt b/app/views/definition.scala.txt similarity index 97% rename from app/uk/gov/hmrc/openidconnect/userinfo/views/definition.scala.txt rename to app/views/definition.scala.txt index 83fd88d..e2ee84f 100644 --- a/app/uk/gov/hmrc/openidconnect/userinfo/views/definition.scala.txt +++ b/app/views/definition.scala.txt @@ -1,4 +1,4 @@ -@import uk.gov.hmrc.openidconnect.userinfo.config.APIAccessConfig +@import config.APIAccessConfig @import play.api.libs.json.Json @(versions: List[APIAccessConfig]) diff --git a/conf/application.conf b/conf/application.conf index 7cacd4a..462b581 100644 --- a/conf/application.conf +++ b/conf/application.conf @@ -30,13 +30,13 @@ play.modules.enabled += "uk.gov.hmrc.play.bootstrap.MicroserviceModule" play.http.requestHandler = "uk.gov.hmrc.play.bootstrap.http.RequestHandler" play.modules.enabled += "uk.gov.hmrc.play.bootstrap.AuthModule" -play.modules.enabled += "uk.gov.hmrc.openidconnect.userinfo.config.GuiceModule" +play.modules.enabled += "config.GuiceModule" -play.http.filters = "uk.gov.hmrc.openidconnect.userinfo.filters.MicroserviceFilters" +play.http.filters = "filters.MicroserviceFilters" play.application.loader = "uk.gov.hmrc.play.bootstrap.ApplicationLoader" -play.http.errorHandler = "uk.gov.hmrc.openidconnect.userinfo.handlers.ErrorHandler" +play.http.errorHandler = "handlers.ErrorHandler" appUrl="https://"${appName}".protected.mdtp" @@ -86,26 +86,26 @@ controllers { needsAuditing = false } - uk.gov.hmrc.openidconnect.userinfo.controllers.DocumentationController = { + controllers.DocumentationController = { needsAuth = false needsLogging = true needsAuditing = false } - uk.gov.hmrc.openidconnect.userinfo.controllers.LiveUserInfoController = { + controllers.LiveUserInfoController = { needsAuth = true needsLogging = true needsAuditing = false authParams.pattern = "/([\\d\\w-]+).*" } - uk.gov.hmrc.openidconnect.userinfo.controllers.SandboxUserInfoController = { + controllers.SandboxUserInfoController = { needsAuth = false needsLogging = true needsAuditing = false } - uk.gov.hmrc.openidconnect.userinfo.controllers.testOnly.FeatureSwitchController = { + controllers.testOnly.FeatureSwitchController = { needsAuth = false needsLogging = true needsAuditing = false diff --git a/conf/definition.routes b/conf/definition.routes index 58a52d7..3bb7a8d 100644 --- a/conf/definition.routes +++ b/conf/definition.routes @@ -1,2 +1,2 @@ -GET /api/definition @uk.gov.hmrc.openidconnect.userinfo.controllers.DocumentationController.definition() -GET /api/conf/:version/*filename @uk.gov.hmrc.openidconnect.userinfo.controllers.DocumentationController.ramlDocs(version, filename) +GET /api/definition @controllers.DocumentationController.definition() +GET /api/conf/:version/*filename @controllers.DocumentationController.ramlDocs(version, filename) diff --git a/conf/live.routes b/conf/live.routes index 03a163b..d076547 100644 --- a/conf/live.routes +++ b/conf/live.routes @@ -1,2 +1,2 @@ -GET / @uk.gov.hmrc.openidconnect.userinfo.controllers.LiveUserInfoController.userInfo -POST / @uk.gov.hmrc.openidconnect.userinfo.controllers.LiveUserInfoController.userInfo +GET / @controllers.LiveUserInfoController.userInfo +POST / @controllers.LiveUserInfoController.userInfo diff --git a/conf/sandbox.routes b/conf/sandbox.routes index 79e42bd..acd4e81 100644 --- a/conf/sandbox.routes +++ b/conf/sandbox.routes @@ -1,2 +1,2 @@ -GET / @uk.gov.hmrc.openidconnect.userinfo.controllers.SandboxUserInfoController.userInfo -POST / @uk.gov.hmrc.openidconnect.userinfo.controllers.SandboxUserInfoController.userInfo \ No newline at end of file +GET / @controllers.SandboxUserInfoController.userInfo +POST / @controllers.SandboxUserInfoController.userInfo \ No newline at end of file diff --git a/conf/testOnlyDoNotUseInAppConf.routes b/conf/testOnlyDoNotUseInAppConf.routes index ee6a58a..b2aeb71 100644 --- a/conf/testOnlyDoNotUseInAppConf.routes +++ b/conf/testOnlyDoNotUseInAppConf.routes @@ -1,4 +1,4 @@ -GET /feature-switches @uk.gov.hmrc.openidconnect.userinfo.controllers.testOnly.FeatureSwitchController.getFlags -POST /feature-switches @uk.gov.hmrc.openidconnect.userinfo.controllers.testOnly.FeatureSwitchController.setFlags +GET /feature-switches @controllers.testOnly.FeatureSwitchController.getFlags +POST /feature-switches @controllers.testOnly.FeatureSwitchController.setFlags -> / prod.Routes \ No newline at end of file diff --git a/it/unit/uk/gov/hmrc/openidconnect/BaseFeatureISpec.scala b/it/BaseFeatureISpec.scala similarity index 83% rename from it/unit/uk/gov/hmrc/openidconnect/BaseFeatureISpec.scala rename to it/BaseFeatureISpec.scala index 82f1bce..ec9df8b 100644 --- a/it/unit/uk/gov/hmrc/openidconnect/BaseFeatureISpec.scala +++ b/it/BaseFeatureISpec.scala @@ -1,23 +1,20 @@ -package unit.uk.gov.hmrc.openidconnect - import com.github.tomakehurst.wiremock.WireMockServer import com.github.tomakehurst.wiremock.client.WireMock import com.github.tomakehurst.wiremock.client.WireMock.{aResponse, post, stubFor, urlPathMatching} import com.github.tomakehurst.wiremock.core.WireMockConfiguration.wireMockConfig import org.scalatest._ import uk.gov.hmrc.integration.ServiceSpec -import scala.concurrent.duration._ -import scala.concurrent.duration.Duration +import scala.concurrent.duration.{Duration,_} import scala.concurrent.{Await, Future} trait BaseFeatureISpec extends FeatureSpec - with GivenWhenThen - with Matchers - with ServiceSpec - with BeforeAndAfterEach - with BeforeAndAfterAll { + with GivenWhenThen + with Matchers + with ServiceSpec + with BeforeAndAfterEach + with BeforeAndAfterAll { implicit val timeout: Duration = 1.minutes diff --git a/it/unit/uk/gov/hmrc/openidconnect/FeatureSwitchControllerISpec.scala b/it/FeatureSwitchControllerISpec.scala similarity index 95% rename from it/unit/uk/gov/hmrc/openidconnect/FeatureSwitchControllerISpec.scala rename to it/FeatureSwitchControllerISpec.scala index 726c306..715ac13 100644 --- a/it/unit/uk/gov/hmrc/openidconnect/FeatureSwitchControllerISpec.scala +++ b/it/FeatureSwitchControllerISpec.scala @@ -1,7 +1,5 @@ -package unit.uk.gov.hmrc.openidconnect - import play.api.libs.json.Json -import scalaj.http.{Http, HttpOptions} +import scalaj.http.Http class FeatureSwitchControllerISpec extends BaseFeatureISpec { diff --git a/it/unit/uk/gov/hmrc/openidconnect/PlatformIntegrationISpec.scala b/it/PlatformIntegrationISpec.scala similarity index 99% rename from it/unit/uk/gov/hmrc/openidconnect/PlatformIntegrationISpec.scala rename to it/PlatformIntegrationISpec.scala index 1671f90..b2c84d0 100644 --- a/it/unit/uk/gov/hmrc/openidconnect/PlatformIntegrationISpec.scala +++ b/it/PlatformIntegrationISpec.scala @@ -14,8 +14,6 @@ * limitations under the License. */ -package unit.uk.gov.hmrc.openidconnect - import org.scalatest.concurrent.ScalaFutures import play.api.libs.json._ import play.api.libs.ws.WSClient diff --git a/it/unit/uk/gov/hmrc/openidconnect/SchemaISpec.scala b/it/SchemaISpec.scala similarity index 97% rename from it/unit/uk/gov/hmrc/openidconnect/SchemaISpec.scala rename to it/SchemaISpec.scala index aa6e4d6..de8444c 100644 --- a/it/unit/uk/gov/hmrc/openidconnect/SchemaISpec.scala +++ b/it/SchemaISpec.scala @@ -14,8 +14,6 @@ * limitations under the License. */ -package unit.uk.gov.hmrc.openidconnect - import java.nio.file.Paths import com.fasterxml.jackson.databind.ObjectMapper diff --git a/it/unit/uk/gov/hmrc/openidconnect/UserInfoServiceISpec.scala b/it/UserInfoServiceISpec.scala similarity index 98% rename from it/unit/uk/gov/hmrc/openidconnect/UserInfoServiceISpec.scala rename to it/UserInfoServiceISpec.scala index 69cec9b..ea5ccfa 100644 --- a/it/unit/uk/gov/hmrc/openidconnect/UserInfoServiceISpec.scala +++ b/it/UserInfoServiceISpec.scala @@ -14,13 +14,14 @@ * limitations under the License. */ -package unit.uk.gov.hmrc.openidconnect - import java.nio.file.Paths import com.fasterxml.jackson.databind.ObjectMapper import com.github.fge.jsonschema.core.report.LogLevel import com.github.fge.jsonschema.main.JsonSchemaFactory +import config.{FeatureSwitch, UserInfoFeatureSwitches} +import controllers.Version_1_1 +import domain._ import it.stubs.{AuthStub, ThirdPartyDelegatedAuthorityStub} import org.joda.time.LocalDate import play.api.libs.json.Json @@ -28,9 +29,6 @@ import scalaj.http.{Http, HttpOptions} import uk.gov.hmrc.auth.core._ import uk.gov.hmrc.auth.core.retrieve._ import uk.gov.hmrc.domain.Nino -import uk.gov.hmrc.openidconnect.userinfo.config.{FeatureSwitch, UserInfoFeatureSwitches} -import uk.gov.hmrc.openidconnect.userinfo.controllers.Version_1_1 -import uk.gov.hmrc.openidconnect.userinfo.domain.{Address, DesUserInfo, GovernmentGatewayDetails, Mdtp, UserInfo} class UserInfoServiceISpec extends BaseFeatureISpec with AuthStub with ThirdPartyDelegatedAuthorityStub { diff --git a/it/unit/uk/gov/hmrc/openidconnect/stubs/AuthStub.scala b/it/stubs/AuthStub.scala similarity index 98% rename from it/unit/uk/gov/hmrc/openidconnect/stubs/AuthStub.scala rename to it/stubs/AuthStub.scala index 204976c..5d867b1 100644 --- a/it/unit/uk/gov/hmrc/openidconnect/stubs/AuthStub.scala +++ b/it/stubs/AuthStub.scala @@ -23,8 +23,8 @@ import uk.gov.hmrc.auth.core.retrieve.v2.{Retrievals => V2Retrievals} import uk.gov.hmrc.auth.core.{AffinityGroup, CredentialRole} import uk.gov.hmrc.domain.Nino import uk.gov.hmrc.http.controllers.RestFormats.localDateFormats -import uk.gov.hmrc.openidconnect.userinfo.controllers.{Version, Version_1_0, Version_1_1} -import uk.gov.hmrc.openidconnect.userinfo.domain.{DesUserInfo, _} +import controllers.{Version, Version_1_0, Version_1_1} +import domain.{DesUserInfo, _} import com.github.ghik.silencer.silent @silent trait AuthStub { diff --git a/it/unit/uk/gov/hmrc/openidconnect/stubs/ThirdPartyDelegatedAuthorityStub.scala b/it/stubs/ThirdPartyDelegatedAuthorityStub.scala similarity index 100% rename from it/unit/uk/gov/hmrc/openidconnect/stubs/ThirdPartyDelegatedAuthorityStub.scala rename to it/stubs/ThirdPartyDelegatedAuthorityStub.scala diff --git a/test/unit/uk/gov/hmrc/openidconnect/userinfo/config/APIAccessConfigSpec.scala b/test/config/APIAccessConfigSpec.scala similarity index 94% rename from test/unit/uk/gov/hmrc/openidconnect/userinfo/config/APIAccessConfigSpec.scala rename to test/config/APIAccessConfigSpec.scala index 0bab0e0..2678e89 100644 --- a/test/unit/uk/gov/hmrc/openidconnect/userinfo/config/APIAccessConfigSpec.scala +++ b/test/config/APIAccessConfigSpec.scala @@ -14,12 +14,11 @@ * limitations under the License. */ -package unit.uk.gov.hmrc.openidconnect.userinfo.config +package config import com.typesafe.config.ConfigObject import play.api.Configuration -import uk.gov.hmrc.openidconnect.userinfo.config.{APIAccessConfig, APIAccessVersions} -import unit.uk.gov.hmrc.openidconnect.UnitSpec +import testSupport.UnitSpec class APIAccessConfigSpec extends UnitSpec { val configuration: Configuration = Configuration.from(Map( diff --git a/test/unit/uk/gov/hmrc/openidconnect/userinfo/connectors/ThirdPartyDelegatedAuthorityConnectorSpec.scala b/test/connectors/ThirdPartyDelegatedAuthorityConnectorSpec.scala similarity index 92% rename from test/unit/uk/gov/hmrc/openidconnect/userinfo/connectors/ThirdPartyDelegatedAuthorityConnectorSpec.scala rename to test/connectors/ThirdPartyDelegatedAuthorityConnectorSpec.scala index c81d269..2aa609a 100644 --- a/test/unit/uk/gov/hmrc/openidconnect/userinfo/connectors/ThirdPartyDelegatedAuthorityConnectorSpec.scala +++ b/test/connectors/ThirdPartyDelegatedAuthorityConnectorSpec.scala @@ -14,7 +14,7 @@ * limitations under the License. */ -package unit.uk.gov.hmrc.openidconnect.userinfo.connectors +package connectors import com.github.tomakehurst.wiremock.WireMockServer import com.github.tomakehurst.wiremock.client.WireMock @@ -24,12 +24,12 @@ import org.scalatest.BeforeAndAfterEach import org.scalatest.mockito.MockitoSugar import org.mockito.Mockito._ import org.scalatestplus.play.guice.GuiceOneAppPerSuite -import uk.gov.hmrc.openidconnect.userinfo.config.AppContext -import uk.gov.hmrc.openidconnect.userinfo.connectors.ThirdPartyDelegatedAuthorityConnector +import config.AppContext import uk.gov.hmrc.http.HeaderCarrier import uk.gov.hmrc.play.bootstrap.http.HttpClient -import unit.uk.gov.hmrc.openidconnect.UnitSpec + import scala.concurrent.ExecutionContext.Implicits.global +import testSupport.UnitSpec class ThirdPartyDelegatedAuthorityConnectorSpec extends UnitSpec with MockitoSugar with BeforeAndAfterEach with GuiceOneAppPerSuite { diff --git a/test/unit/uk/gov/hmrc/openidconnect/userinfo/controllers/ErrorResponseSpec.scala b/test/controllers/ErrorResponseSpec.scala similarity index 84% rename from test/unit/uk/gov/hmrc/openidconnect/userinfo/controllers/ErrorResponseSpec.scala rename to test/controllers/ErrorResponseSpec.scala index 47914c6..e75662c 100644 --- a/test/unit/uk/gov/hmrc/openidconnect/userinfo/controllers/ErrorResponseSpec.scala +++ b/test/controllers/ErrorResponseSpec.scala @@ -14,12 +14,11 @@ * limitations under the License. */ -package unit.uk.gov.hmrc.openidconnect.userinfo.controllers +package controllers import org.scalatest.Matchers import play.api.libs.json.Json -import uk.gov.hmrc.openidconnect.userinfo.controllers.ErrorAcceptHeaderInvalid -import unit.uk.gov.hmrc.openidconnect.UnitSpec +import testSupport.UnitSpec class ErrorResponseSpec extends UnitSpec with Matchers { "errorResponse" should { diff --git a/test/unit/uk/gov/hmrc/openidconnect/userinfo/controllers/UserInfoControllerSpec.scala b/test/controllers/UserInfoControllerSpec.scala similarity index 91% rename from test/unit/uk/gov/hmrc/openidconnect/userinfo/controllers/UserInfoControllerSpec.scala rename to test/controllers/UserInfoControllerSpec.scala index 30c760f..0417677 100644 --- a/test/unit/uk/gov/hmrc/openidconnect/userinfo/controllers/UserInfoControllerSpec.scala +++ b/test/controllers/UserInfoControllerSpec.scala @@ -14,7 +14,7 @@ * limitations under the License. */ -package unit.uk.gov.hmrc.openidconnect.userinfo.controllers +package controllers import akka.actor.ActorSystem import akka.stream.ActorMaterializer @@ -29,13 +29,12 @@ import play.api.mvc.ControllerComponents import play.api.test.FakeRequest import uk.gov.hmrc.auth.core.{Enrolment, EnrolmentIdentifier} import uk.gov.hmrc.http.{BadRequestException, HeaderCarrier} -import uk.gov.hmrc.openidconnect.userinfo.config.AppContext -import uk.gov.hmrc.openidconnect.userinfo.controllers.{ErrorBadRequest, LiveUserInfoController, SandboxUserInfoController, Version_1_0, Version_1_1} -import uk.gov.hmrc.openidconnect.userinfo.domain.{Address, GovernmentGatewayDetails, UserInfo} -import uk.gov.hmrc.openidconnect.userinfo.services.{LiveUserInfoService, SandboxUserInfoService} -import unit.uk.gov.hmrc.openidconnect.UnitSpec +import config.AppContext +import domain.{Address, GovernmentGatewayDetails, UserInfo} +import services.{LiveUserInfoService, SandboxUserInfoService} import scala.concurrent.{ExecutionContext, Future} +import testSupport.UnitSpec class UserInfoControllerSpec(implicit val cc: ControllerComponents, ex: ExecutionContext) extends UnitSpec with MockitoSugar with ScalaFutures { diff --git a/test/unit/uk/gov/hmrc/openidconnect/userinfo/controllers/testOnly/FeatureSwitchControllerSpec.scala b/test/controllers/testOnly/FeatureSwitchControllerSpec.scala similarity index 90% rename from test/unit/uk/gov/hmrc/openidconnect/userinfo/controllers/testOnly/FeatureSwitchControllerSpec.scala rename to test/controllers/testOnly/FeatureSwitchControllerSpec.scala index 00736c6..dabd8c3 100644 --- a/test/unit/uk/gov/hmrc/openidconnect/userinfo/controllers/testOnly/FeatureSwitchControllerSpec.scala +++ b/test/controllers/testOnly/FeatureSwitchControllerSpec.scala @@ -14,7 +14,7 @@ * limitations under the License. */ -package unit.uk.gov.hmrc.openidconnect.userinfo.controllers.testOnly +package controllers.testOnly import akka.actor.ActorSystem import akka.stream.ActorMaterializer @@ -22,9 +22,8 @@ import org.scalatest.concurrent.ScalaFutures import play.api.libs.json._ import play.api.mvc.{ControllerComponents, Request, Result} import play.api.test.FakeRequest -import uk.gov.hmrc.openidconnect.userinfo.config.{FeatureSwitch, UserInfoFeatureSwitches} -import uk.gov.hmrc.openidconnect.userinfo.controllers.testOnly.FeatureSwitchController -import unit.uk.gov.hmrc.openidconnect.UnitSpec +import config.{FeatureSwitch, UserInfoFeatureSwitches} +import testSupport.UnitSpec import scala.concurrent.ExecutionContext diff --git a/test/unit/uk/gov/hmrc/openidconnect/userinfo/data/UserInfoGeneratorSpec.scala b/test/data/UserInfoGeneratorSpec.scala similarity index 93% rename from test/unit/uk/gov/hmrc/openidconnect/userinfo/data/UserInfoGeneratorSpec.scala rename to test/data/UserInfoGeneratorSpec.scala index 761fd73..064dd26 100644 --- a/test/unit/uk/gov/hmrc/openidconnect/userinfo/data/UserInfoGeneratorSpec.scala +++ b/test/data/UserInfoGeneratorSpec.scala @@ -14,15 +14,14 @@ * limitations under the License. */ -package unit.uk.gov.hmrc.openidconnect.userinfo.data +package data import org.joda.time.LocalDate import org.scalatest.BeforeAndAfterEach import org.scalatest.prop.PropertyChecks -import uk.gov.hmrc.openidconnect.userinfo.config.{FeatureSwitch, UserInfoFeatureSwitches} -import uk.gov.hmrc.openidconnect.userinfo.data.UserInfoGenerator -import uk.gov.hmrc.openidconnect.userinfo.domain.UserInfo -import unit.uk.gov.hmrc.openidconnect.UnitSpec +import config.{FeatureSwitch, UserInfoFeatureSwitches} +import domain.UserInfo +import testSupport.UnitSpec class UserInfoGeneratorSpec extends UnitSpec with PropertyChecks with BeforeAndAfterEach { val ninoPattern = "^[A-CEGHJ-NOPR-TW-Z]{2}[0-9]{6}[ABCD\\s]{1}$".r diff --git a/test/unit/uk/gov/hmrc/openidconnect/userinfo/services/UserInfoServiceSpec.scala b/test/services/UserInfoServiceSpec.scala similarity index 93% rename from test/unit/uk/gov/hmrc/openidconnect/userinfo/services/UserInfoServiceSpec.scala rename to test/services/UserInfoServiceSpec.scala index 0a7e9a4..25753be 100644 --- a/test/unit/uk/gov/hmrc/openidconnect/userinfo/services/UserInfoServiceSpec.scala +++ b/test/services/UserInfoServiceSpec.scala @@ -14,7 +14,7 @@ * limitations under the License. */ -package unit.uk.gov.hmrc.openidconnect.userinfo.services +package services import org.mockito.BDDMockito._ import org.mockito.Matchers.{any, eq => eqTo} @@ -26,15 +26,14 @@ import uk.gov.hmrc.auth.core.{Enrolment, EnrolmentIdentifier, Enrolments} import uk.gov.hmrc.domain.Nino import uk.gov.hmrc.http.logging.Authorization import uk.gov.hmrc.http.{BadRequestException, HeaderCarrier, Token} -import uk.gov.hmrc.openidconnect.userinfo.connectors.{AuthConnector, AuthConnectorV1, ThirdPartyDelegatedAuthorityConnector} -import uk.gov.hmrc.openidconnect.userinfo.controllers.{Version_1_0, Version_1_1} -import uk.gov.hmrc.openidconnect.userinfo.data.UserInfoGenerator -import uk.gov.hmrc.openidconnect.userinfo.domain._ -import uk.gov.hmrc.openidconnect.userinfo.services.{LiveUserInfoService, SandboxUserInfoService, UserInfoTransformer} -import unit.uk.gov.hmrc.openidconnect.UnitSpec +import connectors.{AuthConnector, AuthConnectorV1, ThirdPartyDelegatedAuthorityConnector} +import controllers.{Version_1_0, Version_1_1} +import data.UserInfoGenerator +import domain._ import scala.concurrent.ExecutionContext.Implicits.global import scala.concurrent.{ExecutionContext, Future} +import testSupport.UnitSpec class UserInfoServiceSpec extends UnitSpec with MockitoSugar with ScalaFutures { diff --git a/test/unit/uk/gov/hmrc/openidconnect/userinfo/services/UserInfoTransformerSpec.scala b/test/services/UserInfoTransformerSpec.scala similarity index 97% rename from test/unit/uk/gov/hmrc/openidconnect/userinfo/services/UserInfoTransformerSpec.scala rename to test/services/UserInfoTransformerSpec.scala index 802a44a..2ac626e 100644 --- a/test/unit/uk/gov/hmrc/openidconnect/userinfo/services/UserInfoTransformerSpec.scala +++ b/test/services/UserInfoTransformerSpec.scala @@ -14,7 +14,7 @@ * limitations under the License. */ -package unit.uk.gov.hmrc.openidconnect.userinfo.services +package services import org.joda.time.LocalDate import org.scalatest.BeforeAndAfterEach @@ -23,12 +23,11 @@ import uk.gov.hmrc.auth.core.retrieve.{GatewayInformation, ItmpAddress, ItmpName import uk.gov.hmrc.auth.core.{Enrolment, EnrolmentIdentifier, Enrolments} import uk.gov.hmrc.domain.Nino import uk.gov.hmrc.http.{HeaderCarrier, Token} -import uk.gov.hmrc.openidconnect.userinfo.config.{FeatureSwitch, UserInfoFeatureSwitches} -import uk.gov.hmrc.openidconnect.userinfo.domain._ -import uk.gov.hmrc.openidconnect.userinfo.services.UserInfoTransformer -import unit.uk.gov.hmrc.openidconnect.UnitSpec +import config.{FeatureSwitch, UserInfoFeatureSwitches} +import domain._ import scala.concurrent.ExecutionContext.Implicits.global +import testSupport.UnitSpec class UserInfoTransformerSpec extends UnitSpec with MockitoSugar with BeforeAndAfterEach { diff --git a/test/unit/uk/gov/hmrc/openidconnect/UnitSpec.scala b/test/testSupport/UnitSpec.scala similarity index 95% rename from test/unit/uk/gov/hmrc/openidconnect/UnitSpec.scala rename to test/testSupport/UnitSpec.scala index e6e1b15..0862bb8 100644 --- a/test/unit/uk/gov/hmrc/openidconnect/UnitSpec.scala +++ b/test/testSupport/UnitSpec.scala @@ -14,7 +14,7 @@ * limitations under the License. */ -package unit.uk.gov.hmrc.openidconnect +package testSupport import java.nio.charset.Charset @@ -23,11 +23,9 @@ import akka.util.ByteString import org.scalatest.{Matchers, WordSpec} import play.api.libs.json.{JsValue, Json} import play.api.mvc.Result - -import scala.concurrent.duration._ -import scala.concurrent.{Await, Future} - import scala.language.postfixOps +import scala.concurrent.duration.{Duration, _} +import scala.concurrent.{Await, Future} import scala.language.implicitConversions trait UnitSpec extends WordSpec with Matchers { @@ -50,4 +48,3 @@ trait UnitSpec extends WordSpec with Matchers { def jsonBodyOf(result: Result)(implicit mat: Materializer): JsValue = Json.parse(bodyOf(result)) } - diff --git a/test/unit/uk/gov/hmrc/openidconnect/userinfo/WiremockDSL.scala b/test/unit/uk/gov/hmrc/openidconnect/userinfo/WiremockDSL.scala deleted file mode 100644 index b09c61d..0000000 --- a/test/unit/uk/gov/hmrc/openidconnect/userinfo/WiremockDSL.scala +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright 2020 HM Revenue & Customs - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package unit.uk.gov.hmrc.openidconnect.userinfo - -import com.github.tomakehurst.wiremock.client.WireMock._ -import com.github.tomakehurst.wiremock.client.MappingBuilder - -trait WiremockDSL { - - def given() = new Givens() - - class Givens() { - - class Result(mappingBuilder: MappingBuilder) { - def returns(responseBody: String) = { - stubFor(mappingBuilder.willReturn(aResponse() - .withStatus(200) - .withHeader("Content-Type", "application/json") - .withBody(responseBody))) - } - - def returns(statusCode: Int) = { - stubFor(mappingBuilder.willReturn(aResponse() - .withStatus(statusCode))) - } - } - } -}