Skip to content
Snippets Groups Projects
Commit 9cdc09fe authored by OZGCloud's avatar OZGCloud
Browse files

OZG-5899 fix bescheid mapping

parent 256e8141
No related branches found
No related tags found
No related merge requests found
...@@ -66,9 +66,9 @@ public interface BescheidMapper { ...@@ -66,9 +66,9 @@ public interface BescheidMapper {
default Bescheid mapFromAttachedItem(AttachedItem item) { default Bescheid mapFromAttachedItem(AttachedItem item) {
var itemMap = item.getItem(); var itemMap = item.getItem();
var builder = Bescheid.builder() var builder = Bescheid.builder()
.id(BescheidId.from(MapUtils.getString(itemMap, AttachedItem.PROPERTY_ID))) .id(BescheidId.from(item.getId()))
.version(MapUtils.getLongValue(itemMap, AttachedItem.PROPERTY_VERSION)) .version(item.getVersion())
.vorgangId(VorgangId.from(MapUtils.getString(itemMap, Bescheid.FIELD_VORGANG_ID))) .vorgangId(VorgangId.from(item.getVorgangId()))
.createdBy(UserId.from(MapUtils.getString(itemMap, Bescheid.FIELD_CREATED_BY))) .createdBy(UserId.from(MapUtils.getString(itemMap, Bescheid.FIELD_CREATED_BY)))
.bewilligt(MapUtils.getBoolean(itemMap, Bescheid.FIELD_BEWILLIGT)) .bewilligt(MapUtils.getBoolean(itemMap, Bescheid.FIELD_BEWILLIGT))
.nachrichtText(Optional.ofNullable(MapUtils.getString(itemMap, Bescheid.FIELD_NACHRICHT_TEXT))) .nachrichtText(Optional.ofNullable(MapUtils.getString(itemMap, Bescheid.FIELD_NACHRICHT_TEXT)))
......
...@@ -15,6 +15,7 @@ import org.mapstruct.factory.Mappers; ...@@ -15,6 +15,7 @@ import org.mapstruct.factory.Mappers;
import org.mockito.InjectMocks; import org.mockito.InjectMocks;
import org.mockito.Spy; import org.mockito.Spy;
import de.ozgcloud.bescheid.vorgang.VorgangTestFactory;
import de.ozgcloud.common.attached_item.AttachedItemTestFactory; import de.ozgcloud.common.attached_item.AttachedItemTestFactory;
class BescheidMapperTest { class BescheidMapperTest {
...@@ -66,7 +67,9 @@ class BescheidMapperTest { ...@@ -66,7 +67,9 @@ class BescheidMapperTest {
@Test @Test
void shouldMapItem() { void shouldMapItem() {
var bescheid = mapper.mapFromAttachedItem(AttachedItemTestFactory.createBescheidWithoutDocument()); var bescheidWithoutDocument = AttachedItemTestFactory.createBescheidWithoutDocumentBuilder().vorgangId(VorgangTestFactory.ID_STR).build();
var bescheid = mapper.mapFromAttachedItem(bescheidWithoutDocument);
assertThat(bescheid).usingRecursiveComparison().isEqualTo(BescheidTestFactory.create()); assertThat(bescheid).usingRecursiveComparison().isEqualTo(BescheidTestFactory.create());
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment