aboutsummaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorvlad <vlad@driver.xyz>2018-01-25 14:12:31 -0800
committervlad <vlad@driver.xyz>2018-01-25 14:12:31 -0800
commita0877d81ca2844d75dc361b5ce7c99afacd6e25f (patch)
tree8fe49f45cbcddbbb9a3d167099abe7aa2625e56b /src/test
parent46a22e9ab324a0068a85952cdc809800f360f445 (diff)
downloadrest-query-a0877d81ca2844d75dc361b5ce7c99afacd6e25f.tar.gz
rest-query-a0877d81ca2844d75dc361b5ce7c99afacd6e25f.tar.bz2
rest-query-a0877d81ca2844d75dc361b5ce7c99afacd6e25f.zip
Extracting query library
Diffstat (limited to 'src/test')
-rw-r--r--src/test/scala/xyz/driver/pdsuicommon/error/UnexpectedFilterException.scala3
-rw-r--r--src/test/scala/xyz/driver/pdsuicommon/logging/PhiStringContextSuite.scala31
-rw-r--r--src/test/scala/xyz/driver/pdsuidomain/DocumentSuite.scala94
-rw-r--r--src/test/scala/xyz/driver/pdsuidomain/formats/json/ArmFormatSuite.scala37
-rw-r--r--src/test/scala/xyz/driver/pdsuidomain/formats/json/BridgeUploadQueueFormatSuite.scala32
-rw-r--r--src/test/scala/xyz/driver/pdsuidomain/formats/json/CriterionFormatSuite.scala75
-rw-r--r--src/test/scala/xyz/driver/pdsuidomain/formats/json/DocumentFormatSuite.scala73
-rw-r--r--src/test/scala/xyz/driver/pdsuidomain/formats/json/DocumentHistoryFormatSuite.scala49
-rw-r--r--src/test/scala/xyz/driver/pdsuidomain/formats/json/DocumentIssueFormatSuite.scala48
-rw-r--r--src/test/scala/xyz/driver/pdsuidomain/formats/json/EligibilityArmWithDiseasesFormatSuite.scala56
-rw-r--r--src/test/scala/xyz/driver/pdsuidomain/formats/json/ExportFormatSuite.scala129
-rw-r--r--src/test/scala/xyz/driver/pdsuidomain/formats/json/ExtractedDataFormatSuite.scala109
-rw-r--r--src/test/scala/xyz/driver/pdsuidomain/formats/json/HypothesisFormatSuite.scala27
-rw-r--r--src/test/scala/xyz/driver/pdsuidomain/formats/json/InterventionFormatSuite.scala73
-rw-r--r--src/test/scala/xyz/driver/pdsuidomain/formats/json/ListResponseFormatSuite.scala102
-rw-r--r--src/test/scala/xyz/driver/pdsuidomain/formats/json/MedicalRecordFormatSuite.scala152
-rw-r--r--src/test/scala/xyz/driver/pdsuidomain/formats/json/MedicalRecordHistoryFormatSuite.scala51
-rw-r--r--src/test/scala/xyz/driver/pdsuidomain/formats/json/MedicalRecordIssueFormatSuite.scala47
-rw-r--r--src/test/scala/xyz/driver/pdsuidomain/formats/json/PatientCriterionFormatSuite.scala60
-rw-r--r--src/test/scala/xyz/driver/pdsuidomain/formats/json/PatientEligibleTrialFormatSuite.scala61
-rw-r--r--src/test/scala/xyz/driver/pdsuidomain/formats/json/PatientFormatSuite.scala41
-rw-r--r--src/test/scala/xyz/driver/pdsuidomain/formats/json/PatientHistoryFormatSuite.scala32
-rw-r--r--src/test/scala/xyz/driver/pdsuidomain/formats/json/PatientHypothesisFormatSuite.scala28
-rw-r--r--src/test/scala/xyz/driver/pdsuidomain/formats/json/PatientIssueFormatSuite.scala45
-rw-r--r--src/test/scala/xyz/driver/pdsuidomain/formats/json/PatientLabelFormatSuite.scala78
-rw-r--r--src/test/scala/xyz/driver/pdsuidomain/formats/json/SlotArmFormatSuite.scala36
-rw-r--r--src/test/scala/xyz/driver/pdsuidomain/formats/json/StudyDesignFormatSuite.scala20
-rw-r--r--src/test/scala/xyz/driver/pdsuidomain/formats/json/TrialFormatSuite.scala49
-rw-r--r--src/test/scala/xyz/driver/pdsuidomain/formats/json/TrialHistoryFormatSuite.scala32
-rw-r--r--src/test/scala/xyz/driver/pdsuidomain/formats/json/TrialIssueFormatSuite.scala50
-rw-r--r--src/test/scala/xyz/driver/restquery/db/SearchFilterExprSuite.scala (renamed from src/test/scala/xyz/driver/pdsuicommon/db/SearchFilterExprSuite.scala)0
-rw-r--r--src/test/scala/xyz/driver/restquery/rest/parsers/PaginationParserSuite.scala (renamed from src/test/scala/xyz/driver/pdsuicommon/parsers/PaginationParserSuite.scala)6
-rw-r--r--src/test/scala/xyz/driver/restquery/rest/parsers/SearchFilterParserSuite.scala (renamed from src/test/scala/xyz/driver/pdsuicommon/parsers/SearchFilterParserSuite.scala)25
-rw-r--r--src/test/scala/xyz/driver/restquery/rest/parsers/SortingParserSuite.scala (renamed from src/test/scala/xyz/driver/pdsuicommon/parsers/SortingParserSuite.scala)4
-rw-r--r--src/test/scala/xyz/driver/restquery/rest/parsers/TestUtils.scala (renamed from src/test/scala/xyz/driver/pdsuicommon/parsers/TestUtils.scala)7
-rw-r--r--src/test/scala/xyz/driver/restquery/utils/StringOpsSuite.scala (renamed from src/test/scala/xyz/driver/pdsuicommon/utils/StringOpsSuite.scala)0
36 files changed, 21 insertions, 1741 deletions
diff --git a/src/test/scala/xyz/driver/pdsuicommon/error/UnexpectedFilterException.scala b/src/test/scala/xyz/driver/pdsuicommon/error/UnexpectedFilterException.scala
deleted file mode 100644
index 567661a..0000000
--- a/src/test/scala/xyz/driver/pdsuicommon/error/UnexpectedFilterException.scala
+++ /dev/null
@@ -1,3 +0,0 @@
-package xyz.driver.pdsuicommon.error
-
-class UnexpectedFilterException(message: String) extends RuntimeException(message)
diff --git a/src/test/scala/xyz/driver/pdsuicommon/logging/PhiStringContextSuite.scala b/src/test/scala/xyz/driver/pdsuicommon/logging/PhiStringContextSuite.scala
deleted file mode 100644
index 8fd783f..0000000
--- a/src/test/scala/xyz/driver/pdsuicommon/logging/PhiStringContextSuite.scala
+++ /dev/null
@@ -1,31 +0,0 @@
-package xyz.driver.pdsuicommon.logging
-
-import org.scalatest.FreeSpecLike
-
-class PhiStringContextSuite extends FreeSpecLike {
-
- case class Foo(x: Int, y: String) {
- val z: Boolean = true
- }
-
- case class Bar(y: Boolean)
-
- implicit def fooToPhiString(foo: Foo): PhiString = new PhiString(s"Foo(z=${foo.z})")
-
- "should not compile if there is no PhiString implicit" in assertDoesNotCompile(
- """val bar = Bar(true)
- |phi"bar is $bar"""".stripMargin
- )
-
- "should compile if there is a PhiString implicit" in assertCompiles(
- """val foo = new Foo(1, "test")
- |println(phi"foo is $foo}")""".stripMargin
- )
-
- "should not contain private info" in {
- val foo = new Foo(42, "test")
- val result = phi"foo is $foo".text
- assert(!result.contains("test"))
- assert(!result.contains("42"))
- }
-}
diff --git a/src/test/scala/xyz/driver/pdsuidomain/DocumentSuite.scala b/src/test/scala/xyz/driver/pdsuidomain/DocumentSuite.scala
deleted file mode 100644
index ccd5a3a..0000000
--- a/src/test/scala/xyz/driver/pdsuidomain/DocumentSuite.scala
+++ /dev/null
@@ -1,94 +0,0 @@
-package xyz.driver.pdsuidomain
-
-import java.time.{LocalDate, LocalDateTime}
-import java.time.temporal.ChronoUnit
-
-import org.scalatest.FreeSpecLike
-import org.scalatest.concurrent.ScalaFutures
-import org.scalatest.time.{Millis, Span}
-import xyz.driver.pdsuicommon.domain.{LongId, TextJson}
-import xyz.driver.pdsuidomain.entities.Document
-
-class DocumentSuite extends FreeSpecLike with ScalaFutures {
-
- implicit val defaultPatience: PatienceConfig =
- PatienceConfig(timeout = Span(1000, Millis), interval = Span(20, Millis))
-
- "validation" - {
- "can't submit invalid data" - {
- val base = sampleDocument
-
- val now = LocalDate.now()
- val past1 = now.minus(2, ChronoUnit.DAYS)
- val past2 = past1.plus(1, ChronoUnit.DAYS)
- val future1 = now.plus(1, ChronoUnit.DAYS)
- val future2 = future1.plus(1, ChronoUnit.DAYS)
-
- Seq(
- "startDate should be non-empty" -> base.copy(startDate = None),
- "startDate should be greater, than endDate" -> base.copy(startDate = Some(past2), endDate = Some(past1)),
- "startDate and endDate should be in the past" -> base.copy(startDate = Some(future1), endDate = Some(future2))
- ).foreach {
- case (title, orig) =>
- s"$title" in {
- val r = Document.validator(orig)
- assert(r.isLeft, s"should fail, but: ${r.right}")
- }
- }
- }
- }
-
- "getRequiredType" - {
- "getOPNType" in {
- val documentForOPNType = sampleDocument.copy(
- typeId = Some(LongId(1L)),
- providerTypeId = Some(LongId(1L)),
- startDate = Some(LocalDate.now().minus(2, ChronoUnit.DAYS))
- )
- val r = documentForOPNType.getRequiredType("Outpatient Physician Note", "Medical Oncology")
- assert(r.contains(Document.RequiredType.OPN), s"document should have the requiredType=OPN, but:$r")
- }
-
- "getPNType" in {
- val documentForPNType = sampleDocument.copy(
- typeId = Some(LongId(6))
- )
- val r = documentForPNType.getRequiredType("Pathology Report", "")
- assert(r.contains(Document.RequiredType.PN), s"document should have the requiredType=PN, but:$r")
- }
- "get None" in {
- val document = sampleDocument.copy(
- typeId = Some(LongId(1L)),
- providerTypeId = Some(LongId(1L)),
- startDate = Some(LocalDate.now().minus(7, ChronoUnit.MONTHS))
- )
- val r = document.getRequiredType("Outpatient Physician Note", "Medical Oncology")
- assert(r.isEmpty, s"document should have the requiredType=None, but:$r")
- }
- }
-
- private def sampleDocument = {
- val lastUpdate = LocalDateTime.now()
-
- Document(
- id = LongId(2002),
- status = Document.Status.New,
- previousStatus = None,
- assignee = None,
- previousAssignee = None,
- lastActiveUserId = None,
- recordId = LongId(2003),
- physician = None,
- typeId = Some(LongId(123)),
- providerName = Some("etst"),
- providerTypeId = Some(LongId(123)),
- requiredType = None,
- institutionName = Some("institution name"),
- startDate = Some(lastUpdate.toLocalDate.minusDays(2)),
- endDate = None,
- lastUpdate = lastUpdate,
- meta = Some(TextJson(Document.Meta(1.1, 2.2))),
- labelVersion = 1
- )
- }
-}
diff --git a/src/test/scala/xyz/driver/pdsuidomain/formats/json/ArmFormatSuite.scala b/src/test/scala/xyz/driver/pdsuidomain/formats/json/ArmFormatSuite.scala
deleted file mode 100644
index 3cab4a1..0000000
--- a/src/test/scala/xyz/driver/pdsuidomain/formats/json/ArmFormatSuite.scala
+++ /dev/null
@@ -1,37 +0,0 @@
-package xyz.driver.pdsuidomain.formats.json
-
-import spray.json._
-import org.scalatest.{FlatSpec, Matchers}
-import xyz.driver.pdsuicommon.domain.{LongId, StringId}
-import xyz.driver.pdsuidomain.entities.Arm
-
-class ArmFormatSuite extends FlatSpec with Matchers {
- import xyz.driver.pdsuidomain.formats.json.arm._
-
- "Json format for Arm" should "read and write correct JSON" in {
- val arm = Arm(
- id = LongId(10),
- trialId = StringId("NCT000001"),
- name = "arm name",
- originalName = "orig arm name"
- )
- val writtenJson = armFormat.write(arm)
-
- writtenJson should be(
- """{"id":10,"trialId":"NCT000001","name":"arm name","originalName":"orig arm name"}""".parseJson)
-
- val createArmJson = """{"trialId":"NCT000001","name":"arm name"}""".parseJson
- val parsedArm = armFormat.read(createArmJson)
- val expectedCreatedArm = arm.copy(
- id = LongId(0),
- originalName = "arm name"
- )
- parsedArm should be(expectedCreatedArm)
-
- val updateArmJson = """{"name":"new arm name"}""".parseJson
- val expectedUpdatedArm = arm.copy(name = "new arm name")
- val parsedUpdateArm = applyUpdateToArm(updateArmJson, arm)
- parsedUpdateArm should be(expectedUpdatedArm)
- }
-
-}
diff --git a/src/test/scala/xyz/driver/pdsuidomain/formats/json/BridgeUploadQueueFormatSuite.scala b/src/test/scala/xyz/driver/pdsuidomain/formats/json/BridgeUploadQueueFormatSuite.scala
deleted file mode 100644
index 9aaecae..0000000
--- a/src/test/scala/xyz/driver/pdsuidomain/formats/json/BridgeUploadQueueFormatSuite.scala
+++ /dev/null
@@ -1,32 +0,0 @@
-package xyz.driver.pdsuidomain.formats.json
-
-import java.time.LocalDateTime
-
-import spray.json._
-import org.scalatest.{FlatSpec, Matchers}
-import xyz.driver.pdsuicommon.concurrent.BridgeUploadQueue
-
-class BridgeUploadQueueFormatSuite extends FlatSpec with Matchers {
- import xyz.driver.pdsuidomain.formats.json.bridgeuploadqueue._
-
- "Json format for BridgeUploadQueue.Item" should "read and write correct JSON" in {
- val item = BridgeUploadQueue.Item(
- kind = "kind",
- tag = "tag",
- created = LocalDateTime.parse("2017-08-10T18:00:00"),
- attempts = 0,
- nextAttempt = LocalDateTime.parse("2017-08-10T18:10:00"),
- completed = false,
- dependencyKind = Some("dependency king"),
- dependencyTag = None
- )
- val writtenJson = queueUploadItemFormat.write(item)
-
- writtenJson should be(
- """{"kind":"kind","tag":"tag","created":"2017-08-10T18:00Z","attempts":0,"nextAttempt":"2017-08-10T18:10Z","completed":false}""".parseJson)
-
- val parsedItem = queueUploadItemFormat.read(writtenJson)
- parsedItem should be(item.copy(dependencyKind = None, completed = true))
- }
-
-}
diff --git a/src/test/scala/xyz/driver/pdsuidomain/formats/json/CriterionFormatSuite.scala b/src/test/scala/xyz/driver/pdsuidomain/formats/json/CriterionFormatSuite.scala
deleted file mode 100644
index a227afa..0000000
--- a/src/test/scala/xyz/driver/pdsuidomain/formats/json/CriterionFormatSuite.scala
+++ /dev/null
@@ -1,75 +0,0 @@
-package xyz.driver.pdsuidomain.formats.json
-
-import spray.json._
-import org.scalatest.{FlatSpec, Matchers}
-import xyz.driver.pdsuicommon.domain.{LongId, StringId}
-import xyz.driver.pdsuidomain.entities.{EligibilityArm, Criterion, CriterionLabel}
-import xyz.driver.pdsuidomain.services.CriterionService.RichCriterion
-
-class CriterionFormatSuite extends FlatSpec with Matchers {
- import xyz.driver.pdsuidomain.formats.json.criterion._
-
- "Json format for Criterion" should "read and write correct JSON" in {
- val criterion = Criterion(
- id = LongId(10),
- trialId = StringId("NCT000001"),
- text = Some("text"),
- isCompound = false,
- meta = "{}",
- inclusion = None
- )
- val labels = List(
- CriterionLabel(
- id = LongId(1L),
- labelId = Some(LongId(101)),
- criterionId = criterion.id,
- categoryId = Some(LongId(3)),
- value = Some(true),
- isDefining = true
- ),
- CriterionLabel(
- id = LongId(2L),
- labelId = Some(LongId(102)),
- criterionId = criterion.id,
- categoryId = Some(LongId(3)),
- value = Some(false),
- isDefining = true
- )
- )
- val arms = List(LongId[EligibilityArm](20), LongId[EligibilityArm](21), LongId[EligibilityArm](21))
- val richCriterion = RichCriterion(
- criterion = criterion,
- armIds = arms,
- labels = labels
- )
- val writtenJson = richCriterionFormat.write(richCriterion)
-
- writtenJson should be(
- """{"text":"text","isCompound":false,"trialId":"NCT000001","inclusion":null,"arms":[20,21,21],"id":10,"meta":"{}",
- "labels":[{"labelId":101,"categoryId":3,"value":"Yes","isDefining":true},
- {"labelId":102,"categoryId":3,"value":"No","isDefining":true}]}""".parseJson)
-
- val createCriterionJson =
- """{"text":"text","isCompound":false,"trialId":"NCT000001","inclusion":null,
- "arms":[20,21,21],"meta":"{}","labels":[{"labelId":101,"categoryId":3,"value":"Yes","isDefining":true},
- {"labelId":102,"categoryId":3,"value":"No","isDefining":true}]}""".parseJson
- val parsedRichCriterion = richCriterionFormat.read(createCriterionJson)
- val expectedRichCriterion = richCriterion.copy(
- criterion = criterion.copy(id = LongId(0)),
- labels = labels.map(_.copy(id = LongId(0), criterionId = LongId(0)))
- )
- parsedRichCriterion should be(expectedRichCriterion)
-
- val updateCriterionJson = """{"meta":null,"text":"new text","isCompound":true,"inclusion":true}""".parseJson
- val expectedUpdatedCriterion = richCriterion.copy(
- criterion = criterion.copy(
- text = Some("new text"),
- isCompound = true,
- meta = "{}",
- inclusion = Some(true)
- ))
- val parsedUpdateCriterion = applyUpdateToCriterion(updateCriterionJson, richCriterion)
- parsedUpdateCriterion should be(expectedUpdatedCriterion)
- }
-
-}
diff --git a/src/test/scala/xyz/driver/pdsuidomain/formats/json/DocumentFormatSuite.scala b/src/test/scala/xyz/driver/pdsuidomain/formats/json/DocumentFormatSuite.scala
deleted file mode 100644
index 5e33805..0000000
--- a/src/test/scala/xyz/driver/pdsuidomain/formats/json/DocumentFormatSuite.scala
+++ /dev/null
@@ -1,73 +0,0 @@
-package xyz.driver.pdsuidomain.formats.json
-
-import java.time.{LocalDate, LocalDateTime}
-
-import spray.json._
-import org.scalatest.{FlatSpec, Matchers}
-import xyz.driver.pdsuicommon.domain.{LongId, TextJson}
-import xyz.driver.pdsuidomain.entities.Document
-
-class DocumentFormatSuite extends FlatSpec with Matchers {
- import xyz.driver.pdsuidomain.formats.json.document._
-
- "Json format for Document" should "read and write correct JSON" in {
- val orig = Document(
- id = LongId(1),
- status = Document.Status.New,
- assignee = None,
- previousStatus = None,
- previousAssignee = None,
- lastActiveUserId = None,
- lastUpdate = LocalDateTime.parse("2017-08-10T18:00:00"),
- recordId = LongId(101),
- physician = Some("physician"),
- typeId = Some(LongId(10)),
- providerName = Some("provider 21"),
- providerTypeId = Some(LongId(21)),
- institutionName = Some("institution name"),
- requiredType = Some(Document.RequiredType.OPN),
- meta = None,
- startDate = None,
- endDate = None,
- labelVersion = 0
- )
- val writtenJson = documentFormat.write(orig)
-
- writtenJson should be(
- """{"id":1,"recordId":101,"physician":"physician","typeId":10,"provider":"provider 21","providerTypeId":21,
- "requiredType":"OPN","institutionName":"institution name","startDate":null,"endDate":null,"status":"New","assignee":null,"previousStatus":null,
- "previousAssignee":null,"lastActiveUser":null,"lastUpdate":"2017-08-10T18:00Z","meta":null,"labelVersion":0}""".parseJson)
-
- val createDocumentJson =
- """{"recordId":101,"physician":"physician","typeId":10,"provider":"provider 21","providerTypeId":21}""".parseJson
- val expectedCreatedDocument = orig.copy(
- id = LongId(0),
- lastUpdate = LocalDateTime.MIN,
- requiredType = None,
- institutionName = None
- )
- val parsedCreatedDocument = documentFormat.read(createDocumentJson)
- parsedCreatedDocument should be(expectedCreatedDocument)
-
- val updateDocumentJson =
- """{"startDate":"2017-08-10","endDate":"2018-08-10","meta":{"startPage":1.0,"endPage":2.0}}""".parseJson
- val expectedUpdatedDocument = orig.copy(
- startDate = Some(LocalDate.parse("2017-08-10")),
- endDate = Some(LocalDate.parse("2018-08-10")),
- meta = Some(TextJson(Document.Meta(startPage = 1.0, endPage = 2.0)))
- )
- val parsedUpdatedDocument = applyUpdateToDocument(updateDocumentJson, orig)
- parsedUpdatedDocument should be(expectedUpdatedDocument)
- }
-
- "Json format for Document.Meta" should "read and write correct JSON" in {
- val meta = Document.Meta(startPage = 1.0, endPage = 2.0)
- val writtenJson = documentMetaFormat.write(meta)
- writtenJson should be("""{"startPage":1.0,"endPage":2.0}""".parseJson)
-
- val metaJson = """{"startPage":1.0,"endPage":2.0}""".parseJson
- val parsedMeta = documentMetaFormat.read(metaJson)
- parsedMeta should be(meta)
- }
-
-}
diff --git a/src/test/scala/xyz/driver/pdsuidomain/formats/json/DocumentHistoryFormatSuite.scala b/src/test/scala/xyz/driver/pdsuidomain/formats/json/DocumentHistoryFormatSuite.scala
deleted file mode 100644
index d85a53b..0000000
--- a/src/test/scala/xyz/driver/pdsuidomain/formats/json/DocumentHistoryFormatSuite.scala
+++ /dev/null
@@ -1,49 +0,0 @@
-package xyz.driver.pdsuidomain.formats.json
-
-import java.time.LocalDateTime
-
-import org.scalatest.{FreeSpecLike, Matchers}
-import spray.json._
-import xyz.driver.pdsuicommon.domain.LongId
-import xyz.driver.pdsuidomain.entities.DocumentHistory
-
-class DocumentHistoryFormatSuite extends FreeSpecLike with Matchers {
- import xyz.driver.pdsuidomain.formats.json.documenthistory._
-
- "Can read and write DocumentHistory states" - {
- val states = DocumentHistory.State.All
- states.foreach { state =>s"$state" in test(state)}
- }
-
- "Can read and write DocumentHistory actions" - {
- val actions = DocumentHistory.Action.All
- actions.foreach { action =>s"$action" in test(action)}
- }
-
- private def test(state: DocumentHistory.State) = {
- documentStateFormat.read(documentStateFormat.write(state)) shouldBe state
- }
-
- private def test(action: DocumentHistory.Action) = {
- documentActionFormat.read(documentActionFormat.write(action)) shouldBe action
- }
-
- "Json format for DocumentHistory should read and write correct JSON" - {
- val documentHistory = DocumentHistory(
- id = LongId(10),
- documentId = LongId(1),
- executor = xyz.driver.core.Id("userId-001"),
- state = DocumentHistory.State.Extract,
- action = DocumentHistory.Action.Start,
- created = LocalDateTime.parse("2017-08-10T18:00:00")
- )
- val writtenJson = documentHistoryFormat.write(documentHistory)
-
- writtenJson should be("""{"id":10,"executor":"userId-001","documentId":1,"state":"Extract",
- "action":"Start","created":"2017-08-10T18:00Z"}""".parseJson)
-
- val parsedDocumentHistory = documentHistoryFormat.read(writtenJson)
- parsedDocumentHistory should be(documentHistory)
- }
-
-}
diff --git a/src/test/scala/xyz/driver/pdsuidomain/formats/json/DocumentIssueFormatSuite.scala b/src/test/scala/xyz/driver/pdsuidomain/formats/json/DocumentIssueFormatSuite.scala
deleted file mode 100644
index 2ddd5e7..0000000
--- a/src/test/scala/xyz/driver/pdsuidomain/formats/json/DocumentIssueFormatSuite.scala
+++ /dev/null
@@ -1,48 +0,0 @@
-package xyz.driver.pdsuidomain.formats.json
-
-import java.time.LocalDateTime
-
-import org.scalatest.{FlatSpec, Matchers}
-import spray.json._
-import xyz.driver.pdsuicommon.domain.LongId
-import xyz.driver.pdsuidomain.entities.DocumentIssue
-
-class DocumentIssueFormatSuite extends FlatSpec with Matchers {
- import xyz.driver.pdsuidomain.formats.json.documentissue._
-
- "Json format for DocumentIssue" should "read and write correct JSON" in {
- val documentIssue = DocumentIssue(
- id = LongId(10),
- documentId = LongId(1),
- userId = xyz.driver.core.Id("userId-001"),
- lastUpdate = LocalDateTime.parse("2017-08-10T18:00:00"),
- isDraft = false,
- text = "message text",
- archiveRequired = false,
- startPage = Some(1.0),
- endPage = Some(2.0)
- )
- val writtenJson = documentIssueFormat.write(documentIssue)
-
- writtenJson should be(
- """{"id":10,"userId":"userId-001","documentId":1,"lastUpdate":"2017-08-10T18:00Z","isDraft":false,
- "text":"message text","archiveRequired":false,"startPage":1.0,"endPage":2.0}""".parseJson)
-
- val createDocumentIssueJson = """{"text":"message text","startPage":1.0,"endPage":2.0}""".parseJson
- val expectedCreatedDocumentIssue =
- documentIssue.copy(id = LongId(0), lastUpdate = LocalDateTime.MIN, isDraft = true)
- val parsedCreateDocumentIssue = jsValueToDocumentIssue(createDocumentIssueJson, LongId(1), xyz.driver.core.Id("userId-001"))
- parsedCreateDocumentIssue should be(expectedCreatedDocumentIssue)
-
- val updateDocumentIssueJson =
- """{"text":"new issue text","evidence":"issue evidence","archiveRequired":true,"startPage":1.0,"endPage":4.0}""".parseJson
- val expectedUpdatedDocumentIssue = documentIssue.copy(
- text = "new issue text",
- archiveRequired = true,
- endPage = Some(4.0)
- )
- val parsedUpdateDocumentIssue = applyUpdateToDocumentIssue(updateDocumentIssueJson, documentIssue)
- parsedUpdateDocumentIssue should be(expectedUpdatedDocumentIssue)
- }
-
-}
diff --git a/src/test/scala/xyz/driver/pdsuidomain/formats/json/EligibilityArmWithDiseasesFormatSuite.scala b/src/test/scala/xyz/driver/pdsuidomain/formats/json/EligibilityArmWithDiseasesFormatSuite.scala
deleted file mode 100644
index 4203680..0000000
--- a/src/test/scala/xyz/driver/pdsuidomain/formats/json/EligibilityArmWithDiseasesFormatSuite.scala
+++ /dev/null
@@ -1,56 +0,0 @@
-package xyz.driver.pdsuidomain.formats.json
-
-import spray.json._
-import org.scalatest.{FlatSpec, Matchers}
-import xyz.driver.entities.patient.CancerType
-import xyz.driver.pdsuicommon.domain.{LongId, StringId}
-import xyz.driver.pdsuidomain.entities.{EligibilityArm, EligibilityArmDisease, EligibilityArmWithDiseases}
-
-class EligibilityArmWithDiseasesFormatSuite extends FlatSpec with Matchers {
- import xyz.driver.pdsuidomain.formats.json.eligibilityarm._
-
- "Json format for EligibilityArmWithDiseases" should "read and write correct JSON" in {
- val name = "arm name"
-
- val arm = EligibilityArm(
- id = LongId(0),
- trialId = StringId("NCT000001"),
- name = name,
- originalName = name
- )
-
- val disease = EligibilityArmDisease(
- arm.id,
- disease = CancerType.Lung
- )
-
- val eligibilityArmWithDiseases =
- EligibilityArmWithDiseases(
- arm,
- Seq(disease)
- )
-
- val writtenJson = eligibilityArmWithDiseasesWriter.write(eligibilityArmWithDiseases)
-
- writtenJson should be(
- """{"id":0,"trialId":"NCT000001","name":"arm name","originalName":"arm name","diseases":["Lung"]}""".parseJson)
-
- val createArmWithDiseasesJson = """{"trialId":"NCT000001","name":"arm name","diseases":["Lung"]}""".parseJson
- val parsedArmWithDiseases = eligibilityArmWithDiseasesReader.read(createArmWithDiseasesJson)
- parsedArmWithDiseases should be(eligibilityArmWithDiseases)
-
- val updateArmWithDiseasesJson = """{"name":"new arm name","diseases":["Lung","Breast"]}""".parseJson
- val expectedUpdatedArmWithDiseases = eligibilityArmWithDiseases.copy(
- eligibilityArm = eligibilityArmWithDiseases.eligibilityArm.copy(name = "new arm name"),
- eligibilityArmDiseases = Seq(disease, disease.copy(disease = CancerType.Breast))
- )
-
- val parsedUpdateArmWithDiseases =
- applyUpdateToEligibilityArmWithDiseases(
- updateArmWithDiseasesJson,
- eligibilityArmWithDiseases
- )
-
- parsedUpdateArmWithDiseases should be(expectedUpdatedArmWithDiseases)
- }
-}
diff --git a/src/test/scala/xyz/driver/pdsuidomain/formats/json/ExportFormatSuite.scala b/src/test/scala/xyz/driver/pdsuidomain/formats/json/ExportFormatSuite.scala
deleted file mode 100644
index 9c53d3b..0000000
--- a/src/test/scala/xyz/driver/pdsuidomain/formats/json/ExportFormatSuite.scala
+++ /dev/null
@@ -1,129 +0,0 @@
-package xyz.driver.pdsuidomain.formats.json
-
-import java.time.{LocalDate, LocalDateTime}
-
-import org.scalatest.{FlatSpec, Matchers}
-import spray.json._
-import xyz.driver.core.Id
-import xyz.driver.entities.clinic.ClinicalRecord
-import xyz.driver.entities.labels.LabelValue
-import xyz.driver.pdsuicommon.domain.{LongId, StringId, UuidId}
-import xyz.driver.pdsuidomain.entities.{DocumentType, ProviderType}
-
-class ExportFormatSuite extends FlatSpec with Matchers {
- import xyz.driver.pdsuidomain.formats.json.export._
-
- "Json format for ExportPatientWithLabels" should "read and write correct JSON" in {
- import xyz.driver.pdsuidomain.entities.export.patient._
- val document = ExportPatientLabelEvidenceDocument(
- documentId = LongId(101),
- requestId = Id[ClinicalRecord]("7b54a75d-4197-4b27-9045-b9b6cb131be9"),
- documentType = DocumentType.OutpatientPhysicianNote,
- providerType = ProviderType.Surgery,
- date = LocalDate.parse("2017-08-10")
- )
-
- val labels = List(
- ExportPatientLabel(
- id = LongId(1),
- evidences = List(
- ExportPatientLabelEvidence(
- id = LongId(11),
- value = LabelValue.Yes,
- evidenceText = "evidence text 11",
- document = document
- ),
- ExportPatientLabelEvidence(
- id = LongId(12),
- value = LabelValue.No,
- evidenceText = "evidence text 12",
- document = document
- )
- )
- ),
- ExportPatientLabel(
- id = LongId(2),
- evidences = List(
- ExportPatientLabelEvidence(
- id = LongId(12),
- value = LabelValue.Yes,
- evidenceText = "evidence text 12",
- document = document
- ),
- ExportPatientLabelEvidence(
- id = LongId(13),
- value = LabelValue.Yes,
- evidenceText = "evidence text 13",
- document = document
- )
- )
- )
- )
- val patientWithLabels = ExportPatientWithLabels(
- patientId = UuidId("748b5884-3528-4cb9-904b-7a8151d6e343"),
- labelVersion = 1L,
- labels = labels
- )
-
- val writtenJson = patientWithLabelsFormat.write(patientWithLabels)
- writtenJson should be(
- """{"patientId":"748b5884-3528-4cb9-904b-7a8151d6e343","labelVersion":1,"labels":[{"labelId":1,"evidence":[{"evidenceId":11,
- "labelValue":"Yes","evidenceText":"evidence text 11","document":{"documentId":101,"requestId":"7b54a75d-4197-4b27-9045-b9b6cb131be9",
- "documentType":{"id":1,"name":"Outpatient Physician Note"},"providerType":{"id":2,"name":"Surgery"},"date":"2017-08-10"}},
- {"evidenceId":12,"labelValue":"No","evidenceText":"evidence text 12","document":{"documentId":101,"requestId":"7b54a75d-4197-4b27-9045-b9b6cb131be9",
- "documentType":{"id":1,"name":"Outpatient Physician Note"},"providerType":{"id":2,"name":"Surgery"},"date":"2017-08-10"}}]},
- {"labelId":2,"evidence":[{"evidenceId":12,"labelValue":"Yes","evidenceText":"evidence text 12","document":
- {"documentId":101,"requestId":"7b54a75d-4197-4b27-9045-b9b6cb131be9","documentType":{"id":1,"name":"Outpatient Physician Note"},
- "providerType":{"id":2,"name":"Surgery"},"date":"2017-08-10"}},{"evidenceId":13,"labelValue":"Yes","evidenceText":"evidence text 13",
- "document":{"documentId":101,"requestId":"7b54a75d-4197-4b27-9045-b9b6cb131be9","documentType":{"id":1,"name":"Outpatient Physician Note"},
- "providerType":{"id":2,"name":"Surgery"},"date":"2017-08-10"}}]}]}""".parseJson)
- }
-
- "Json format for ApiExportTrialWithLabels" should "read and write correct JSON" in {
- import xyz.driver.pdsuidomain.entities.export.trial._
- val arms = List(
- ExportTrialArm(armId = LongId(1), armName = "arm 1", diseaseList = Seq("Breast")),
- ExportTrialArm(armId = LongId(2), armName = "arm 2", diseaseList = Seq("Breast"))
- )
- val criteriaList = List(
- ExportTrialLabelCriterion(
- criterionId = LongId(10),
- value = Some(true),
- labelId = LongId(21),
- armIds = Set(LongId(1), LongId(2)),
- criteria = "criteria 10 text",
- isCompound = false,
- isDefining = false,
- inclusion = Some(false)
- ),
- ExportTrialLabelCriterion(
- criterionId = LongId(11),
- value = None,
- labelId = LongId(21),
- armIds = Set(LongId(2)),
- criteria = "criteria 11 text",
- isCompound = true,
- isDefining = false,
- inclusion = None
- )
- )
- val trialWithLabels = ExportTrialWithLabels(
- nctId = StringId("NCT000001"),
- trialId = UuidId("40892a07-c638-49d2-9795-1edfefbbcc7c"),
- lastReviewed = LocalDateTime.parse("2017-08-10T18:00:00"),
- labelVersion = 1L,
- arms = arms,
- criteria = criteriaList
- )
-
- val writtenJson = trialWithLabelsFormat.write(trialWithLabels)
- writtenJson should be(
- """{"nctId":"NCT000001","trialId":"40892a07-c638-49d2-9795-1edfefbbcc7c","lastReviewed":"2017-08-10T18:00Z",
- "labelVersion":1,"arms":[{"armId":1,"armName":"arm 1","diseaseList":["Breast"]},{"armId":2,"armName":"arm 2","diseaseList":["Breast"]}],"criteria":[
- {"value":"Yes","labelId":21,"criterionId":10,"criterionText":"criteria 10 text","armIds":[1,2],"isCompound":false,
- "isDefining":false,"inclusion":false},
- {"value":"Unknown","labelId":21,"criterionId":11,"criterionText":"criteria 11 text","armIds":[2],"isCompound":true,
- "isDefining":false,"inclusion":null}]}""".parseJson)
- }
-
-}
diff --git a/src/test/scala/xyz/driver/pdsuidomain/formats/json/ExtractedDataFormatSuite.scala b/src/test/scala/xyz/driver/pdsuidomain/formats/json/ExtractedDataFormatSuite.scala
deleted file mode 100644
index d1d8d44..0000000
--- a/src/test/scala/xyz/driver/pdsuidomain/formats/json/ExtractedDataFormatSuite.scala
+++ /dev/null
@@ -1,109 +0,0 @@
-package xyz.driver.pdsuidomain.formats.json
-
-import spray.json._
-import org.scalatest.{FlatSpec, Matchers}
-import xyz.driver.entities.labels.LabelValue
-import xyz.driver.pdsuicommon.domain.{LongId, TextJson}
-import xyz.driver.pdsuidomain.entities.ExtractedData.Meta
-import xyz.driver.pdsuidomain.entities.{ExtractedData, ExtractedDataLabel}
-import xyz.driver.pdsuidomain.services.ExtractedDataService.RichExtractedData
-
-class ExtractedDataFormatSuite extends FlatSpec with Matchers {
- import xyz.driver.pdsuidomain.formats.json.extracteddata._
-
- "Json format for ExtractedData" should "read and write correct JSON" in {
- val extractedData = ExtractedData(
- id = LongId(1),
- documentId = LongId(101),
- keywordId = Some(LongId(201)),
- evidenceText = Some("evidence text"),
- meta = Option(TextJson(Meta(
- evidence = None,
- keyword =
- Some(Meta.Keyword(
- page = 1,
- pageRatio = Some(1.6161616161616161d),
- index = 0,
- sortIndex = "1080000"
- ))
- )
- )))
-
- val extractedDataLabels = List(
- ExtractedDataLabel(
- id = LongId(1),
- dataId = extractedData.id,
- labelId = None,
- categoryId = None,
- value = Some(LabelValue.Yes)
- ),
- ExtractedDataLabel(
- id = LongId(2),
- dataId = extractedData.id,
- labelId = Some(LongId(12)),
- categoryId = Some(LongId(1)),
- value = Some(LabelValue.No)
- )
- )
- val origRichExtractedData = RichExtractedData(
- extractedData = extractedData,
- labels = extractedDataLabels
- )
- val writtenJson = extractedDataFormat.write(origRichExtractedData)
-
- writtenJson should be(
- """{"id":1,"documentId":101,"keywordId":201,"evidence":"evidence text","meta":null,
- "labels":[{"id":null,"categoryId":null,"value":"Yes"},{"id":12,"categoryId":1,"value":"No"}],
- "meta":{"keyword":{"index":0,"page":1,"pageRatio":1.6161616161616161,"sortIndex":"1080000"}}}""".parseJson)
-
- val createExtractedDataJson =
- """{"documentId":101,"keywordId":201,"evidence":"evidence text",
- "labels":[{"value":"Yes"},{"id":12,"categoryId":1,"value":"No"}],
- "meta":{"keyword":{"index":0,"page":1,"pageRatio":1.6161616161616161,"sortIndex":"1080000"}}}""".parseJson
- val expectedCreatedExtractedData = origRichExtractedData.copy(
- extractedData = extractedData.copy(id = LongId(0)),
- labels = extractedDataLabels.map(_.copy(id = LongId(0), dataId = LongId(0)))
- )
- val parsedCreatedExtractedData = extractedDataFormat.read(createExtractedDataJson)
- parsedCreatedExtractedData should be(expectedCreatedExtractedData)
-
- val updateExtractedDataJson =
- """{"evidence":"new evidence text","meta":{"keyword":{"page":1,"index":2,"sortIndex":"ASC"},
- "evidence":{"pageRatio":1.0,"start":{"page":1,"index":3,"offset":2},"end":{"page":2,"index":3,"offset":10}}},
- "labels":[{"id":20,"categoryId":1,"value":"Yes"},{"id":12,"categoryId":1,"value":"No"}]}""".parseJson
- val updatedExtractedDataLabels = List(
- ExtractedDataLabel(
- id = LongId(0),
- dataId = extractedData.id,
- labelId = Some(LongId(20)),
- categoryId = Some(LongId(1)),
- value = Some(LabelValue.Yes)
- ),
- ExtractedDataLabel(
- id = LongId(0),
- dataId = extractedData.id,
- labelId = Some(LongId(12)),
- categoryId = Some(LongId(1)),
- value = Some(LabelValue.No)
- )
- )
- val expectedUpdatedExtractedData = origRichExtractedData.copy(
- extractedData = extractedData.copy(
- evidenceText = Some("new evidence text"),
- meta = Some(
- TextJson(Meta(
- keyword = Some(Meta.Keyword(page = 1, pageRatio = None, index = 2, sortIndex = "ASC")),
- evidence = Some(Meta.Evidence(
- pageRatio = 1.0,
- start = Meta.TextLayerPosition(page = 1, index = 3, offset = 2),
- end = Meta.TextLayerPosition(page = 2, index = 3, offset = 10)
- ))
- )))
- ),
- labels = updatedExtractedDataLabels
- )
- val parsedUpdatedExtractedData = applyUpdateToExtractedData(updateExtractedDataJson, origRichExtractedData)
- parsedUpdatedExtractedData should be(expectedUpdatedExtractedData)
- }
-
-}
diff --git a/src/test/scala/xyz/driver/pdsuidomain/formats/json/HypothesisFormatSuite.scala b/src/test/scala/xyz/driver/pdsuidomain/formats/json/HypothesisFormatSuite.scala
deleted file mode 100644
index 6d51873..0000000
--- a/src/test/scala/xyz/driver/pdsuidomain/formats/json/HypothesisFormatSuite.scala
+++ /dev/null
@@ -1,27 +0,0 @@
-package xyz.driver.pdsuidomain.formats.json
-
-import spray.json._
-import org.scalatest.{FlatSpec, Matchers}
-import xyz.driver.pdsuicommon.domain.UuidId
-import xyz.driver.pdsuidomain.entities.Hypothesis
-
-class HypothesisFormatSuite extends FlatSpec with Matchers {
- import xyz.driver.pdsuidomain.formats.json.hypothesis._
-
- "Json format for Hypothesis" should "read and write correct JSON" in {
- val hypothesis = Hypothesis(
- id = UuidId("3b80b2e2-5372-4cf5-a342-6e4ebe10fafd"),
- name = "hypothesis name",
- treatmentType = "treatment type",
- description = "descr"
- )
- val writtenJson = hypothesisFormat.write(hypothesis)
-
- writtenJson should be("""{"id":"3b80b2e2-5372-4cf5-a342-6e4ebe10fafd","name":"hypothesis name",
- "treatmentType":"treatment type","description":"descr"}""".parseJson)
-
- val parsedHypothesis = hypothesisFormat.read(writtenJson)
- parsedHypothesis should be(hypothesis)
- }
-
-}
diff --git a/src/test/scala/xyz/driver/pdsuidomain/formats/json/InterventionFormatSuite.scala b/src/test/scala/xyz/driver/pdsuidomain/formats/json/InterventionFormatSuite.scala
deleted file mode 100644
index 015c7b5..0000000
--- a/src/test/scala/xyz/driver/pdsuidomain/formats/json/InterventionFormatSuite.scala
+++ /dev/null
@@ -1,73 +0,0 @@
-package xyz.driver.pdsuidomain.formats.json
-
-import spray.json._
-import org.scalatest.{FlatSpec, Matchers}
-import xyz.driver.pdsuicommon.domain.{LongId, StringId}
-import xyz.driver.pdsuidomain.entities.{Intervention, InterventionArm, InterventionType, InterventionWithArms}
-
-class InterventionFormatSuite extends FlatSpec with Matchers {
- import xyz.driver.pdsuidomain.formats.json.intervention._
-
- "Json format for Intervention" should "read and write correct JSON" in {
- val intervention = Intervention(
- id = LongId(1),
- trialId = StringId("NCT000001"),
- name = "intervention name",
- originalName = "orig name",
- typeId = Some(LongId(10)),
- originalType = Some("orig type"),
- dosage = "",
- originalDosage = "",
- isActive = true,
- deliveryMethod = Some("Inhalation")
- )
- val arms = List(
- InterventionArm(interventionId = intervention.id, armId = LongId(20)),
- InterventionArm(interventionId = intervention.id, armId = LongId(21)),
- InterventionArm(interventionId = intervention.id, armId = LongId(22))
- )
- val orig = InterventionWithArms(
- intervention = intervention,
- arms = arms
- )
- val writtenJson = interventionFormat.write(orig)
-
- writtenJson should be(
- """{"id":1,"name":"intervention name","typeId":10,"dosage":"","isActive":true,"arms":[20,21,22],
- "trialId":"NCT000001","deliveryMethod":"Inhalation","originalName":"orig name","originalDosage":"","originalType":"orig type"}""".parseJson)
-
- val createInterventionJson =
- """{"id":1,"name":"intervention name","typeId":10,"dosage":"","isActive":true,"arms":[20,21,22],
- "trialId":"NCT000001","deliveryMethod":"Inhalation"}""".parseJson
- val parsedCreateIntervention = interventionFormat.read(createInterventionJson)
- val expectedCreateIntervention = parsedCreateIntervention.copy(
- intervention = intervention.copy(id = LongId(0), originalType = None, originalName = "intervention name"),
- arms = arms.map(_.copy(interventionId = LongId(0)))
- )
- parsedCreateIntervention should be(expectedCreateIntervention)
-
- val updateInterventionJson = """{"dosage":"descr","deliveryMethod":null,"arms":[21,22]}""".parseJson
- val expectedUpdatedIntervention = orig.copy(
- intervention = intervention.copy(dosage = "descr", deliveryMethod = None),
- arms = List(
- InterventionArm(interventionId = intervention.id, armId = LongId(21)),
- InterventionArm(interventionId = intervention.id, armId = LongId(22))
- )
- )
- val parsedUpdateIntervention = applyUpdateToInterventionWithArms(updateInterventionJson, orig)
- parsedUpdateIntervention should be(expectedUpdatedIntervention)
- }
-
- "Json format for InterventionType" should "read and write correct JSON" in {
- val interventionType = InterventionType.SurgeryProcedure
- val writtenJson = interventionTypeFormat.write(interventionType)
-
- writtenJson should be(
- """{"id":9,"name":"Surgery/Procedure","deliveryMethods":["Radio-Frequency Ablation (RFA)",
- "Cryoablation","Therapeutic Conventional Surgery","Robotic Assisted Laparoscopic Surgery"]}""".parseJson)
-
- val parsedInterventionType = interventionTypeFormat.read(writtenJson)
- parsedInterventionType should be(interventionType)
- }
-
-}
diff --git a/src/test/scala/xyz/driver/pdsuidomain/formats/json/ListResponseFormatSuite.scala b/src/test/scala/xyz/driver/pdsuidomain/formats/json/ListResponseFormatSuite.scala
deleted file mode 100644
index e43e922..0000000
--- a/src/test/scala/xyz/driver/pdsuidomain/formats/json/ListResponseFormatSuite.scala
+++ /dev/null
@@ -1,102 +0,0 @@
-package xyz.driver.pdsuidomain.formats.json
-
-import java.time.LocalDateTime
-
-import spray.json._
-import org.scalatest.{FlatSpec, Matchers}
-import xyz.driver.core.Id
-import xyz.driver.entities.clinic.ClinicalRecord
-import xyz.driver.pdsuicommon.domain.{LongId, UuidId}
-import xyz.driver.pdsuidomain.ListResponse
-import xyz.driver.pdsuidomain.entities.MedicalRecord.Status
-import xyz.driver.pdsuidomain.entities._
-import xyz.driver.pdsuidomain.formats.json.record.recordFormat
-import xyz.driver.pdsuidomain.formats.json.listresponse._
-
-
-class ListResponseFormatSuite extends FlatSpec with Matchers {
-
- private val lastUpdate = LocalDateTime.parse("2017-08-10T18:00:00")
- private val lastUpdateToLocal = "2017-08-10T18:00Z"
-
- def metaJsonObjectAsString(meta: ListResponse.Meta): String = {
- import meta._
- val lastUpdate = meta.lastUpdate
- .map(_ => s""","lastUpdate":"$lastUpdateToLocal"""")
- .getOrElse("")
-
- s"""{"itemsCount":$itemsCount,"pageNumber":$pageNumber,"pageSize":$pageSize$lastUpdate}"""
- }
-
- "Json format for ListResponse.Meta" should "read and write correct JSON" in {
- val meta1 =
- ListResponse.Meta(
- itemsCount = 5,
- pageNumber = 6,
- pageSize = 7,
- lastUpdate = None
- )
-
- val writtenJson1 = listResponseMetaFormat.write(meta1)
-
- writtenJson1 should be(metaJsonObjectAsString(meta1).parseJson)
-
- val parsedItem1: ListResponse.Meta = listResponseMetaFormat.read(writtenJson1)
-
- meta1 shouldBe parsedItem1
-
- val meta2 =
- ListResponse.Meta(
- itemsCount = 1,
- pageNumber = 4,
- pageSize = 3,
- lastUpdate = Some(lastUpdate)
- )
-
- val writtenJson2 = listResponseMetaFormat.write(meta2)
-
- writtenJson2 should be(metaJsonObjectAsString(meta2).parseJson)
-
- val parsedItem2: ListResponse.Meta = listResponseMetaFormat.read(writtenJson2)
-
- meta2 shouldBe parsedItem2
- }
-
- "Json format for ListResponse" should "write correct JSON" in {
-
- val orig = MedicalRecord(
- id = LongId(1),
- status = Status.New,
- assignee = None,
- previousStatus = None,
- previousAssignee = None,
- lastActiveUserId = None,
- lastUpdate = LocalDateTime.parse("2017-08-10T18:00:00"),
- physician = Some("physician"),
- meta = None,
- disease = "Breast",
- requestId = Id[ClinicalRecord]("7b54a75d-4197-4b27-9045-b9b6cb131be9"),
- caseId = None,
- patientId = UuidId("748b5884-3528-4cb9-904b-7a8151d6e343"),
- totalPages = 10
- )
-
- val recordJsonAsString = recordFormat.write(orig)
-
- val meta =
- ListResponse.Meta(
- itemsCount = 5,
- pageNumber = 6,
- pageSize = 7,
- lastUpdate = None
- )
-
- val listResponse = ListResponse(Seq(orig), meta)
-
- val writtenJson = listResponseWriter[MedicalRecord].write(listResponse)
- val expectedJson = s"""{"items":[$recordJsonAsString],"meta":${listResponseMetaFormat.write(meta)}}"""
-
- writtenJson should be(expectedJson.parseJson)
- }
-
-}
diff --git a/src/test/scala/xyz/driver/pdsuidomain/formats/json/MedicalRecordFormatSuite.scala b/src/test/scala/xyz/driver/pdsuidomain/formats/json/MedicalRecordFormatSuite.scala
deleted file mode 100644
index 86462b2..0000000
--- a/src/test/scala/xyz/driver/pdsuidomain/formats/json/MedicalRecordFormatSuite.scala
+++ /dev/null
@@ -1,152 +0,0 @@
-package xyz.driver.pdsuidomain.formats.json
-
-import java.time.LocalDateTime
-
-import spray.json._
-import org.scalatest.{FlatSpec, Matchers}
-import xyz.driver.core.Id
-import xyz.driver.entities.clinic.ClinicalRecord
-import xyz.driver.pdsuicommon.domain.{LongId, TextJson, UuidId}
-import xyz.driver.pdsuidomain.entities.MedicalRecord
-
-class MedicalRecordFormatSuite extends FlatSpec with Matchers {
- import xyz.driver.pdsuidomain.formats.json.record._
- import MedicalRecord._
-
- "Json format for MedicalRecord.Meta" should "read and write correct JSON" in {
- val duplicate1 = Meta.Duplicate(
- startPage = 1.0d,
- endPage = 2.0d,
- startOriginalPage = 1.0d,
- endOriginalPage = Some(2.0d)
- )
-
- val duplicate2 = Meta.Duplicate(
- startPage = 1.0d,
- endPage = 2.0d,
- startOriginalPage = 1.0d,
- endOriginalPage = None
- )
-
- val reorder = Meta.Reorder(
- Seq(1, 2)
- )
-
- val rotation = Meta.Rotation(
- Map("item1" -> 1, "item2" -> 2)
- )
-
- val writtenDuplicateJson1 =
- duplicateMetaFormat.write(duplicate1)
-
- val writtenDuplicateJson2 =
- duplicateMetaFormat.write(duplicate2)
-
- val writtenReorderJson =
- reorderMetaFormat.write(reorder)
-
- val writtenRotationJson =
- rotateMetaFormat.write(rotation)
-
- writtenDuplicateJson1 should be(
- """{"startOriginalPage":1.0,"endPage":2.0,"startPage":1.0,"type":"duplicate","endOriginalPage":2.0}""".parseJson)
-
- writtenDuplicateJson2 should be(
- """{"startOriginalPage":1.0,"endPage":2.0,"startPage":1.0,"type":"duplicate","endOriginalPage":null}""".parseJson)
-
- writtenReorderJson should be(
- """{"type":"reorder","items":[1,2]}""".parseJson)
-
- writtenRotationJson should be(
- """{"type":"rotation","items":{"item1":1,"item2":2}}""".parseJson)
-
- val parsedDuplicateJson1 =
- duplicateMetaFormat.read(writtenDuplicateJson1)
-
- val parsedDuplicateJson2 =
- duplicateMetaFormat.read(writtenDuplicateJson2)
-
- val parsedReorderJson =
- reorderMetaFormat.read(writtenReorderJson)
-
- val parsedRotationJson =
- rotateMetaFormat.read(writtenRotationJson)
-
- duplicate1 should be(parsedDuplicateJson1)
-
- duplicate2 should be(parsedDuplicateJson2)
-
- reorder should be(parsedReorderJson)
-
- rotation should be(parsedRotationJson)
-
- duplicate1 should be(recordMetaTypeFormat.read(recordMetaTypeFormat.write(duplicate1)))
- duplicate2 should be(recordMetaTypeFormat.read(recordMetaTypeFormat.write(duplicate2)))
- reorder should be(recordMetaTypeFormat.read(recordMetaTypeFormat.write(reorder)))
- rotation should be(recordMetaTypeFormat.read(recordMetaTypeFormat.write(rotation)))
- }
-
-
- "Json format for MedicalRecord" should "read and write correct JSON" in {
- val orig = MedicalRecord(
- id = LongId(1),
- status = Status.New,
- assignee = None,
- previousStatus = None,
- previousAssignee = None,
- lastActiveUserId = None,
- lastUpdate = LocalDateTime.parse("2017-08-10T18:00:00"),
- physician = Some("physician"),
- meta = None,
- disease = "Breast",
- requestId = Id[ClinicalRecord]("7b54a75d-4197-4b27-9045-b9b6cb131be9"),
- caseId = None,
- patientId = UuidId("748b5884-3528-4cb9-904b-7a8151d6e343"),
- totalPages = 10
- )
- val writtenJson = recordFormat.write(orig)
-
- writtenJson should be(
- """{"id":1,"status":"New","assignee":null,"previousStatus":null,"previousAssignee":null,"lastActiveUser":null,
- "lastUpdate":"2017-08-10T18:00Z","meta":[],"patientId":"748b5884-3528-4cb9-904b-7a8151d6e343","caseId":null,
- "requestId":"7b54a75d-4197-4b27-9045-b9b6cb131be9","disease":"Breast","physician":"physician","totalPages":10}""".parseJson)
-
- val createRecordJson =
- """{"disease":"Breast","patientId":"748b5884-3528-4cb9-904b-7a8151d6e343","requestId":"7b54a75d-4197-4b27-9045-b9b6cb131be9"}""".parseJson
- val expectedCreatedRecord = MedicalRecord(
- id = LongId(0),
- status = MedicalRecord.Status.New,
- previousStatus = None,
- assignee = None,
- previousAssignee = None,
- lastActiveUserId = None,
- patientId = UuidId("748b5884-3528-4cb9-904b-7a8151d6e343"),
- requestId = Id[ClinicalRecord]("7b54a75d-4197-4b27-9045-b9b6cb131be9"),
- disease = "Breast",
- caseId = None,
- physician = None,
- meta = None,
- lastUpdate = LocalDateTime.now(),
- totalPages = 0
- )
- val parsedCreatedRecord = recordFormat.read(createRecordJson).copy(lastUpdate = expectedCreatedRecord.lastUpdate)
- parsedCreatedRecord should be(expectedCreatedRecord)
-
- val updateRecordJson =
- """{"meta":[{"type":"duplicate","startPage":1.0,"endPage":2.0,"startOriginalPage":1.0},
- {"type":"reorder","items":[1,2]},
- {"type":"rotation","items":{"item1":1,"item2":2}}]}""".parseJson
- val expectedUpdatedRecord = orig.copy(
- meta = Some(
- TextJson(
- List(
- Meta.Duplicate(startPage = 1.0, endPage = 2.0, startOriginalPage = 1.0, endOriginalPage = None),
- Meta.Reorder(Seq(1, 2)),
- Meta.Rotation(Map("item1" -> 1, "item2" -> 2))
- )))
- )
- val parsedUpdatedRecord = applyUpdateToMedicalRecord(updateRecordJson, orig)
- parsedUpdatedRecord should be(expectedUpdatedRecord)
- }
-
-}
diff --git a/src/test/scala/xyz/driver/pdsuidomain/formats/json/MedicalRecordHistoryFormatSuite.scala b/src/test/scala/xyz/driver/pdsuidomain/formats/json/MedicalRecordHistoryFormatSuite.scala
deleted file mode 100644
index c34f8c0..0000000
--- a/src/test/scala/xyz/driver/pdsuidomain/formats/json/MedicalRecordHistoryFormatSuite.scala
+++ /dev/null
@@ -1,51 +0,0 @@
-package xyz.driver.pdsuidomain.formats.json
-
-import java.time.LocalDateTime
-
-import org.scalatest.{FreeSpecLike, Matchers}
-import spray.json._
-import xyz.driver.pdsuicommon.domain.LongId
-import xyz.driver.pdsuidomain.entities.MedicalRecordHistory
-
-class MedicalRecordHistoryFormatSuite extends FreeSpecLike with Matchers {
- import xyz.driver.pdsuidomain.formats.json.recordhistory._
-
-
- "Can read and write MedicalRecordHistory states" - {
- val states = MedicalRecordHistory.State.All
- states.foreach { state =>s"$state" in test(state)}
- }
-
- "Can read and write MedicalRecordHistory actions" - {
- val actions = MedicalRecordHistory.Action.All
- actions.foreach { action =>s"$action" in test(action)}
- }
-
- private def test(state: MedicalRecordHistory.State) = {
- recordStateFormat.read(recordStateFormat.write(state)) shouldBe state
- }
-
- private def test(action: MedicalRecordHistory.Action) = {
- recordActionFormat.read(recordActionFormat.write(action)) shouldBe action
- }
-
-
- "Json format for MedicalRecordHistory should read and write correct JSON" - {
- val recordHistory = MedicalRecordHistory(
- id = LongId(10),
- recordId = LongId(1),
- executor = xyz.driver.core.Id("userId-001"),
- state = MedicalRecordHistory.State.Clean,
- action = MedicalRecordHistory.Action.Start,
- created = LocalDateTime.parse("2017-08-10T18:00:00")
- )
- val writtenJson = recordHistoryFormat.write(recordHistory)
-
- writtenJson should be("""{"id":10,"executor":"userId-001","recordId":1,"state":"Clean",
- "action":"Start","created":"2017-08-10T18:00Z"}""".parseJson)
-
- val parsedRecordHistory = recordHistoryFormat.read(writtenJson)
- parsedRecordHistory should be(recordHistory)
- }
-
-}
diff --git a/src/test/scala/xyz/driver/pdsuidomain/formats/json/MedicalRecordIssueFormatSuite.scala b/src/test/scala/xyz/driver/pdsuidomain/formats/json/MedicalRecordIssueFormatSuite.scala
deleted file mode 100644
index b93e2bd..0000000
--- a/src/test/scala/xyz/driver/pdsuidomain/formats/json/MedicalRecordIssueFormatSuite.scala
+++ /dev/null
@@ -1,47 +0,0 @@
-package xyz.driver.pdsuidomain.formats.json
-
-import java.time.LocalDateTime
-
-import org.scalatest.{FlatSpec, Matchers}
-import spray.json._
-import xyz.driver.pdsuicommon.domain.LongId
-import xyz.driver.pdsuidomain.entities.MedicalRecordIssue
-
-class MedicalRecordIssueFormatSuite extends FlatSpec with Matchers {
- import xyz.driver.pdsuidomain.formats.json.recordissue._
-
- "Json format for MedicalRecordIssue" should "read and write correct JSON" in {
- val recordIssue = MedicalRecordIssue(
- id = LongId(10),
- recordId = LongId(1),
- userId = xyz.driver.core.Id("userId-001"),
- lastUpdate = LocalDateTime.parse("2017-08-10T18:00:00"),
- isDraft = false,
- text = "message text",
- archiveRequired = false,
- startPage = Some(1.0),
- endPage = Some(2.0)
- )
- val writtenJson = recordIssueFormat.write(recordIssue)
-
- writtenJson should be(
- """{"id":10,"recordId":1,"userId":"userId-001","lastUpdate":"2017-08-10T18:00Z","isDraft":false,
- "text":"message text","archiveRequired":false,"startPage":1.0,"endPage":2.0}""".parseJson)
-
- val createRecordIssueJson = """{"text":"message text","startPage":1.0,"endPage":2.0}""".parseJson
- val expectedCreatedRecordIssue = recordIssue.copy(id = LongId(0), lastUpdate = LocalDateTime.MIN, isDraft = true)
- val parsedCreateRecordIssue = jsValueToRecordIssue(createRecordIssueJson, LongId(1), xyz.driver.core.Id("userId-001"))
- parsedCreateRecordIssue should be(expectedCreatedRecordIssue)
-
- val updateRecordIssueJson =
- """{"text":"new issue text","evidence":"issue evidence","archiveRequired":true,"startPage":1.0,"endPage":4.0}""".parseJson
- val expectedUpdatedRecordIssue = recordIssue.copy(
- text = "new issue text",
- archiveRequired = true,
- endPage = Some(4.0)
- )
- val parsedUpdateRecordIssue = applyUpdateToRecordIssue(updateRecordIssueJson, recordIssue)
- parsedUpdateRecordIssue should be(expectedUpdatedRecordIssue)
- }
-
-}
diff --git a/src/test/scala/xyz/driver/pdsuidomain/formats/json/PatientCriterionFormatSuite.scala b/src/test/scala/xyz/driver/pdsuidomain/formats/json/PatientCriterionFormatSuite.scala
deleted file mode 100644
index 370173a..0000000
--- a/src/test/scala/xyz/driver/pdsuidomain/formats/json/PatientCriterionFormatSuite.scala
+++ /dev/null
@@ -1,60 +0,0 @@
-package xyz.driver.pdsuidomain.formats.json
-
-import java.time.LocalDateTime
-
-import spray.json._
-import org.scalatest.{FlatSpec, Matchers}
-import xyz.driver.entities.labels.LabelValue
-import xyz.driver.pdsuicommon.domain.{LongId, StringId}
-import xyz.driver.pdsuidomain.entities.{DraftPatientCriterion, PatientCriterion, PatientCriterionArm, RichPatientCriterion}
-
-class PatientCriterionFormatSuite extends FlatSpec with Matchers {
- import xyz.driver.pdsuidomain.formats.json.patientcriterion._
-
- "Json format for PatientCriterion" should "read and write correct JSON" in {
- val orig = PatientCriterion(
- id = LongId(1),
- patientLabelId = LongId(1),
- trialId = 0L,
- nctId = StringId("NCT00001"),
- criterionId = LongId(101),
- criterionText = "criterion text",
- criterionValue = Some(true),
- criterionIsDefining = false,
- eligibilityStatus = LabelValue.Yes,
- verifiedEligibilityStatus = LabelValue.Unknown,
- isVisible = true,
- isVerified = true,
- lastUpdate = LocalDateTime.parse("2017-08-10T18:00:00"),
- inclusion = Some(true)
- )
- val arms = List(
- PatientCriterionArm(patientCriterionId = LongId(1), armId = LongId(31), armName = "arm 31"),
- PatientCriterionArm(patientCriterionId = LongId(1), armId = LongId(32), armName = "arm 32")
- )
- val richPatientCriterion = RichPatientCriterion(orig, LongId(21), arms)
- val writtenJson = richPatientCriterionFormat.write(richPatientCriterion)
-
- writtenJson should be(
- """{"isVerified":true,"patientLabelId":1,"lastUpdate":"2017-08-10T18:00Z","trialId":0,
- "armList":[{"patientCriterionId":1,"armId":31,"armName":"arm 31"},{"patientCriterionId":1,
- "armId":32,"armName":"arm 32"}],"eligibilityStatus":"Yes","verifiedEligibilityStatus":"Unknown","id":1,"nctId":"NCT00001",
- "criterionId":101,"criterionValue":true,"criterionIsDefining":false,"labelId":21,
- "isVisible":true,"criterionText":"criterion text","inclusion":true}""".parseJson)
-
- val updatePatientCriterionJson = """{"verifiedEligibilityStatus":"No"}""".parseJson
- val expectedUpdatedPatientCriterion = orig.copy(verifiedEligibilityStatus = LabelValue.No)
- val parsedUpdatePatientCriterion = applyUpdateToPatientCriterion(updatePatientCriterionJson, orig)
- parsedUpdatePatientCriterion should be(expectedUpdatedPatientCriterion)
-
- val updateBulkPatientCriterionJson =
- """[{"id":1,"eligibilityStatus":"No"},{"id":2,"isVerified":false}]""".parseJson
- val expectedDraftPatientCriterionList = List(
- DraftPatientCriterion(id = LongId(1), eligibilityStatus = Some(LabelValue.No), isVerified = None),
- DraftPatientCriterion(id = LongId(2), eligibilityStatus = None, isVerified = Some(false))
- )
- val parsedDraftPatientCriterionList = draftPatientCriterionListReader.read(updateBulkPatientCriterionJson)
- parsedDraftPatientCriterionList should be(expectedDraftPatientCriterionList)
- }
-
-}
diff --git a/src/test/scala/xyz/driver/pdsuidomain/formats/json/PatientEligibleTrialFormatSuite.scala b/src/test/scala/xyz/driver/pdsuidomain/formats/json/PatientEligibleTrialFormatSuite.scala
deleted file mode 100644
index 6f3bc19..0000000
--- a/src/test/scala/xyz/driver/pdsuidomain/formats/json/PatientEligibleTrialFormatSuite.scala
+++ /dev/null
@@ -1,61 +0,0 @@
-package xyz.driver.pdsuidomain.formats.json
-
-import java.time.LocalDateTime
-
-import org.scalatest.{FlatSpec, Matchers}
-import spray.json._
-import xyz.driver.entities.labels.LabelValue
-import xyz.driver.pdsuicommon.domain.{LongId, StringId, UuidId}
-import xyz.driver.pdsuidomain.entities.{PatientCriterionArm, PatientTrialArmGroupView, RichPatientEligibleTrial, Trial}
-
-class PatientEligibleTrialFormatSuite extends FlatSpec with Matchers {
- import xyz.driver.pdsuidomain.formats.json.patienteligibletrial._
-
- "Json format for PatientEligibleTrial" should "read and write correct JSON" in {
- val trial = Trial(
- id = StringId("NCT000001"),
- externalId = UuidId("40892a07-c638-49d2-9795-1edfefbbcc7c"),
- status = Trial.Status.Done,
- assignee = None,
- previousStatus = None,
- previousAssignee = None,
- lastActiveUserId = None,
- lastUpdate = LocalDateTime.parse("2017-08-10T18:16:19"),
- phase = "",
- hypothesisId = Some(UuidId("e76e2fc4-a29c-44fb-a81b-8856d06bb1d4")),
- studyDesignId = Some(LongId(321)),
- originalStudyDesign = None,
- isPartner = false,
- overview = None,
- overviewTemplate = "",
- isUpdated = false,
- title = "trial title",
- originalTitle = "orig trial title"
- )
- val group = PatientTrialArmGroupView(
- id = LongId(1),
- patientId = UuidId("748b5884-3528-4cb9-904b-7a8151d6e343"),
- trialId = StringId("NCT000001"),
- hypothesisId = UuidId("e76e2fc4-a29c-44fb-a81b-8856d06bb1d4"),
- eligibilityStatus = LabelValue.Yes,
- verifiedEligibilityStatus = LabelValue.Yes,
- isVerified = false
- )
- val arms = List(
- PatientCriterionArm(patientCriterionId = LongId(1), armId = LongId(31), armName = "arm 31"),
- PatientCriterionArm(patientCriterionId = LongId(1), armId = LongId(32), armName = "arm 32")
- )
- val orig = RichPatientEligibleTrial(trial, group, arms)
- val writtenJson = patientEligibleTrialWriter.write(orig)
-
- writtenJson should be(
- """{"id":1,"patientId":"748b5884-3528-4cb9-904b-7a8151d6e343","trialId":"NCT000001","trialTitle":"trial title",
- "hypothesisId":"e76e2fc4-a29c-44fb-a81b-8856d06bb1d4","verifiedEligibilityStatus":"Yes","isVerified":false,"arms":["arm 31","arm 32"]}""".parseJson)
-
- val updatePatientEligibleTrialJson = """{"isVerified":true}""".parseJson
- val expectedUpdatedPatientTrialArmGroup = group.copy(isVerified = true)
- val parsedUpdatePatientTrialArmGroup = applyUpdateToTrialArmGroup(updatePatientEligibleTrialJson, group)
- parsedUpdatePatientTrialArmGroup should be(expectedUpdatedPatientTrialArmGroup)
- }
-
-}
diff --git a/src/test/scala/xyz/driver/pdsuidomain/formats/json/PatientFormatSuite.scala b/src/test/scala/xyz/driver/pdsuidomain/formats/json/PatientFormatSuite.scala
deleted file mode 100644
index 6cddb45..0000000
--- a/src/test/scala/xyz/driver/pdsuidomain/formats/json/PatientFormatSuite.scala
+++ /dev/null
@@ -1,41 +0,0 @@
-package xyz.driver.pdsuidomain.formats.json
-
-import java.time.{LocalDate, LocalDateTime}
-
-import spray.json._
-import org.scalatest.{FlatSpec, Matchers}
-import xyz.driver.core.Id
-import xyz.driver.entities.clinic.TestOrder
-import xyz.driver.entities.common.FullName
-import xyz.driver.entities.patient.CancerType
-import xyz.driver.pdsuicommon.domain.UuidId
-import xyz.driver.pdsuidomain.entities.Patient
-
-class PatientFormatSuite extends FlatSpec with Matchers {
- import xyz.driver.pdsuidomain.formats.json.patient._
-
- "Json format for Patient" should "read and write correct JSON" in {
- val orig = Patient(
- id = UuidId("748b5884-3528-4cb9-904b-7a8151d6e343"),
- status = Patient.Status.New,
- name = FullName.fromStrings("John", "", "Doe"),
- dob = LocalDate.parse("1980-06-30"),
- assignee = None,
- previousStatus = None,
- previousAssignee = None,
- lastActiveUserId = None,
- isUpdateRequired = false,
- disease = CancerType.Breast,
- orderId = Id[TestOrder]("7b54a75d-4197-4b27-9045-b9b6cb131be9"),
- lastUpdate = LocalDateTime.parse("2017-08-10T18:00:00")
- )
- val writtenJson = patientFormat.write(orig)
-
- writtenJson should be(
- """{"id":"748b5884-3528-4cb9-904b-7a8151d6e343","dob":"1980-06-30",
- "name":{"firstName":"John","middleName":"","lastName":"Doe"},"status":"New","assignee":null,
- "previousStatus":null,"previousAssignee":null,"lastActiveUser":null,"lastUpdate":"2017-08-10T18:00Z",
- "orderId":"7b54a75d-4197-4b27-9045-b9b6cb131be9","disease":"Breast"}""".parseJson)
- }
-
-}
diff --git a/src/test/scala/xyz/driver/pdsuidomain/formats/json/PatientHistoryFormatSuite.scala b/src/test/scala/xyz/driver/pdsuidomain/formats/json/PatientHistoryFormatSuite.scala
deleted file mode 100644
index 74f6f70..0000000
--- a/src/test/scala/xyz/driver/pdsuidomain/formats/json/PatientHistoryFormatSuite.scala
+++ /dev/null
@@ -1,32 +0,0 @@
-package xyz.driver.pdsuidomain.formats.json
-
-import java.time.LocalDateTime
-
-import org.scalatest.{FlatSpec, Matchers}
-import spray.json._
-import xyz.driver.pdsuicommon.domain.{LongId, UuidId}
-import xyz.driver.pdsuidomain.entities.PatientHistory
-
-class PatientHistoryFormatSuite extends FlatSpec with Matchers {
- import xyz.driver.pdsuidomain.formats.json.patienthistory._
-
- "Json format for PatientHistory" should "read and write correct JSON" in {
- val patientHistory = PatientHistory(
- id = LongId(10),
- patientId = UuidId("40892a07-c638-49d2-9795-1edfefbbcc7c"),
- executor = xyz.driver.core.Id("userId-001"),
- state = PatientHistory.State.Verify,
- action = PatientHistory.Action.Start,
- created = LocalDateTime.parse("2017-08-10T18:00:00")
- )
- val writtenJson = patientHistoryFormat.write(patientHistory)
-
- writtenJson should be(
- """{"id":10,"executor":"userId-001","patientId":"40892a07-c638-49d2-9795-1edfefbbcc7c","state":"Verify",
- "action":"Start","created":"2017-08-10T18:00Z"}""".parseJson)
-
- val parsedPatientHistory = patientHistoryFormat.read(writtenJson)
- parsedPatientHistory should be(patientHistory)
- }
-
-}
diff --git a/src/test/scala/xyz/driver/pdsuidomain/formats/json/PatientHypothesisFormatSuite.scala b/src/test/scala/xyz/driver/pdsuidomain/formats/json/PatientHypothesisFormatSuite.scala
deleted file mode 100644
index 560b1b6..0000000
--- a/src/test/scala/xyz/driver/pdsuidomain/formats/json/PatientHypothesisFormatSuite.scala
+++ /dev/null
@@ -1,28 +0,0 @@
-package xyz.driver.pdsuidomain.formats.json
-
-import eu.timepit.refined.numeric.NonNegative
-import spray.json._
-import org.scalatest.{FlatSpec, Matchers}
-import xyz.driver.pdsuicommon.domain.UuidId
-import xyz.driver.pdsuidomain.entities.PatientHypothesis
-import eu.timepit.refined.refineMV
-
-class PatientHypothesisFormatSuite extends FlatSpec with Matchers {
- import xyz.driver.pdsuidomain.formats.json.patienthypothesis._
-
- "Json format for patientHypothesis" should "read and write correct JSON" in {
- val orig = PatientHypothesis(
- id = UuidId("815d9715-1089-4775-b120-3afb983b9a97"),
- patientId = UuidId("748b5884-3528-4cb9-904b-7a8151d6e343"),
- hypothesisId = UuidId("e76e2fc4-a29c-44fb-a81b-8856d06bb1d4"),
- rationale = None,
- matchedTrials = refineMV[NonNegative](1)
- )
- val writtenJson = patientHypothesisWriter.write(orig)
-
- writtenJson should be(
- """{"id":"815d9715-1089-4775-b120-3afb983b9a97","patientId":"748b5884-3528-4cb9-904b-7a8151d6e343",
- "hypothesisId":"e76e2fc4-a29c-44fb-a81b-8856d06bb1d4","rationale":null,"matchedTrials":1}""".parseJson)
- }
-
-}
diff --git a/src/test/scala/xyz/driver/pdsuidomain/formats/json/PatientIssueFormatSuite.scala b/src/test/scala/xyz/driver/pdsuidomain/formats/json/PatientIssueFormatSuite.scala
deleted file mode 100644
index ee76094..0000000
--- a/src/test/scala/xyz/driver/pdsuidomain/formats/json/PatientIssueFormatSuite.scala
+++ /dev/null
@@ -1,45 +0,0 @@
-package xyz.driver.pdsuidomain.formats.json
-
-import java.time.LocalDateTime
-
-import spray.json._
-import org.scalatest.{FlatSpec, Matchers}
-import xyz.driver.pdsuicommon.domain.{LongId, UuidId}
-import xyz.driver.pdsuidomain.entities.PatientIssue
-
-class PatientIssueFormatSuite extends FlatSpec with Matchers {
- import xyz.driver.pdsuidomain.formats.json.patientissue._
-
- "Json format for PatientIssue" should "read and write correct JSON" in {
- val patientIssue = PatientIssue(
- id = LongId(10),
- patientId = UuidId("40892a07-c638-49d2-9795-1edfefbbcc7c"),
- userId = xyz.driver.core.Id("userId-001"),
- lastUpdate = LocalDateTime.parse("2017-08-10T18:00:00"),
- isDraft = false,
- text = "message text",
- archiveRequired = false
- )
- val writtenJson = patientIssueWriter.write(patientIssue)
-
- writtenJson should be("""{"id":10,"userId":"userId-001","lastUpdate":"2017-08-10T18:00Z","isDraft":false,
- "text":"message text","archiveRequired":false}""".parseJson)
-
- val createPatientIssueJson = """{"text":"message text"}""".parseJson
- val expectedCreatedPatientIssue = patientIssue.copy(id = LongId(0), lastUpdate = LocalDateTime.MIN, isDraft = true)
- val parsedCreatePatientIssue = jsValueToPatientIssue(createPatientIssueJson,
- UuidId("40892a07-c638-49d2-9795-1edfefbbcc7c"),
- xyz.driver.core.Id("userId-001"))
- parsedCreatePatientIssue should be(expectedCreatedPatientIssue)
-
- val updatePatientIssueJson =
- """{"text":"new issue text","evidence":"issue evidence","archiveRequired":true}""".parseJson
- val expectedUpdatedPatientIssue = patientIssue.copy(
- text = "new issue text",
- archiveRequired = true
- )
- val parsedUpdatePatientIssue = applyUpdateToPatientIssue(updatePatientIssueJson, patientIssue)
- parsedUpdatePatientIssue should be(expectedUpdatedPatientIssue)
- }
-
-}
diff --git a/src/test/scala/xyz/driver/pdsuidomain/formats/json/PatientLabelFormatSuite.scala b/src/test/scala/xyz/driver/pdsuidomain/formats/json/PatientLabelFormatSuite.scala
deleted file mode 100644
index 9340d02..0000000
--- a/src/test/scala/xyz/driver/pdsuidomain/formats/json/PatientLabelFormatSuite.scala
+++ /dev/null
@@ -1,78 +0,0 @@
-package xyz.driver.pdsuidomain.formats.json
-
-import java.time.LocalDate
-
-import spray.json._
-import org.scalatest.{FlatSpec, Matchers}
-import xyz.driver.entities.labels.LabelValue
-import xyz.driver.pdsuicommon.domain.{LongId, UuidId}
-import xyz.driver.pdsuidomain.entities._
-
-class PatientLabelFormatSuite extends FlatSpec with Matchers {
-
- "Json format for RichPatientLabel" should "read and write correct JSON" in {
- import xyz.driver.pdsuidomain.formats.json.patientlabel._
- val orig = PatientLabel(
- id = LongId(1),
- patientId = UuidId("748b5884-3528-4cb9-904b-7a8151d6e343"),
- labelId = LongId(20),
- primaryValue = LabelValue.Yes,
- verifiedPrimaryValue = LabelValue.Unknown,
- isVisible = true,
- score = 1,
- isImplicitMatch = false
- )
- val writtenJson = richPatientLabelFormat.write(RichPatientLabel(orig, isVerified = true))
-
- writtenJson should be(
- """{"id":1,"labelId":20,"primaryValue":"Yes","isVisible":true,"isVerified":true,"verifiedPrimaryValue":"Unknown",
- "score":1,"isImplicitMatch":false, "patientId":"748b5884-3528-4cb9-904b-7a8151d6e343"}""".parseJson)
-
- val updatePatientLabelJson = """{"verifiedPrimaryValue":"No"}""".parseJson
- val expectedUpdatedPatientLabel = orig.copy(verifiedPrimaryValue = LabelValue.No)
- val parsedUpdatePatientLabel = applyUpdateToPatientLabel(updatePatientLabelJson, orig)
- parsedUpdatePatientLabel should be(expectedUpdatedPatientLabel)
- }
-
- "Json format for PatientLabelEvidence" should "read and write correct JSON" in {
- import xyz.driver.pdsuidomain.formats.json.patientlabel._
- val orig = PatientLabelEvidenceView(
- id = LongId(1),
- value = LabelValue.Maybe,
- evidenceText = "evidence text",
- documentId = Some(LongId(21)),
- evidenceId = Some(LongId(10)),
- reportId = None,
- documentType = DocumentType.LaboratoryReport,
- date = Some(LocalDate.parse("2017-08-10")),
- providerType = ProviderType.EmergencyMedicine,
- patientId = UuidId("748b5884-3528-4cb9-904b-7a8151d6e343"),
- labelId = LongId(20),
- isImplicitMatch = false
- )
- val writtenJson = patientLabelEvidenceWriter.write(orig)
-
- writtenJson should be(
- """{"id":1,"value":"Maybe","evidenceText":"evidence text","documentId":21,"evidenceId":10,"reportId":null,
- "documentType":{"id":3,"name":"Laboratory Report"},"date":"2017-08-10",
- "providerType":{"id":26,"name":"Emergency Medicine"}}""".parseJson)
- }
-
- "Json format for PatientLabelDefiningCriteria" should "read and write correct JSON" in {
- import xyz.driver.pdsuidomain.formats.json.patientdefiningcriteria._
- val orig = PatientLabel(
- id = LongId(1),
- patientId = UuidId("748b5884-3528-4cb9-904b-7a8151d6e343"),
- labelId = LongId(20),
- primaryValue = LabelValue.Yes,
- verifiedPrimaryValue = LabelValue.Yes,
- isVisible = true,
- score = 1,
- isImplicitMatch = false
- )
- val writtenJson = patientLabelDefiningCriteriaWriter.write(orig)
-
- writtenJson should be("""{"id":1,"value":"Yes"}""".parseJson)
- }
-
-}
diff --git a/src/test/scala/xyz/driver/pdsuidomain/formats/json/SlotArmFormatSuite.scala b/src/test/scala/xyz/driver/pdsuidomain/formats/json/SlotArmFormatSuite.scala
deleted file mode 100644
index 95853f6..0000000
--- a/src/test/scala/xyz/driver/pdsuidomain/formats/json/SlotArmFormatSuite.scala
+++ /dev/null
@@ -1,36 +0,0 @@
-package xyz.driver.pdsuidomain.formats.json
-
-import spray.json._
-import org.scalatest.{FlatSpec, Matchers}
-import xyz.driver.pdsuicommon.domain.{LongId, StringId}
-import xyz.driver.pdsuidomain.entities.SlotArm
-
-class SlotArmFormatSuite extends FlatSpec with Matchers {
- import xyz.driver.pdsuidomain.formats.json.slotarm._
-
- "Json format for SlotArm" should "read and write correct JSON" in {
- val arm = SlotArm(
- id = LongId(10),
- trialId = StringId("NCT000001"),
- name = "arm name",
- originalName = "orig arm name"
- )
- val writtenJson = slotArmFormat.write(arm)
-
- writtenJson should be(
- """{"id":10,"trialId":"NCT000001","name":"arm name","originalName":"orig arm name"}""".parseJson)
-
- val createArmJson = """{"trialId":"NCT000001","name":"arm name"}""".parseJson
- val parsedArm = slotArmFormat.read(createArmJson)
- val expectedCreatedArm = arm.copy(
- id = LongId(0),
- originalName = "arm name"
- )
- parsedArm should be(expectedCreatedArm)
-
- val updateArmJson = """{"name":"new arm name"}""".parseJson
- val expectedUpdatedArm = arm.copy(name = "new arm name")
- val parsedUpdateArm = applyUpdateToArm(updateArmJson, arm)
- parsedUpdateArm should be(expectedUpdatedArm)
- }
-}
diff --git a/src/test/scala/xyz/driver/pdsuidomain/formats/json/StudyDesignFormatSuite.scala b/src/test/scala/xyz/driver/pdsuidomain/formats/json/StudyDesignFormatSuite.scala
deleted file mode 100644
index f3a4c83..0000000
--- a/src/test/scala/xyz/driver/pdsuidomain/formats/json/StudyDesignFormatSuite.scala
+++ /dev/null
@@ -1,20 +0,0 @@
-package xyz.driver.pdsuidomain.formats.json
-
-import spray.json._
-import org.scalatest.{FlatSpec, Matchers}
-import xyz.driver.pdsuidomain.entities.StudyDesign
-
-class StudyDesignFormatSuite extends FlatSpec with Matchers {
- import xyz.driver.pdsuidomain.formats.json.studydesign._
-
- "Json format for StudyDesign" should "read and write correct JSON" in {
- val studyDesign = StudyDesign.Randomized
- val writtenJson = studyDesignFormat.write(studyDesign)
-
- writtenJson should be("""{"id":1,"name":"Randomized"}""".parseJson)
-
- val parsedStudyDesign = studyDesignFormat.read(writtenJson)
- parsedStudyDesign should be(studyDesign)
- }
-
-}
diff --git a/src/test/scala/xyz/driver/pdsuidomain/formats/json/TrialFormatSuite.scala b/src/test/scala/xyz/driver/pdsuidomain/formats/json/TrialFormatSuite.scala
deleted file mode 100644
index b832733..0000000
--- a/src/test/scala/xyz/driver/pdsuidomain/formats/json/TrialFormatSuite.scala
+++ /dev/null
@@ -1,49 +0,0 @@
-package xyz.driver.pdsuidomain.formats.json
-
-import java.time.LocalDateTime
-
-import org.scalatest.{FlatSpec, Matchers}
-import spray.json._
-import xyz.driver.pdsuicommon.domain.{LongId, StringId, UuidId}
-import xyz.driver.pdsuidomain.entities.Trial
-
-class TrialFormatSuite extends FlatSpec with Matchers {
- import xyz.driver.pdsuidomain.formats.json.trial._
-
- "Json format for Trial" should "read and write correct JSON" in {
- val orig = Trial(
- id = StringId("NCT000001"),
- externalId = UuidId("40892a07-c638-49d2-9795-1edfefbbcc7c"),
- status = Trial.Status.New,
- assignee = None,
- previousStatus = None,
- previousAssignee = None,
- lastActiveUserId = None,
- lastUpdate = LocalDateTime.parse("2017-08-10T18:16:19"),
- phase = "",
- hypothesisId = Some(UuidId("3b80b2e2-5372-4cf5-a342-6e4ebe10fafd")),
- studyDesignId = Some(LongId(321)),
- originalStudyDesign = None,
- isPartner = false,
- overview = None,
- overviewTemplate = "",
- isUpdated = false,
- title = "trial title",
- originalTitle = "orig trial title"
- )
- val writtenJson = trialFormat.write(orig)
-
- writtenJson should be(
- """{"isPartner":false,"assignee":null,"lastUpdate":"2017-08-10T18:16:19Z","previousStatus":null,
- "isUpdated":false,"overviewTemplate":"","phase":"","originalStudyDesignId":null,
- "hypothesisId":"3b80b2e2-5372-4cf5-a342-6e4ebe10fafd","originalTitle":"orig trial title",
- "studyDesignId":321,"lastActiveUser":null,"externalid":"40892a07-c638-49d2-9795-1edfefbbcc7c",
- "id":"NCT000001","status":"New","overview":null,"previousAssignee":null,"title":"trial title"}""".parseJson)
-
- val updateTrialJson = """{"hypothesisId":null,"overview":"new overview"}""".parseJson
- val expectedUpdatedTrial = orig.copy(hypothesisId = None, overview = Some("new overview"))
- val parsedUpdateTrial = applyUpdateToTrial(updateTrialJson, orig)
- parsedUpdateTrial should be(expectedUpdatedTrial)
- }
-
-}
diff --git a/src/test/scala/xyz/driver/pdsuidomain/formats/json/TrialHistoryFormatSuite.scala b/src/test/scala/xyz/driver/pdsuidomain/formats/json/TrialHistoryFormatSuite.scala
deleted file mode 100644
index 7f4f169..0000000
--- a/src/test/scala/xyz/driver/pdsuidomain/formats/json/TrialHistoryFormatSuite.scala
+++ /dev/null
@@ -1,32 +0,0 @@
-package xyz.driver.pdsuidomain.formats.json
-
-import java.time.LocalDateTime
-
-import spray.json._
-import org.scalatest.{FlatSpec, Matchers}
-import xyz.driver.pdsuicommon.domain.{LongId, StringId}
-import xyz.driver.pdsuidomain.entities.TrialHistory
-
-class TrialHistoryFormatSuite extends FlatSpec with Matchers {
- import xyz.driver.pdsuidomain.formats.json.trialhistory._
-
- "Json format for TrialHistory" should "read and write correct JSON" in {
- val trialHistory = TrialHistory(
- id = LongId(10),
- trialId = StringId("NCT000001"),
- executor = xyz.driver.core.Id("userId-001"),
- state = TrialHistory.State.Summarize,
- action = TrialHistory.Action.Start,
- created = LocalDateTime.parse("2017-08-10T18:00:00"),
- comment = Option("Yolo!")
- )
- val writtenJson = trialHistoryFormat.write(trialHistory)
-
- writtenJson should be("""{"id":10,"executor":"userId-001","trialId":"NCT000001","state":"Summarize",
- "action":"Start","created":"2017-08-10T18:00Z", "comment": "Yolo!"}""".parseJson)
-
- val parsedTrialHistory = trialHistoryFormat.read(writtenJson)
- parsedTrialHistory should be(trialHistory)
- }
-
-}
diff --git a/src/test/scala/xyz/driver/pdsuidomain/formats/json/TrialIssueFormatSuite.scala b/src/test/scala/xyz/driver/pdsuidomain/formats/json/TrialIssueFormatSuite.scala
deleted file mode 100644
index a13e097..0000000
--- a/src/test/scala/xyz/driver/pdsuidomain/formats/json/TrialIssueFormatSuite.scala
+++ /dev/null
@@ -1,50 +0,0 @@
-package xyz.driver.pdsuidomain.formats.json
-
-import java.time.LocalDateTime
-
-import spray.json._
-import org.scalatest.{FlatSpec, Matchers}
-import xyz.driver.pdsuicommon.domain.{LongId, StringId}
-import xyz.driver.pdsuidomain.entities.TrialIssue
-
-class TrialIssueFormatSuite extends FlatSpec with Matchers {
- import xyz.driver.pdsuidomain.formats.json.trialissue._
-
- "Json format for TrialIssue" should "read and write correct JSON" in {
- val trialIssue = TrialIssue(
- id = LongId(10),
- trialId = StringId("NCT000001"),
- userId = xyz.driver.core.Id("userId-001"),
- lastUpdate = LocalDateTime.parse("2017-08-10T18:00:00"),
- isDraft = false,
- text = "message text",
- evidence = "evidence",
- archiveRequired = false,
- meta = "{}"
- )
- val writtenJson = trialIssueWriter.write(trialIssue)
-
- writtenJson should be("""{"id":10,"userId":"userId-001","lastUpdate":"2017-08-10T18:00Z","isDraft":false,
- "text":"message text","evidence":"evidence","archiveRequired":false,"meta":"{}"}""".parseJson)
- trialIssueReader(StringId("NCT000001")).read(writtenJson) shouldBe trialIssue
-
- val createTrialIssueJson = """{"text":"message text","evidence":"evidence","meta":"{}"}""".parseJson
- val expectedCreatedTrialIssue = trialIssue.copy(id = LongId(0), lastUpdate = LocalDateTime.MIN, isDraft = true)
- val parsedCreateTrialIssue =
- jsValueToTrialIssue(createTrialIssueJson, StringId("NCT000001"), xyz.driver.core.Id("userId-001"))
- parsedCreateTrialIssue should be(expectedCreatedTrialIssue)
-
- val updateTrialIssueJson =
- """{"text":"new issue text","evidence":"issue evidence","archiveRequired":true,
- "meta":"{\"startPage\":1.0,\"endPage\":2.0}"}""".parseJson
- val expectedUpdatedTrialIssue = trialIssue.copy(
- text = "new issue text",
- evidence = "issue evidence",
- archiveRequired = true,
- meta = """{"startPage":1.0,"endPage":2.0}"""
- )
- val parsedUpdateTrialIssue = applyUpdateToTrialIssue(updateTrialIssueJson, trialIssue)
- parsedUpdateTrialIssue should be(expectedUpdatedTrialIssue)
- }
-
-}
diff --git a/src/test/scala/xyz/driver/pdsuicommon/db/SearchFilterExprSuite.scala b/src/test/scala/xyz/driver/restquery/db/SearchFilterExprSuite.scala
index 35c8d30..35c8d30 100644
--- a/src/test/scala/xyz/driver/pdsuicommon/db/SearchFilterExprSuite.scala
+++ b/src/test/scala/xyz/driver/restquery/db/SearchFilterExprSuite.scala
diff --git a/src/test/scala/xyz/driver/pdsuicommon/parsers/PaginationParserSuite.scala b/src/test/scala/xyz/driver/restquery/rest/parsers/PaginationParserSuite.scala
index 609c8c8..c753480 100644
--- a/src/test/scala/xyz/driver/pdsuicommon/parsers/PaginationParserSuite.scala
+++ b/src/test/scala/xyz/driver/restquery/rest/parsers/PaginationParserSuite.scala
@@ -1,8 +1,8 @@
-package xyz.driver.pdsuicommon.parsers
+package xyz.driver.restquery.http.parsers
-import xyz.driver.pdsuicommon.db.Pagination
-import xyz.driver.pdsuicommon.parsers.TestUtils._
+import xyz.driver.restquery.http.parsers.TestUtils._
import org.scalatest.{FreeSpecLike, MustMatchers}
+import xyz.driver.restquery.domain.Pagination
import scala.util.{Failure, Try}
diff --git a/src/test/scala/xyz/driver/pdsuicommon/parsers/SearchFilterParserSuite.scala b/src/test/scala/xyz/driver/restquery/rest/parsers/SearchFilterParserSuite.scala
index 0209222..efa8666 100644
--- a/src/test/scala/xyz/driver/pdsuicommon/parsers/SearchFilterParserSuite.scala
+++ b/src/test/scala/xyz/driver/restquery/rest/parsers/SearchFilterParserSuite.scala
@@ -1,20 +1,19 @@
-package xyz.driver.pdsuicommon.parsers
+package xyz.driver.restquery.http.parsers
import java.util.UUID
-import xyz.driver.pdsuicommon.db.SearchFilterExpr.Dimension
-import xyz.driver.pdsuicommon.db.{SearchFilterBinaryOperation, SearchFilterExpr, SearchFilterNAryOperation}
-import xyz.driver.pdsuicommon.utils.Implicits.toStringOps
-import xyz.driver.pdsuicommon.parsers.TestUtils._
import fastparse.core.Parsed
import org.scalacheck.Arbitrary.arbitrary
import org.scalacheck.{Gen, Prop}
import org.scalatest.FreeSpecLike
import org.scalatest.prop.Checkers
-import xyz.driver.pdsuicommon.db.SearchFilterBinaryOperation.Eq
-import xyz.driver.pdsuicommon.db.SearchFilterNAryOperation.In
-import xyz.driver.pdsuicommon.utils.Utils
-import xyz.driver.pdsuicommon.utils.Utils._
+import xyz.driver.restquery.domain.SearchFilterBinaryOperation.Eq
+import xyz.driver.restquery.domain.SearchFilterExpr.Dimension
+import xyz.driver.restquery.domain.SearchFilterNAryOperation.In
+import xyz.driver.restquery.domain.{SearchFilterExpr, SearchFilterNAryOperation}
+import xyz.driver.restquery.http.parsers.TestUtils._
+import xyz.driver.restquery.utils.Utils
+import xyz.driver.restquery.utils.Utils._
import scala.util._
@@ -30,7 +29,7 @@ class SearchFilterParserSuite extends FreeSpecLike with Checkers {
"parse" - {
"should convert column names to snake case" in {
- import SearchFilterBinaryOperation._
+ import xyz.driver.restquery.domain.SearchFilterBinaryOperation._
val filter = SearchFilterParser.parse(
Seq(
@@ -78,7 +77,7 @@ class SearchFilterParserSuite extends FreeSpecLike with Checkers {
"binary" - {
"common operators" - {
"should be parsed with text values" in check {
- import SearchFilterBinaryOperation._
+ import xyz.driver.restquery.domain.SearchFilterBinaryOperation._
val testQueryGen = queryGen(
dimensionGen = Gen.identifier,
@@ -227,12 +226,12 @@ class SearchFilterParserSuite extends FreeSpecLike with Checkers {
private val inValueCharsGen: Gen[Char] = arbitrary[Char].filter(_ != ',')
private val nonEmptyString = arbitrary[String].filter { s =>
- !s.safeTrim.isEmpty
+ !Utils.safeTrim(s).isEmpty
}
private val numericBinaryAtomValuesGen: Gen[String] = arbitrary[Long].map(_.toString)
private val inValueGen: Gen[String] = {
- Gen.nonEmptyContainerOf[Seq, Char](inValueCharsGen).map(_.mkString).filter(_.safeTrim.nonEmpty)
+ Gen.nonEmptyContainerOf[Seq, Char](inValueCharsGen).map(_.mkString).filter(s => Utils.safeTrim(s).nonEmpty)
}
private val inValuesGen: Gen[String] = Gen.choose(1, 5).flatMap { size =>
Gen.containerOfN[Seq, String](size, inValueGen).map(_.mkString(","))
diff --git a/src/test/scala/xyz/driver/pdsuicommon/parsers/SortingParserSuite.scala b/src/test/scala/xyz/driver/restquery/rest/parsers/SortingParserSuite.scala
index f34f8e1..1813181 100644
--- a/src/test/scala/xyz/driver/pdsuicommon/parsers/SortingParserSuite.scala
+++ b/src/test/scala/xyz/driver/restquery/rest/parsers/SortingParserSuite.scala
@@ -1,6 +1,6 @@
-package xyz.driver.pdsuicommon.parsers
+package xyz.driver.restquery.http.parsers
-import xyz.driver.pdsuicommon.parsers.TestUtils._
+import xyz.driver.restquery.http.parsers.TestUtils._
import org.scalacheck.Arbitrary.arbitrary
import org.scalacheck.{Gen, Prop}
import org.scalatest.prop.Checkers
diff --git a/src/test/scala/xyz/driver/pdsuicommon/parsers/TestUtils.scala b/src/test/scala/xyz/driver/restquery/rest/parsers/TestUtils.scala
index 8ab2131..9ea75b6 100644
--- a/src/test/scala/xyz/driver/pdsuicommon/parsers/TestUtils.scala
+++ b/src/test/scala/xyz/driver/restquery/rest/parsers/TestUtils.scala
@@ -1,9 +1,10 @@
-package xyz.driver.pdsuicommon.parsers
+package xyz.driver.restquery.http.parsers
-import org.scalacheck.Prop
+import
+org.scalacheck.Prop
import org.scalacheck.Prop.BooleanOperators
import org.scalatest.matchers.{MatchResult, Matcher}
-import xyz.driver.pdsuicommon.utils.Utils
+import xyz.driver.restquery.utils.Utils
import scala.reflect.ClassTag
import scala.util.{Failure, Success, Try}
diff --git a/src/test/scala/xyz/driver/pdsuicommon/utils/StringOpsSuite.scala b/src/test/scala/xyz/driver/restquery/utils/StringOpsSuite.scala
index bd0bd2b..bd0bd2b 100644
--- a/src/test/scala/xyz/driver/pdsuicommon/utils/StringOpsSuite.scala
+++ b/src/test/scala/xyz/driver/restquery/utils/StringOpsSuite.scala