From 97df47b04e0cba2fbb456f260b3a33c5150157ab Mon Sep 17 00:00:00 2001
From: "Zickermann, Jan" <jan.zickermann@dataport.de>
Date: Tue, 28 May 2024 17:29:56 +0200
Subject: [PATCH] OZG-5412 intelliform-adapter: Test group name

---
 .../intelliform/DepositDataMapperTest.java    | 20 +++++++++++++++----
 1 file changed, 16 insertions(+), 4 deletions(-)

diff --git a/intelliform-adapter/src/test/java/de/ozgcloud/eingang/intelliform/DepositDataMapperTest.java b/intelliform-adapter/src/test/java/de/ozgcloud/eingang/intelliform/DepositDataMapperTest.java
index c9fdccc9d..38a0efcc2 100644
--- a/intelliform-adapter/src/test/java/de/ozgcloud/eingang/intelliform/DepositDataMapperTest.java
+++ b/intelliform-adapter/src/test/java/de/ozgcloud/eingang/intelliform/DepositDataMapperTest.java
@@ -52,6 +52,7 @@ import org.xml.sax.SAXException;
 import de.ozgcloud.eingang.common.errorhandling.TechnicalException;
 import de.ozgcloud.eingang.common.formdata.FormData;
 import de.ozgcloud.eingang.common.formdata.IncomingFile;
+import de.ozgcloud.eingang.common.formdata.IncomingFileGroup;
 import lombok.SneakyThrows;
 
 class DepositDataMapperTest {
@@ -100,19 +101,30 @@ class DepositDataMapperTest {
 				var formData = doMapping();
 
 				var incomingFileIds = formData.getRepresentations().stream().map(IncomingFile::getVendorId).toList();
-				assertThat(incomingFileIds).contains(XML_ATTACHMENT_ID, PDF_ATTACHMENT_ID);
+				assertThat(incomingFileIds).containsExactly(XML_ATTACHMENT_ID, PDF_ATTACHMENT_ID);
 			}
 
-			@DisplayName("should return with attachments")
+			@DisplayName("should return with one attachment")
 			@Test
-			void shouldReturnWithAttachments() {
+			void shouldReturnWithOneAttachment() {
 				var formData = doMapping();
 
 				var incomingFileIds = formData.getAttachments().stream()
 						.flatMap(group -> group.getFiles().stream())
 						.map(IncomingFile::getVendorId)
 						.toList();
-				assertThat(incomingFileIds).contains(PNG_ATTACHMENT_ID);
+				assertThat(incomingFileIds).containsExactly(PNG_ATTACHMENT_ID);
+			}
+
+			@DisplayName("should return with attachment group name")
+			@Test
+			void shouldReturnWithAttachmentGroupName() {
+				var formData = doMapping();
+
+				var incomingFileIds = formData.getAttachments().stream()
+						.map(IncomingFileGroup::getName)
+						.toList();
+				assertThat(incomingFileIds).containsExactly("Upload1");
 			}
 
 			@DisplayName("should return with number of representations")
-- 
GitLab