From 9982b3ce08850b2c706fb00c6620a4f18b0f3961 Mon Sep 17 00:00:00 2001 From: Luis Burgos Date: Fri, 20 Jul 2018 13:44:22 +0100 Subject: [PATCH] API-3321: library upgrade and other improvements --- .../service/FieldsDefinitionService.scala | 2 - build.sbt | 28 +++--- project/plugins.sbt | 7 +- scalastyle-config.xml | 99 +++++++++++++++++++ .../acceptance}/AcceptanceTestSpec.scala | 8 +- .../ApiSubscriptionFieldsHappySpec.scala | 6 +- .../ApiSubscriptionFieldsUnhappySpec.scala | 6 +- ...ubscriptionFieldDefinitionsHappySpec.scala | 6 +- ...scriptionFieldDefinitionsUnhappySpec.scala | 6 +- .../PlatformIntegrationSpec.scala | 4 +- ...FieldsDefinitionControllerDeleteSpec.scala | 2 +- .../FieldsDefinitionControllerGetSpec.scala | 2 +- .../FieldsDefinitionControllerPutSpec.scala | 2 +- ...bscriptionFieldsControllerDeleteSpec.scala | 2 +- .../SubscriptionFieldsControllerGetSpec.scala | 3 +- .../SubscriptionFieldsControllerPutSpec.scala | 2 +- .../model/JsonFormatterSpec.scala | 3 +- .../FieldsDefinitionRepositorySpec.scala | 3 +- .../repository/MongoErrorHandlerSpec.scala | 1 - .../SubscriptionFieldsRepositorySpec.scala | 3 +- .../service/FieldsDefinitionServiceSpec.scala | 3 +- .../SubscriptionFieldsServiceSpec.scala | 3 +- .../util}/ExternalServices.scala | 2 +- .../util}/TestData.scala | 2 +- .../util}/WireMockRunner.scala | 4 +- 25 files changed, 155 insertions(+), 54 deletions(-) create mode 100644 scalastyle-config.xml rename test/acceptance/{ => uk/gov/hmrc/apisubscriptionfields/acceptance}/AcceptanceTestSpec.scala (95%) rename test/acceptance/{ => uk/gov/hmrc/apisubscriptionfields/acceptance}/ApiSubscriptionFieldsHappySpec.scala (97%) rename test/acceptance/{ => uk/gov/hmrc/apisubscriptionfields/acceptance}/ApiSubscriptionFieldsUnhappySpec.scala (97%) rename test/acceptance/{ => uk/gov/hmrc/apisubscriptionfields/acceptance}/SubscriptionFieldDefinitionsHappySpec.scala (96%) rename test/acceptance/{ => uk/gov/hmrc/apisubscriptionfields/acceptance}/SubscriptionFieldDefinitionsUnhappySpec.scala (96%) rename test/it/{ => uk/gov/hmrc/apisubscriptionfields/integration}/PlatformIntegrationSpec.scala (98%) rename test/util/{ => uk/gov/hmrc/apisubscriptionfields/util}/ExternalServices.scala (94%) rename test/util/{ => uk/gov/hmrc/apisubscriptionfields/util}/TestData.scala (98%) rename test/util/{ => uk/gov/hmrc/apisubscriptionfields/util}/WireMockRunner.scala (90%) diff --git a/app/uk/gov/hmrc/apisubscriptionfields/service/FieldsDefinitionService.scala b/app/uk/gov/hmrc/apisubscriptionfields/service/FieldsDefinitionService.scala index c31fa29..41eb054 100644 --- a/app/uk/gov/hmrc/apisubscriptionfields/service/FieldsDefinitionService.scala +++ b/app/uk/gov/hmrc/apisubscriptionfields/service/FieldsDefinitionService.scala @@ -17,8 +17,6 @@ package uk.gov.hmrc.apisubscriptionfields.service import javax.inject.{Inject, Singleton} - -import play.api.Logger import uk.gov.hmrc.apisubscriptionfields.model._ import uk.gov.hmrc.apisubscriptionfields.repository.{FieldsDefinition, FieldsDefinitionRepository} diff --git a/build.sbt b/build.sbt index 19a08fc..0dfa5aa 100644 --- a/build.sbt +++ b/build.sbt @@ -27,7 +27,7 @@ import scala.language.postfixOps val compile = Seq( ws, - "uk.gov.hmrc" %% "microservice-bootstrap" % "6.17.0", + "uk.gov.hmrc" %% "microservice-bootstrap" % "6.18.0", "uk.gov.hmrc" %% "play-reactivemongo" % "6.2.0", "uk.gov.hmrc" %% "play-hmrc-api" % "2.0.0" ) @@ -54,10 +54,10 @@ lazy val plugins: Seq[Plugins] = Seq.empty lazy val playSettings: Seq[Setting[_]] = Seq.empty lazy val AcceptanceTest = config("acceptance") extend Test -val testConfig = Seq(AcceptanceTest, Test) - lazy val IntegrationTest = config("it") extend Test +val testConfig = Seq(AcceptanceTest, Test, IntegrationTest) + lazy val microservice = Project(appName, file(".")) .enablePlugins(Seq(PlayScala, SbtAutoBuildPlugin, SbtGitVersioning, SbtDistributablesPlugin) ++ plugins: _*) .configs(testConfig: _*) @@ -73,9 +73,9 @@ lazy val microservice = Project(appName, file(".")) evictionWarningOptions in update := EvictionWarningOptions.default.withWarnScalaVersionEviction(false) ) .settings(scoverageSettings) - .configs(IntegrationTest) - .settings(inConfig(IntegrationTest)(Defaults.itSettings): _*) + .settings(Defaults.itSettings) .settings( + testOptions in IntegrationTest := Seq(Tests.Filter(integrationFilter)), Keys.fork in IntegrationTest := false, unmanagedSourceDirectories in IntegrationTest <<= (baseDirectory in IntegrationTest) (base => Seq(base / "test" / "it")), addTestReportOption(IntegrationTest, "integration-reports"), @@ -83,10 +83,11 @@ lazy val microservice = Project(appName, file(".")) parallelExecution in IntegrationTest := false) lazy val unitTestSettings = - inConfig(Test)(Defaults.testTasks) ++ + inConfig(Test)(Defaults.testSettings) ++ Seq( + testOptions in Test := Seq(Tests.Filter(unitFilter)), unmanagedSourceDirectories in Test := Seq( - baseDirectory.value / "test" / "unit", + baseDirectory.value / "test" / "unit", baseDirectory.value / "test" / "util" ), fork in Test := false, @@ -94,10 +95,11 @@ lazy val unitTestSettings = ) lazy val acceptanceTestSettings = - inConfig(AcceptanceTest)(Defaults.testTasks) ++ + inConfig(AcceptanceTest)(Defaults.testSettings) ++ Seq( + testOptions in AcceptanceTest := Seq(Tests.Filter(acceptanceFilter)), unmanagedSourceDirectories in AcceptanceTest := Seq( - baseDirectory.value / "test" / "acceptance", + baseDirectory.value / "test" / "acceptance", baseDirectory.value / "test" / "util" ), fork in AcceptanceTest := false, @@ -113,7 +115,11 @@ lazy val scoverageSettings: Seq[Setting[_]] = Seq( parallelExecution in Test := false ) -def oneForkedJvmPerTest(tests: Seq[TestDefinition]) = +def unitFilter(name: String): Boolean = !integrationFilter(name) && !acceptanceFilter(name) +def integrationFilter(name: String): Boolean = name contains "integration" +def acceptanceFilter(name: String): Boolean = name contains "acceptance" + +def oneForkedJvmPerTest(tests: Seq[TestDefinition]): Seq[Group] = tests map { test => Group(test.name, Seq(test), SubProcess(ForkOptions(runJVMOptions = Seq("-Dtest.name=" + test.name)))) } @@ -123,6 +129,6 @@ def forkedJvmPerTestConfig(tests: Seq[TestDefinition], packages: String*): Seq[G case (packg, theTests) => Group(packg, theTests, SubProcess(ForkOptions())) } toSeq -def onPackageName(rootPackage: String): (String => Boolean) = { +def onPackageName(rootPackage: String): String => Boolean = { testName => testName startsWith rootPackage } diff --git a/project/plugins.sbt b/project/plugins.sbt index 00be6fc..e377353 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -2,8 +2,9 @@ resolvers += Resolver.url("hmrc-sbt-plugin-releases", url("https://dl.bintray.co resolvers += "Typesafe Releases" at "http://repo.typesafe.com/typesafe/releases/" -addSbtPlugin("uk.gov.hmrc" % "sbt-auto-build" % "1.8.0") -addSbtPlugin("uk.gov.hmrc" % "sbt-git-versioning" % "0.9.0") -addSbtPlugin("uk.gov.hmrc" % "sbt-distributables" % "1.0.0") +addSbtPlugin("uk.gov.hmrc" % "sbt-auto-build" % "1.12.0") +addSbtPlugin("uk.gov.hmrc" % "sbt-git-versioning" % "0.10.0") +addSbtPlugin("uk.gov.hmrc" % "sbt-distributables" % "1.1.0") addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.5.12") addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.5.1") +addSbtPlugin("org.scalastyle" %% "scalastyle-sbt-plugin" % "1.0.0") diff --git a/scalastyle-config.xml b/scalastyle-config.xml new file mode 100644 index 0000000..e48b66a --- /dev/null +++ b/scalastyle-config.xml @@ -0,0 +1,99 @@ + + Scalastyle standard configuration + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/test/acceptance/AcceptanceTestSpec.scala b/test/acceptance/uk/gov/hmrc/apisubscriptionfields/acceptance/AcceptanceTestSpec.scala similarity index 95% rename from test/acceptance/AcceptanceTestSpec.scala rename to test/acceptance/uk/gov/hmrc/apisubscriptionfields/acceptance/AcceptanceTestSpec.scala index 98cfa2c..b88088e 100644 --- a/test/acceptance/AcceptanceTestSpec.scala +++ b/test/acceptance/uk/gov/hmrc/apisubscriptionfields/acceptance/AcceptanceTestSpec.scala @@ -1,5 +1,5 @@ /* - * Copyright 2017 HM Revenue & Customs + * Copyright 2018 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. @@ -14,6 +14,8 @@ * limitations under the License. */ +package uk.gov.hmrc.apisubscriptionfields.acceptance + import java.util.UUID import org.scalatest._ @@ -24,9 +26,9 @@ import play.api.libs.json.Json import play.api.mvc.{AnyContentAsEmpty, AnyContentAsJson} import play.api.test.FakeRequest import play.modules.reactivemongo.MongoDbConnection -import uk.gov.hmrc.apisubscriptionfields.model._ import uk.gov.hmrc.apisubscriptionfields.model.JsonFormatters._ -import util.{ExternalServicesConfig, RequestHeaders} +import uk.gov.hmrc.apisubscriptionfields.model._ +import uk.gov.hmrc.apisubscriptionfields.util.{ExternalServicesConfig, RequestHeaders} import scala.concurrent.ExecutionContext.Implicits.global import scala.concurrent.duration._ diff --git a/test/acceptance/ApiSubscriptionFieldsHappySpec.scala b/test/acceptance/uk/gov/hmrc/apisubscriptionfields/acceptance/ApiSubscriptionFieldsHappySpec.scala similarity index 97% rename from test/acceptance/ApiSubscriptionFieldsHappySpec.scala rename to test/acceptance/uk/gov/hmrc/apisubscriptionfields/acceptance/ApiSubscriptionFieldsHappySpec.scala index ab6e5db..17d6a9e 100644 --- a/test/acceptance/ApiSubscriptionFieldsHappySpec.scala +++ b/test/acceptance/uk/gov/hmrc/apisubscriptionfields/acceptance/ApiSubscriptionFieldsHappySpec.scala @@ -1,5 +1,5 @@ /* - * Copyright 2017 HM Revenue & Customs + * Copyright 2018 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. @@ -14,14 +14,14 @@ * limitations under the License. */ -package acceptance +package uk.gov.hmrc.apisubscriptionfields.acceptance import org.scalatest.OptionValues import play.api.Logger import play.api.mvc._ import play.api.test.Helpers._ import uk.gov.hmrc.apisubscriptionfields.model._ -import util.{FieldsDefinitionTestData, SubscriptionFieldsTestData} +import uk.gov.hmrc.apisubscriptionfields.util.{FieldsDefinitionTestData, SubscriptionFieldsTestData} import scala.concurrent.Future diff --git a/test/acceptance/ApiSubscriptionFieldsUnhappySpec.scala b/test/acceptance/uk/gov/hmrc/apisubscriptionfields/acceptance/ApiSubscriptionFieldsUnhappySpec.scala similarity index 97% rename from test/acceptance/ApiSubscriptionFieldsUnhappySpec.scala rename to test/acceptance/uk/gov/hmrc/apisubscriptionfields/acceptance/ApiSubscriptionFieldsUnhappySpec.scala index 437439d..7482cb2 100644 --- a/test/acceptance/ApiSubscriptionFieldsUnhappySpec.scala +++ b/test/acceptance/uk/gov/hmrc/apisubscriptionfields/acceptance/ApiSubscriptionFieldsUnhappySpec.scala @@ -1,5 +1,5 @@ /* - * Copyright 2017 HM Revenue & Customs + * Copyright 2018 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. @@ -14,7 +14,7 @@ * limitations under the License. */ -package acceptance +package uk.gov.hmrc.apisubscriptionfields.acceptance import org.scalatest.OptionValues import play.api.Logger @@ -23,7 +23,7 @@ import play.api.mvc._ import play.api.test.Helpers._ import uk.gov.hmrc.apisubscriptionfields.model.ErrorCode.{INVALID_REQUEST_PAYLOAD, NOT_FOUND_CODE} import uk.gov.hmrc.apisubscriptionfields.model.JsErrorResponse -import util.SubscriptionFieldsTestData +import uk.gov.hmrc.apisubscriptionfields.util.SubscriptionFieldsTestData import scala.concurrent.Future diff --git a/test/acceptance/SubscriptionFieldDefinitionsHappySpec.scala b/test/acceptance/uk/gov/hmrc/apisubscriptionfields/acceptance/SubscriptionFieldDefinitionsHappySpec.scala similarity index 96% rename from test/acceptance/SubscriptionFieldDefinitionsHappySpec.scala rename to test/acceptance/uk/gov/hmrc/apisubscriptionfields/acceptance/SubscriptionFieldDefinitionsHappySpec.scala index 67bbd5b..e3815ce 100644 --- a/test/acceptance/SubscriptionFieldDefinitionsHappySpec.scala +++ b/test/acceptance/uk/gov/hmrc/apisubscriptionfields/acceptance/SubscriptionFieldDefinitionsHappySpec.scala @@ -1,5 +1,5 @@ /* - * Copyright 2017 HM Revenue & Customs + * Copyright 2018 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. @@ -14,13 +14,13 @@ * limitations under the License. */ -package acceptance +package uk.gov.hmrc.apisubscriptionfields.acceptance import org.scalatest.OptionValues import play.api.mvc._ import play.api.test.Helpers._ import uk.gov.hmrc.apisubscriptionfields.model._ -import util.{FieldsDefinitionTestData, SubscriptionFieldsTestData} +import uk.gov.hmrc.apisubscriptionfields.util.{FieldsDefinitionTestData, SubscriptionFieldsTestData} import scala.concurrent.Future diff --git a/test/acceptance/SubscriptionFieldDefinitionsUnhappySpec.scala b/test/acceptance/uk/gov/hmrc/apisubscriptionfields/acceptance/SubscriptionFieldDefinitionsUnhappySpec.scala similarity index 96% rename from test/acceptance/SubscriptionFieldDefinitionsUnhappySpec.scala rename to test/acceptance/uk/gov/hmrc/apisubscriptionfields/acceptance/SubscriptionFieldDefinitionsUnhappySpec.scala index b588d0d..98b9a9c 100644 --- a/test/acceptance/SubscriptionFieldDefinitionsUnhappySpec.scala +++ b/test/acceptance/uk/gov/hmrc/apisubscriptionfields/acceptance/SubscriptionFieldDefinitionsUnhappySpec.scala @@ -1,5 +1,5 @@ /* - * Copyright 2017 HM Revenue & Customs + * Copyright 2018 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. @@ -14,7 +14,7 @@ * limitations under the License. */ -package acceptance +package uk.gov.hmrc.apisubscriptionfields.acceptance import org.scalatest.OptionValues import play.api.libs.json.Json @@ -22,7 +22,7 @@ import play.api.mvc._ import play.api.test.Helpers._ import uk.gov.hmrc.apisubscriptionfields.model.ErrorCode.{INVALID_REQUEST_PAYLOAD, NOT_FOUND_CODE} import uk.gov.hmrc.apisubscriptionfields.model.JsErrorResponse -import util.SubscriptionFieldsTestData +import uk.gov.hmrc.apisubscriptionfields.util.SubscriptionFieldsTestData import scala.concurrent.Future diff --git a/test/it/PlatformIntegrationSpec.scala b/test/it/uk/gov/hmrc/apisubscriptionfields/integration/PlatformIntegrationSpec.scala similarity index 98% rename from test/it/PlatformIntegrationSpec.scala rename to test/it/uk/gov/hmrc/apisubscriptionfields/integration/PlatformIntegrationSpec.scala index 07d8979..e8389c3 100644 --- a/test/it/PlatformIntegrationSpec.scala +++ b/test/it/uk/gov/hmrc/apisubscriptionfields/integration/PlatformIntegrationSpec.scala @@ -1,5 +1,5 @@ /* - * Copyright 2017 HM Revenue & Customs + * Copyright 2018 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. @@ -14,6 +14,8 @@ * limitations under the License. */ +package uk.gov.hmrc.apisubscriptionfields.integration + import com.github.tomakehurst.wiremock.WireMockServer import com.github.tomakehurst.wiremock.client.WireMock import com.github.tomakehurst.wiremock.client.WireMock._ diff --git a/test/unit/uk/gov/hmrc/apisubscriptionfields/controller/FieldsDefinitionControllerDeleteSpec.scala b/test/unit/uk/gov/hmrc/apisubscriptionfields/controller/FieldsDefinitionControllerDeleteSpec.scala index 40a513f..c4549af 100644 --- a/test/unit/uk/gov/hmrc/apisubscriptionfields/controller/FieldsDefinitionControllerDeleteSpec.scala +++ b/test/unit/uk/gov/hmrc/apisubscriptionfields/controller/FieldsDefinitionControllerDeleteSpec.scala @@ -23,7 +23,7 @@ import play.api.test.Helpers._ import uk.gov.hmrc.apisubscriptionfields.model.JsonFormatters import uk.gov.hmrc.apisubscriptionfields.service.FieldsDefinitionService import uk.gov.hmrc.play.test.UnitSpec -import util.FieldsDefinitionTestData +import uk.gov.hmrc.apisubscriptionfields.util.FieldsDefinitionTestData import scala.concurrent.Future diff --git a/test/unit/uk/gov/hmrc/apisubscriptionfields/controller/FieldsDefinitionControllerGetSpec.scala b/test/unit/uk/gov/hmrc/apisubscriptionfields/controller/FieldsDefinitionControllerGetSpec.scala index 2439013..7681e14 100644 --- a/test/unit/uk/gov/hmrc/apisubscriptionfields/controller/FieldsDefinitionControllerGetSpec.scala +++ b/test/unit/uk/gov/hmrc/apisubscriptionfields/controller/FieldsDefinitionControllerGetSpec.scala @@ -23,7 +23,7 @@ import play.api.test._ import uk.gov.hmrc.apisubscriptionfields.model.{BulkFieldsDefinitionsResponse, FieldsDefinitionResponse, JsonFormatters} import uk.gov.hmrc.apisubscriptionfields.service.FieldsDefinitionService import uk.gov.hmrc.play.test.UnitSpec -import util.FieldsDefinitionTestData +import uk.gov.hmrc.apisubscriptionfields.util.FieldsDefinitionTestData import scala.concurrent.Future diff --git a/test/unit/uk/gov/hmrc/apisubscriptionfields/controller/FieldsDefinitionControllerPutSpec.scala b/test/unit/uk/gov/hmrc/apisubscriptionfields/controller/FieldsDefinitionControllerPutSpec.scala index 50aa698..5f8e04f 100644 --- a/test/unit/uk/gov/hmrc/apisubscriptionfields/controller/FieldsDefinitionControllerPutSpec.scala +++ b/test/unit/uk/gov/hmrc/apisubscriptionfields/controller/FieldsDefinitionControllerPutSpec.scala @@ -24,7 +24,7 @@ import play.api.test._ import uk.gov.hmrc.apisubscriptionfields.model.{FieldsDefinitionRequest, JsonFormatters} import uk.gov.hmrc.apisubscriptionfields.service.FieldsDefinitionService import uk.gov.hmrc.play.test.UnitSpec -import util.FieldsDefinitionTestData +import uk.gov.hmrc.apisubscriptionfields.util.FieldsDefinitionTestData import scala.concurrent.Future diff --git a/test/unit/uk/gov/hmrc/apisubscriptionfields/controller/SubscriptionFieldsControllerDeleteSpec.scala b/test/unit/uk/gov/hmrc/apisubscriptionfields/controller/SubscriptionFieldsControllerDeleteSpec.scala index c34ff81..3309d8b 100644 --- a/test/unit/uk/gov/hmrc/apisubscriptionfields/controller/SubscriptionFieldsControllerDeleteSpec.scala +++ b/test/unit/uk/gov/hmrc/apisubscriptionfields/controller/SubscriptionFieldsControllerDeleteSpec.scala @@ -23,7 +23,7 @@ import play.api.test.Helpers._ import uk.gov.hmrc.apisubscriptionfields.model.{ApiContext, ApiVersion, ClientId, JsonFormatters} import uk.gov.hmrc.apisubscriptionfields.service.SubscriptionFieldsService import uk.gov.hmrc.play.test.UnitSpec -import util.SubscriptionFieldsTestData +import uk.gov.hmrc.apisubscriptionfields.util.SubscriptionFieldsTestData import scala.concurrent.Future diff --git a/test/unit/uk/gov/hmrc/apisubscriptionfields/controller/SubscriptionFieldsControllerGetSpec.scala b/test/unit/uk/gov/hmrc/apisubscriptionfields/controller/SubscriptionFieldsControllerGetSpec.scala index 5046983..513c35f 100644 --- a/test/unit/uk/gov/hmrc/apisubscriptionfields/controller/SubscriptionFieldsControllerGetSpec.scala +++ b/test/unit/uk/gov/hmrc/apisubscriptionfields/controller/SubscriptionFieldsControllerGetSpec.scala @@ -21,11 +21,10 @@ import play.api.libs.json.{JsDefined, JsString, Json} import play.api.mvc._ import play.api.test.Helpers._ import play.api.test._ -import uk.gov.hmrc.apisubscriptionfields.controller.SubscriptionFieldsController import uk.gov.hmrc.apisubscriptionfields.model._ import uk.gov.hmrc.apisubscriptionfields.service.SubscriptionFieldsService +import uk.gov.hmrc.apisubscriptionfields.util.SubscriptionFieldsTestData import uk.gov.hmrc.play.test.UnitSpec -import util.SubscriptionFieldsTestData import scala.concurrent.Future diff --git a/test/unit/uk/gov/hmrc/apisubscriptionfields/controller/SubscriptionFieldsControllerPutSpec.scala b/test/unit/uk/gov/hmrc/apisubscriptionfields/controller/SubscriptionFieldsControllerPutSpec.scala index 6d2a031..8734efb 100644 --- a/test/unit/uk/gov/hmrc/apisubscriptionfields/controller/SubscriptionFieldsControllerPutSpec.scala +++ b/test/unit/uk/gov/hmrc/apisubscriptionfields/controller/SubscriptionFieldsControllerPutSpec.scala @@ -24,7 +24,7 @@ import play.api.test.Helpers._ import uk.gov.hmrc.apisubscriptionfields.model._ import uk.gov.hmrc.apisubscriptionfields.service.SubscriptionFieldsService import uk.gov.hmrc.play.test.UnitSpec -import util.SubscriptionFieldsTestData +import uk.gov.hmrc.apisubscriptionfields.util.SubscriptionFieldsTestData import scala.concurrent.Future diff --git a/test/unit/uk/gov/hmrc/apisubscriptionfields/model/JsonFormatterSpec.scala b/test/unit/uk/gov/hmrc/apisubscriptionfields/model/JsonFormatterSpec.scala index 2705a56..5e70b88 100644 --- a/test/unit/uk/gov/hmrc/apisubscriptionfields/model/JsonFormatterSpec.scala +++ b/test/unit/uk/gov/hmrc/apisubscriptionfields/model/JsonFormatterSpec.scala @@ -17,8 +17,7 @@ package uk.gov.hmrc.apisubscriptionfields.model import org.scalatest.{Matchers, WordSpec} -import uk.gov.hmrc.apisubscriptionfields.model._ -import util.{FieldsDefinitionTestData, SubscriptionFieldsTestData} +import uk.gov.hmrc.apisubscriptionfields.util.{FieldsDefinitionTestData, SubscriptionFieldsTestData} class JsonFormatterSpec extends WordSpec with Matchers diff --git a/test/unit/uk/gov/hmrc/apisubscriptionfields/repository/FieldsDefinitionRepositorySpec.scala b/test/unit/uk/gov/hmrc/apisubscriptionfields/repository/FieldsDefinitionRepositorySpec.scala index 3acdd52..cd36ef5 100644 --- a/test/unit/uk/gov/hmrc/apisubscriptionfields/repository/FieldsDefinitionRepositorySpec.scala +++ b/test/unit/uk/gov/hmrc/apisubscriptionfields/repository/FieldsDefinitionRepositorySpec.scala @@ -21,10 +21,9 @@ import org.scalatest.{BeforeAndAfterAll, BeforeAndAfterEach} import reactivemongo.api.DB import reactivemongo.bson.BSONDocument import uk.gov.hmrc.apisubscriptionfields.model.{ApiContext, ApiVersion, JsonFormatters} -import uk.gov.hmrc.apisubscriptionfields.repository._ +import uk.gov.hmrc.apisubscriptionfields.util.FieldsDefinitionTestData import uk.gov.hmrc.mongo.MongoSpecSupport import uk.gov.hmrc.play.test.UnitSpec -import util.FieldsDefinitionTestData import scala.concurrent.ExecutionContext.Implicits.global diff --git a/test/unit/uk/gov/hmrc/apisubscriptionfields/repository/MongoErrorHandlerSpec.scala b/test/unit/uk/gov/hmrc/apisubscriptionfields/repository/MongoErrorHandlerSpec.scala index b17a3aa..e93ec0e 100644 --- a/test/unit/uk/gov/hmrc/apisubscriptionfields/repository/MongoErrorHandlerSpec.scala +++ b/test/unit/uk/gov/hmrc/apisubscriptionfields/repository/MongoErrorHandlerSpec.scala @@ -18,7 +18,6 @@ package uk.gov.hmrc.apisubscriptionfields.repository import reactivemongo.api.commands._ import reactivemongo.bson.BSONInteger -import uk.gov.hmrc.apisubscriptionfields.repository.MongoErrorHandler import uk.gov.hmrc.play.test.UnitSpec class MongoErrorHandlerSpec extends UnitSpec { diff --git a/test/unit/uk/gov/hmrc/apisubscriptionfields/repository/SubscriptionFieldsRepositorySpec.scala b/test/unit/uk/gov/hmrc/apisubscriptionfields/repository/SubscriptionFieldsRepositorySpec.scala index 6f2c035..2c47803 100644 --- a/test/unit/uk/gov/hmrc/apisubscriptionfields/repository/SubscriptionFieldsRepositorySpec.scala +++ b/test/unit/uk/gov/hmrc/apisubscriptionfields/repository/SubscriptionFieldsRepositorySpec.scala @@ -23,10 +23,9 @@ import org.scalatest.{BeforeAndAfterAll, BeforeAndAfterEach} import reactivemongo.api.DB import reactivemongo.bson._ import uk.gov.hmrc.apisubscriptionfields.model._ -import uk.gov.hmrc.apisubscriptionfields.repository.{MongoDbProvider, MongoFormatters, SubscriptionFields, SubscriptionFieldsMongoRepository} +import uk.gov.hmrc.apisubscriptionfields.util.SubscriptionFieldsTestData import uk.gov.hmrc.mongo.MongoSpecSupport import uk.gov.hmrc.play.test.UnitSpec -import util.SubscriptionFieldsTestData import scala.concurrent.ExecutionContext.Implicits.global import scala.concurrent.Future diff --git a/test/unit/uk/gov/hmrc/apisubscriptionfields/service/FieldsDefinitionServiceSpec.scala b/test/unit/uk/gov/hmrc/apisubscriptionfields/service/FieldsDefinitionServiceSpec.scala index 2df1e9c..f61b019 100644 --- a/test/unit/uk/gov/hmrc/apisubscriptionfields/service/FieldsDefinitionServiceSpec.scala +++ b/test/unit/uk/gov/hmrc/apisubscriptionfields/service/FieldsDefinitionServiceSpec.scala @@ -19,9 +19,8 @@ package uk.gov.hmrc.apisubscriptionfields.service import org.scalamock.scalatest.MockFactory import uk.gov.hmrc.apisubscriptionfields.model._ import uk.gov.hmrc.apisubscriptionfields.repository.{FieldsDefinition, FieldsDefinitionRepository} -import uk.gov.hmrc.apisubscriptionfields.service.FieldsDefinitionService +import uk.gov.hmrc.apisubscriptionfields.util.FieldsDefinitionTestData import uk.gov.hmrc.play.test.UnitSpec -import util.FieldsDefinitionTestData import scala.concurrent.Future diff --git a/test/unit/uk/gov/hmrc/apisubscriptionfields/service/SubscriptionFieldsServiceSpec.scala b/test/unit/uk/gov/hmrc/apisubscriptionfields/service/SubscriptionFieldsServiceSpec.scala index d3b5003..29ea952 100644 --- a/test/unit/uk/gov/hmrc/apisubscriptionfields/service/SubscriptionFieldsServiceSpec.scala +++ b/test/unit/uk/gov/hmrc/apisubscriptionfields/service/SubscriptionFieldsServiceSpec.scala @@ -21,9 +21,8 @@ import java.util.UUID import org.scalamock.scalatest.MockFactory import uk.gov.hmrc.apisubscriptionfields.model._ import uk.gov.hmrc.apisubscriptionfields.repository._ -import uk.gov.hmrc.apisubscriptionfields.service.{SubscriptionFieldsService, UUIDCreator} +import uk.gov.hmrc.apisubscriptionfields.util.SubscriptionFieldsTestData import uk.gov.hmrc.play.test.UnitSpec -import util.SubscriptionFieldsTestData import scala.concurrent.Future diff --git a/test/util/ExternalServices.scala b/test/util/uk/gov/hmrc/apisubscriptionfields/util/ExternalServices.scala similarity index 94% rename from test/util/ExternalServices.scala rename to test/util/uk/gov/hmrc/apisubscriptionfields/util/ExternalServices.scala index d9dded0..519094b 100644 --- a/test/util/ExternalServices.scala +++ b/test/util/uk/gov/hmrc/apisubscriptionfields/util/ExternalServices.scala @@ -14,7 +14,7 @@ * limitations under the License. */ -package util +package uk.gov.hmrc.apisubscriptionfields.util object ExternalServicesConfig { val Port: Int = sys.env.getOrElse("WIREMOCK_SERVICE_LOCATOR_PORT", "11111").toInt diff --git a/test/util/TestData.scala b/test/util/uk/gov/hmrc/apisubscriptionfields/util/TestData.scala similarity index 98% rename from test/util/TestData.scala rename to test/util/uk/gov/hmrc/apisubscriptionfields/util/TestData.scala index 4c5a3dc..5f6092d 100644 --- a/test/util/TestData.scala +++ b/test/util/uk/gov/hmrc/apisubscriptionfields/util/TestData.scala @@ -14,7 +14,7 @@ * limitations under the License. */ -package util +package uk.gov.hmrc.apisubscriptionfields.util import java.util.UUID diff --git a/test/util/WireMockRunner.scala b/test/util/uk/gov/hmrc/apisubscriptionfields/util/WireMockRunner.scala similarity index 90% rename from test/util/WireMockRunner.scala rename to test/util/uk/gov/hmrc/apisubscriptionfields/util/WireMockRunner.scala index aaa20df..4752700 100644 --- a/test/util/WireMockRunner.scala +++ b/test/util/uk/gov/hmrc/apisubscriptionfields/util/WireMockRunner.scala @@ -14,12 +14,12 @@ * limitations under the License. */ -package util +package uk.gov.hmrc.apisubscriptionfields.util import com.github.tomakehurst.wiremock.WireMockServer import com.github.tomakehurst.wiremock.client.WireMock import com.github.tomakehurst.wiremock.core.WireMockConfiguration._ -import util.ExternalServicesConfig._ +import uk.gov.hmrc.apisubscriptionfields.util.ExternalServicesConfig._ trait WireMockRunner {