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

OZG-5778 fix test issues after renaming / update

parent cae2ad97
No related branches found
No related tags found
No related merge requests found
...@@ -4,7 +4,7 @@ import java.time.ZonedDateTime; ...@@ -4,7 +4,7 @@ import java.time.ZonedDateTime;
public class FormMetaDataTestFactory { public class FormMetaDataTestFactory {
public static final String DESTINATION_ID_ENTRY_NAME = "destinationId"; public static final String XTA_IDENTIFIER_ENTRY_NAME = "xtaIdentifier";
public static final String XTA_IDENTIFIER = "vbe:010550120100"; public static final String XTA_IDENTIFIER = "vbe:010550120100";
public static final String OE_ID = "010550120100"; public static final String OE_ID = "010550120100";
...@@ -25,7 +25,7 @@ public class FormMetaDataTestFactory { ...@@ -25,7 +25,7 @@ public class FormMetaDataTestFactory {
@Override @Override
public String getEntry(String name) { public String getEntry(String name) {
switch (name) { switch (name) {
case DESTINATION_ID_ENTRY_NAME: case XTA_IDENTIFIER_ENTRY_NAME:
return XTA_IDENTIFIER; return XTA_IDENTIFIER;
} }
return null; return null;
......
package de.ozgcloud.eingang.fim; package de.ozgcloud.eingang.fim;
import java.util.List;
import java.util.Objects; import java.util.Objects;
import java.util.Optional; import java.util.Optional;
...@@ -21,13 +22,13 @@ class ZustaendigeStelleMapper implements FimEngineBasedMapper { ...@@ -21,13 +22,13 @@ class ZustaendigeStelleMapper implements FimEngineBasedMapper {
return formData.getControl().getMetaData() return formData.getControl().getMetaData()
.map(metaData -> metaData.getEntry(XTA_IDENTIFIER_ENTRY_NAME)) .map(metaData -> metaData.getEntry(XTA_IDENTIFIER_ENTRY_NAME))
.filter(Objects::nonNull) .filter(Objects::nonNull)
.map(oeId -> setOrganisationsEinheitId(formData.getZustaendigeStelle(), oeId)) .map(oeId -> setOrganisationsEinheitId(formData.getZustaendigeStelles(), oeId))
.map(zustStelle -> formData.toBuilder().zustaendigeStelle(zustStelle).build()) .map(zustStelle -> formData.toBuilder().zustaendigeStelle(zustStelle).build())
.orElse(formData); .orElse(formData);
} }
private ZustaendigeStelle setOrganisationsEinheitId(ZustaendigeStelle stelle, @NonNull String oeid) { private ZustaendigeStelle setOrganisationsEinheitId(List<ZustaendigeStelle> stelles, @NonNull String oeid) {
var builder = Objects.isNull(stelle) ? ZustaendigeStelle.builder() : stelle.toBuilder(); var builder = stelles.isEmpty() ? ZustaendigeStelle.builder() : stelles.getFirst().toBuilder();
extractOrganisationsEinheitId(oeid).ifPresent(builder::organisationseinheitenId); extractOrganisationsEinheitId(oeid).ifPresent(builder::organisationseinheitenId);
return builder.build(); return builder.build();
......
...@@ -7,6 +7,7 @@ import org.mockito.InjectMocks; ...@@ -7,6 +7,7 @@ import org.mockito.InjectMocks;
import de.ozgcloud.eingang.common.formdata.FormDataTestFactory; import de.ozgcloud.eingang.common.formdata.FormDataTestFactory;
import de.ozgcloud.eingang.common.formdata.FormMetaDataTestFactory; import de.ozgcloud.eingang.common.formdata.FormMetaDataTestFactory;
import de.ozgcloud.eingang.common.formdata.ZustaendigeStelle;
class ZustaendigeStelleMapperTest { class ZustaendigeStelleMapperTest {
...@@ -15,16 +16,22 @@ class ZustaendigeStelleMapperTest { ...@@ -15,16 +16,22 @@ class ZustaendigeStelleMapperTest {
@Test @Test
void shouldSetOrganisationsEinheitId() { void shouldSetOrganisationsEinheitId() {
var parsed = mapper.parseFormData(FormDataTestFactory.create()); var parsed = mapper.parseFormData(FormDataTestFactory.createBuilder().clearZustaendigeStelles().build());
assertThat(parsed.getZustaendigeStelle().getOrganisationseinheitenId()).isEqualTo(FormMetaDataTestFactory.OE_ID); assertThat(parsed.getZustaendigeStelles()).hasSize(1).first().extracting(ZustaendigeStelle::getOrganisationseinheitenId)
.isEqualTo(FormMetaDataTestFactory.OE_ID);
// assertThat(parsed.getZustaendigeStelle().getOrganisationseinheitenId()).isEqualTo(FormMetaDataTestFactory.OE_ID);
} }
@Test @Test
void shouldWorkWithoutGivenZustaendigeStelle() { void shouldWorkWithoutGivenZustaendigeStelle() {
var parsed = mapper.parseFormData(FormDataTestFactory.createBuilder().zustaendigeStelle(null).build()); var parsed = mapper.parseFormData(FormDataTestFactory.createBuilder().clearZustaendigeStelles().build());
assertThat(parsed.getZustaendigeStelles()).hasSize(1).first().extracting(ZustaendigeStelle::getOrganisationseinheitenId)
.isNotNull();
assertThat(parsed.getZustaendigeStelle()).isNotNull(); // assertThat(parsed.getZustaendigeStelle()).isNotNull();
} }
@Test @Test
......
net.devh.boot.grpc.client.autoconfigure.GrpcClientAutoConfiguration
net.devh.boot.grpc.client.autoconfigure.GrpcClientMetricAutoConfiguration
net.devh.boot.grpc.client.autoconfigure.GrpcClientHealthAutoConfiguration
net.devh.boot.grpc.client.autoconfigure.GrpcClientSecurityAutoConfiguration
net.devh.boot.grpc.client.autoconfigure.GrpcClientTraceAutoConfiguration
net.devh.boot.grpc.client.autoconfigure.GrpcDiscoveryClientAutoConfiguration
\ No newline at end of file
...@@ -92,7 +92,7 @@ class XtaMessageMapperTest { ...@@ -92,7 +92,7 @@ class XtaMessageMapperTest {
var formData = doMapping(); var formData = doMapping();
assertThat(formData.getControl().getMetaData()).isPresent().get() assertThat(formData.getControl().getMetaData()).isPresent().get()
.extracting(metaData -> metaData.getEntry(FormMetaDataTestFactory.DESTINATION_ID_ENTRY_NAME)) .extracting(metaData -> metaData.getEntry(FormMetaDataTestFactory.XTA_IDENTIFIER))
.isEqualTo(FormMetaDataTestFactory.XTA_IDENTIFIER); .isEqualTo(FormMetaDataTestFactory.XTA_IDENTIFIER);
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment