From deba20326e3269fee3ef51f8e6841f17453b4155 Mon Sep 17 00:00:00 2001 From: vlad Date: Thu, 28 Sep 2017 13:12:32 -0700 Subject: Simplified Export entities for EVLS --- .../json/sprayformats/ExportFormatSuite.scala | 26 +++++++++++----------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'src/test/scala') diff --git a/src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/ExportFormatSuite.scala b/src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/ExportFormatSuite.scala index d0d4d1a..52c8c81 100644 --- a/src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/ExportFormatSuite.scala +++ b/src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/ExportFormatSuite.scala @@ -6,7 +6,7 @@ import java.util.UUID import spray.json._ import org.scalatest.{FlatSpec, Matchers} import xyz.driver.pdsuicommon.domain.{FuzzyValue, LongId, StringId, UuidId} -import xyz.driver.pdsuidomain.entities.RecordRequestId +import xyz.driver.pdsuidomain.entities.{DocumentType, ProviderType, RecordRequestId} class ExportFormatSuite extends FlatSpec with Matchers { import export._ @@ -16,10 +16,11 @@ class ExportFormatSuite extends FlatSpec with Matchers { val document = ExportPatientLabelEvidenceDocument( documentId = LongId(101), requestId = RecordRequestId(UUID.fromString("7b54a75d-4197-4b27-9045-b9b6cb131be9")), - documentType = "document type", - providerType = "provider type", + documentType = DocumentType(LongId[DocumentType](1), "document type"), + providerType = ProviderType(LongId[ProviderType](2), "provider type"), date = LocalDate.parse("2017-08-10") ) + val labels = List( ExportPatientLabel( id = LongId(1), @@ -62,18 +63,18 @@ class ExportFormatSuite extends FlatSpec with Matchers { labels = labels ) - val writtenJson = patientWithLabelsWriter.write(patientWithLabels) + 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":"document type","providerType":"provider type","date":"2017-08-10"}},{"evidenceId":12,"labelValue":"No", - "evidenceText":"evidence text 12","document":{"documentId":101,"requestId":"7b54a75d-4197-4b27-9045-b9b6cb131be9", - "documentType":"document type","providerType":"provider type","date":"2017-08-10"}}]}, + "documentType":{"id":1,"name":"document type"},"providerType":{"id":2,"name":"provider type"},"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":"document type"},"providerType":{"id":2,"name":"provider type"},"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":"document type", - "providerType":"provider type","date":"2017-08-10"}},{"evidenceId":13,"labelValue":"Yes","evidenceText":"evidence text 13", - "document":{"documentId":101,"requestId":"7b54a75d-4197-4b27-9045-b9b6cb131be9","documentType":"document type", - "providerType":"provider type","date":"2017-08-10"}}]}]}""".parseJson) + {"documentId":101,"requestId":"7b54a75d-4197-4b27-9045-b9b6cb131be9","documentType":{"id":1,"name":"document type"}, + "providerType":{"id":2,"name":"provider type"},"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":"document type"}, + "providerType":{"id":2,"name":"provider type"},"date":"2017-08-10"}}]}]}""".parseJson) } "Json format for ApiExportTrialWithLabels" should "read and write correct JSON" in { @@ -112,7 +113,7 @@ class ExportFormatSuite extends FlatSpec with Matchers { criteria = criteriaList ) - val writtenJson = trialWithLabelsWriter.write(trialWithLabels) + val writtenJson = trialWithLabelsFormat.write(trialWithLabels) writtenJson should be( """{"nctId":"NCT000001","trialId":"40892a07-c638-49d2-9795-1edfefbbcc7c","disease":"Breast","lastReviewed":"2017-08-10T18:00Z", "labelVersion":1,"arms":[{"armId":1,"armName":"arm 1"},{"armId":2,"armName":"arm 2"}],"criteria":[ @@ -120,5 +121,4 @@ class ExportFormatSuite extends FlatSpec with Matchers { {"value":"Unknown","labelId":21,"criterionId":11,"criterionText":"criteria 11 text","armIds":[2],"isCompound":true,"isDefining":false}]}""".parseJson) } - } -- cgit v1.2.3