diff --git a/conf/messages b/conf/messages
index 27cb633bb..428e71473 100644
--- a/conf/messages
+++ b/conf/messages
@@ -48,3 +48,5 @@ draftMetadata.validation.details.SCHEMA_REQUIRED=There was at least one missing
draftMetadata.validation.action.SCHEMA_REQUIRED=Add the following column headers to your metadata file and re-load.
draftMetadata.validation.details.DUPLICATE_HEADER=There was at least one duplicate column in your metadata file.
draftMetadata.validation.action.DUPLICATE_HEADER=Ensure there is only one of the following duplicated columns.
+draftMetadata.validation.details.UNKNOWN=An unknown error was identified.
+draftMetadata.validation.action.UNKNOWN=Please contact your Digital Transfer Advisor on tdr@nationalarchives.gov.uk quoting the Consignment Reference.
diff --git a/test/controllers/DraftMetadataChecksResultsControllerSpec.scala b/test/controllers/DraftMetadataChecksResultsControllerSpec.scala
index 0b6aa6f04..6d885a9e5 100644
--- a/test/controllers/DraftMetadataChecksResultsControllerSpec.scala
+++ b/test/controllers/DraftMetadataChecksResultsControllerSpec.scala
@@ -181,8 +181,8 @@ class DraftMetadataChecksResultsControllerSpec extends FrontEndTestHelper {
(
FailedValue.value,
FileError.UNKNOWN,
- "Require details message for draftMetadata.validation.details.",
- "Require action message for draftMetadata.validation.action.",
+ "An unknown error was identified.",
+ "Please contact your Digital Transfer Advisor on tdr@nationalarchives.gov.uk quoting the Consignment Reference.",
Set[String]()
),
(
@@ -239,61 +239,61 @@ class DraftMetadataChecksResultsControllerSpec extends FrontEndTestHelper {
}
}
}
+ }
- "downloadErrorReport" should {
- "download the excel file with error data" in {
-
- setConsignmentTypeResponse(wiremockServer, "standard")
- setConsignmentReferenceResponse(wiremockServer)
- val error = Error("BASE_SCHEMA", "FOI exemption code", "enum", "BASE_SCHEMA.foi_exmption_code.enum")
- val metadata = List(Metadata("FOI exemption code", "abcd"), Metadata("Filepath", "/aa/bb/faq"))
- val errorFileData = ErrorFileData(consignmentId, date = "2024-12-12", FileError.SCHEMA_VALIDATION, List(ValidationErrors("assetId", Set(error), metadata)))
- val response = instantiateController(errorFileData = Some(errorFileData))
- .downloadErrorReport(consignmentId)(FakeRequest(GET, s"/consignment/$consignmentId/draft-metadata/download-report"))
-
- val responseByteArray: ByteString = contentAsBytes(response)
- val bufferedSource = new ByteArrayInputStream(responseByteArray.toArray)
- val wb: ReadableWorkbook = new ReadableWorkbook(bufferedSource)
- val ws: Sheet = wb.getFirstSheet
- val rows: List[Row] = ws.read.asScala.toList
-
- rows.length must equal(2)
-
- rows.head.getCell(0).asString must equal("Filepath")
- rows.head.getCell(1).asString must equal("Field")
- rows.head.getCell(2).asString must equal("Value")
- rows.head.getCell(3).asString must equal("Error Message")
-
- rows(1).getCell(0).asString must equal("/aa/bb/faq")
- rows(1).getCell(1).asString must equal("FOI exemption code")
- rows(1).getCell(2).asString must equal("abcd")
- rows(1).getCell(3).asString must equal("BASE_SCHEMA.foi_exmption_code.enum")
- }
+ "downloadErrorReport" should {
+ "download the excel file with error data" in {
- "download the excel file without error data when the error type is not SCHEMA_VALIDATION" in {
+ setConsignmentTypeResponse(wiremockServer, "standard")
+ setConsignmentReferenceResponse(wiremockServer)
+ val error = Error("BASE_SCHEMA", "FOI exemption code", "enum", "BASE_SCHEMA.foi_exmption_code.enum")
+ val metadata = List(Metadata("FOI exemption code", "abcd"), Metadata("Filepath", "/aa/bb/faq"))
+ val errorFileData = ErrorFileData(consignmentId, date = "2024-12-12", FileError.SCHEMA_VALIDATION, List(ValidationErrors("assetId", Set(error), metadata)))
+ val response = instantiateController(errorFileData = Some(errorFileData))
+ .downloadErrorReport(consignmentId)(FakeRequest(GET, s"/consignment/$consignmentId/draft-metadata/download-report"))
+
+ val responseByteArray: ByteString = contentAsBytes(response)
+ val bufferedSource = new ByteArrayInputStream(responseByteArray.toArray)
+ val wb: ReadableWorkbook = new ReadableWorkbook(bufferedSource)
+ val ws: Sheet = wb.getFirstSheet
+ val rows: List[Row] = ws.read.asScala.toList
+
+ rows.length must equal(2)
+
+ rows.head.getCell(0).asString must equal("Filepath")
+ rows.head.getCell(1).asString must equal("Field")
+ rows.head.getCell(2).asString must equal("Value")
+ rows.head.getCell(3).asString must equal("Error Message")
+
+ rows(1).getCell(0).asString must equal("/aa/bb/faq")
+ rows(1).getCell(1).asString must equal("FOI exemption code")
+ rows(1).getCell(2).asString must equal("abcd")
+ rows(1).getCell(3).asString must equal("BASE_SCHEMA.foi_exmption_code.enum")
+ }
- setConsignmentTypeResponse(wiremockServer, "standard")
- setConsignmentReferenceResponse(wiremockServer)
- val error = Error("FILE_VALIDATION", "draftmetadata.csv", "INVALID_CSV", "")
- val errorFileData = ErrorFileData(consignmentId, date = "2024-12-12", FileError.INVALID_CSV, List(ValidationErrors("assetId", Set(error), Nil)))
+ "download the excel file without error data when the error type is not SCHEMA_VALIDATION" in {
- when(draftMetaDataService.getErrorReport(any[UUID])).thenReturn(Future.successful(errorFileData))
+ setConsignmentTypeResponse(wiremockServer, "standard")
+ setConsignmentReferenceResponse(wiremockServer)
+ val error = Error("FILE_VALIDATION", "draftmetadata.csv", "INVALID_CSV", "")
+ val errorFileData = ErrorFileData(consignmentId, date = "2024-12-12", FileError.INVALID_CSV, List(ValidationErrors("assetId", Set(error), Nil)))
- val response = instantiateController().downloadErrorReport(consignmentId)(FakeRequest(GET, s"/consignment/$consignmentId/draft-metadata/download-report"))
+ when(draftMetaDataService.getErrorReport(any[UUID])).thenReturn(Future.successful(errorFileData))
- val responseByteArray: ByteString = contentAsBytes(response)
- val bufferedSource = new ByteArrayInputStream(responseByteArray.toArray)
- val wb: ReadableWorkbook = new ReadableWorkbook(bufferedSource)
- val ws: Sheet = wb.getFirstSheet
- val rows: List[Row] = ws.read.asScala.toList
+ val response = instantiateController().downloadErrorReport(consignmentId)(FakeRequest(GET, s"/consignment/$consignmentId/draft-metadata/download-report"))
- rows.length must equal(1)
+ val responseByteArray: ByteString = contentAsBytes(response)
+ val bufferedSource = new ByteArrayInputStream(responseByteArray.toArray)
+ val wb: ReadableWorkbook = new ReadableWorkbook(bufferedSource)
+ val ws: Sheet = wb.getFirstSheet
+ val rows: List[Row] = ws.read.asScala.toList
- rows.head.getCell(0).asString must equal("Filepath")
- rows.head.getCell(1).asString must equal("Field")
- rows.head.getCell(2).asString must equal("Value")
- rows.head.getCell(3).asString must equal("Error Message")
- }
+ rows.length must equal(1)
+
+ rows.head.getCell(0).asString must equal("Filepath")
+ rows.head.getCell(1).asString must equal("Field")
+ rows.head.getCell(2).asString must equal("Value")
+ rows.head.getCell(3).asString must equal("Error Message")
}
}