From bcfec7f8657db979f8b13a6ba12934a97ef4b37b Mon Sep 17 00:00:00 2001
From: Krzysztof Witukiewicz <krzysztof.witukiewicz@mgm-tp.com>
Date: Fri, 17 Jan 2025 11:16:00 +0100
Subject: [PATCH] OZG-6706 OZG-7500 Map Bescheid in
 BescheidMapper.toGetBescheidResponse()

---
 .../document/bescheid/BescheidMapper.java        |  3 +--
 .../document/bescheid/BescheidMapperTest.java    | 16 ++++++++++++++--
 2 files changed, 15 insertions(+), 4 deletions(-)

diff --git a/document-manager-server/src/main/java/de/ozgcloud/document/bescheid/BescheidMapper.java b/document-manager-server/src/main/java/de/ozgcloud/document/bescheid/BescheidMapper.java
index a7b493c..75be292 100644
--- a/document-manager-server/src/main/java/de/ozgcloud/document/bescheid/BescheidMapper.java
+++ b/document-manager-server/src/main/java/de/ozgcloud/document/bescheid/BescheidMapper.java
@@ -47,7 +47,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import de.ozgcloud.command.Command;
 import de.ozgcloud.common.binaryfile.FileId;
 import de.ozgcloud.common.datatype.StringBasedValue;
-import de.ozgcloud.document.bescheid.Bescheid.SendBy;
+import de.ozgcloud.document.bescheid.Bescheid.*;
 import de.ozgcloud.document.bescheid.vorgang.VorgangId;
 import de.ozgcloud.document.common.attached_item.AttachedItem;
 import de.ozgcloud.document.common.attached_item.AttachedItemService;
@@ -111,7 +111,6 @@ public abstract class BescheidMapper {
 
 	@Mapping(target = "defaultInstanceForType", ignore = true)
 	@Mapping(target = "bescheidOrBuilder", ignore = true)
-	@Mapping(target = "bescheid", ignore = true)
 	@Mapping(target = "mergeFrom", ignore = true)
 	@Mapping(target = "clearField", ignore = true)
 	@Mapping(target = "clearOneof", ignore = true)
diff --git a/document-manager-server/src/test/java/de/ozgcloud/document/bescheid/BescheidMapperTest.java b/document-manager-server/src/test/java/de/ozgcloud/document/bescheid/BescheidMapperTest.java
index 8bcac82..5f2e572 100644
--- a/document-manager-server/src/test/java/de/ozgcloud/document/bescheid/BescheidMapperTest.java
+++ b/document-manager-server/src/test/java/de/ozgcloud/document/bescheid/BescheidMapperTest.java
@@ -40,11 +40,11 @@ import org.mapstruct.factory.Mappers;
 import org.mockito.InjectMocks;
 import org.mockito.Spy;
 
-import de.ozgcloud.document.bescheid.vorgang.VorgangTestFactory;
 import de.ozgcloud.command.CommandTestFactory;
+import de.ozgcloud.document.DocumentTestFactory;
+import de.ozgcloud.document.bescheid.vorgang.VorgangTestFactory;
 import de.ozgcloud.document.common.attached_item.AttachedItemService;
 import de.ozgcloud.document.common.attached_item.AttachedItemTestFactory;
-import de.ozgcloud.document.DocumentTestFactory;
 
 class BescheidMapperTest {
 
@@ -135,6 +135,18 @@ class BescheidMapperTest {
 		}
 	}
 
+	@DisplayName("To get bescheid response")
+	@Nested
+	class TestToGetBescheidResponse {
+
+		@Test
+		void shouldMap() {
+			var response = mapper.toGetBescheidResponse(BescheidTestFactory.create());
+
+			assertThat(response).usingRecursiveComparison().isEqualTo(GrpcGetBescheidResponseTestFactory.create());
+		}
+	}
+
 	@DisplayName("To get bescheid draft response")
 	@Nested
 	class TestToGetBescheidDraftResponse {
-- 
GitLab