diff --git a/collaboration-manager-server/src/main/java/de/ozgcloud/collaboration/vorgang/CollaborationServiceKontoMapper.java b/collaboration-manager-server/src/main/java/de/ozgcloud/collaboration/vorgang/CollaborationServiceKontoMapper.java index 2f9004e37b35648f92b7755745879b4fc5527b20..33a3509b62084ec4fc79f0ddd96fec0c1c3ebcea 100644 --- a/collaboration-manager-server/src/main/java/de/ozgcloud/collaboration/vorgang/CollaborationServiceKontoMapper.java +++ b/collaboration-manager-server/src/main/java/de/ozgcloud/collaboration/vorgang/CollaborationServiceKontoMapper.java @@ -29,7 +29,6 @@ import java.util.Map; import java.util.Objects; import java.util.stream.Collectors; -import org.apache.commons.lang3.StringUtils; import org.mapstruct.CollectionMappingStrategy; import org.mapstruct.Mapper; import org.mapstruct.Mapping; @@ -89,6 +88,6 @@ public interface CollaborationServiceKontoMapper { GrpcServiceKonto toServiceKonto(ServiceKonto serviceKonto); default String toString(TrustLevel trustLevel) { - return Objects.isNull(trustLevel) ? StringUtils.EMPTY : trustLevel.getValue(); + return trustLevel.getValue(); } } \ No newline at end of file diff --git a/collaboration-manager-server/src/test/java/de/ozgcloud/collaboration/CollaborationEventListenerTest.java b/collaboration-manager-server/src/test/java/de/ozgcloud/collaboration/CollaborationEventListenerTest.java index c8248650f7dbe5b33b2533eac9437336c1bb358d..36cb45c71ebf7b08ac03085931b2b3661a236e3a 100644 --- a/collaboration-manager-server/src/test/java/de/ozgcloud/collaboration/CollaborationEventListenerTest.java +++ b/collaboration-manager-server/src/test/java/de/ozgcloud/collaboration/CollaborationEventListenerTest.java @@ -88,14 +88,12 @@ class CollaborationEventListenerTest { private final Command command = CommandTestFactory.createBuilder().build(); - private CollaborationRequest collaborationRequest = CollaborationRequestTestFactory.create(); - @Captor private ArgumentCaptor<CommandFailedEvent> commandFailedEventCaptor; @Test void shouldCallCommandMapper() { - when(commandMapper.toCollaborationRequest(any())).thenReturn(collaborationRequest); + when(commandMapper.toCollaborationRequest(any())).thenReturn(CollaborationRequestTestFactory.create()); eventListener.createCollaborationRequest(command); @@ -104,6 +102,7 @@ class CollaborationEventListenerTest { @Test void shouldCallCreateCollaborationRequest() { + var collaborationRequest = CollaborationRequestTestFactory.create(); when(commandMapper.toCollaborationRequest(any())).thenReturn(collaborationRequest); eventListener.createCollaborationRequest(command); @@ -113,7 +112,7 @@ class CollaborationEventListenerTest { @Test void shouldCallCreateFachstellenBeteiligungRequest() { - collaborationRequest = CollaborationRequestTestFactory.createBuilder().collaborationLevel(4).build(); + var collaborationRequest = CollaborationRequestTestFactory.createBuilder().collaborationLevel(4).build(); when(commandMapper.toCollaborationRequest(any())).thenReturn(collaborationRequest); eventListener.createCollaborationRequest(command); @@ -125,7 +124,7 @@ class CollaborationEventListenerTest { @ParameterizedTest(name = "when collaboration level is {0}") @ValueSource(ints = { 0, 2, 3, 5 }) void shouldDeclineRequest(int collaborationLevel) { - collaborationRequest = CollaborationRequestTestFactory.createBuilder().collaborationLevel(collaborationLevel).build(); + var collaborationRequest = CollaborationRequestTestFactory.createBuilder().collaborationLevel(collaborationLevel).build(); when(commandMapper.toCollaborationRequest(any())).thenReturn(collaborationRequest); eventListener.createCollaborationRequest(command); diff --git a/collaboration-manager-server/src/test/java/de/ozgcloud/collaboration/CollaborationServiceITCase.java b/collaboration-manager-server/src/test/java/de/ozgcloud/collaboration/CollaborationServiceITCase.java index 8eb4154cedc8a170734fd00a8231b71fd73f67ec..52847525b2a2aa2cd7f1758642374280ab5fe616 100644 --- a/collaboration-manager-server/src/test/java/de/ozgcloud/collaboration/CollaborationServiceITCase.java +++ b/collaboration-manager-server/src/test/java/de/ozgcloud/collaboration/CollaborationServiceITCase.java @@ -79,8 +79,8 @@ class CollaborationServiceITCase { @Nested class TestCreateFachstellenBeteiligungRequest { - @DisplayName("should validate titel") - @ParameterizedTest(name = "fail when titel: \"{0}\"") + @DisplayName("validate titel") + @ParameterizedTest(name = "should throw exception on titel: \"{0}\"") @NullAndEmptySource @ValueSource(strings = { StringUtils.SPACE }) void shouldValidateTitel(String titel) { @@ -89,8 +89,8 @@ class CollaborationServiceITCase { Assertions.assertThrows(ConstraintViolationException.class, () -> service.createFachstellenBeteiligungRequest(request)); } - @DisplayName("should validate anfrage") - @ParameterizedTest(name = "fail when titel: \"{0}\"") + @DisplayName("validate anfrage") + @ParameterizedTest(name = "should throw exception on anfrage: \"{0}\"") @NullAndEmptySource @ValueSource(strings = { StringUtils.SPACE }) void shouldValidateAnfrage(String anfrage) { @@ -99,8 +99,8 @@ class CollaborationServiceITCase { Assertions.assertThrows(ConstraintViolationException.class, () -> service.createFachstellenBeteiligungRequest(request)); } - @DisplayName("should validate zustaendigeStelle") - @ParameterizedTest(name = "fail when zustaendigeStelle: \"{0}\"") + @DisplayName("validate zustaendigeStelle") + @ParameterizedTest(name = "should throw exception oon zustaendigeStelle: \"{0}\"") @NullAndEmptySource @ValueSource(strings = { StringUtils.SPACE }) void shouldValidateCollaborationRequestTitel(String zustaendigeStelle) { diff --git a/collaboration-manager-server/src/test/java/de/ozgcloud/collaboration/vorgang/PostfachAddressTestFactory.java b/collaboration-manager-server/src/test/java/de/ozgcloud/collaboration/vorgang/PostfachAddressTestFactory.java index e1102bed4a73561fb9d2627d39db00d6436f5436..8c20d290e025239ef8a531ea9c8de43c0733abca 100644 --- a/collaboration-manager-server/src/test/java/de/ozgcloud/collaboration/vorgang/PostfachAddressTestFactory.java +++ b/collaboration-manager-server/src/test/java/de/ozgcloud/collaboration/vorgang/PostfachAddressTestFactory.java @@ -26,15 +26,14 @@ package de.ozgcloud.collaboration.vorgang; import java.util.Map; import de.ozgcloud.apilib.vorgang.OzgCloudPostfachAddressIdentifierTestFactory; -import de.ozgcloud.apilib.vorgang.OzgCloudPostfachAddressTestFactory; import de.ozgcloud.collaboration.vorgang.ServiceKonto.PostfachAddress; import de.ozgcloud.collaboration.vorgang.ServiceKonto.PostfachAddress.PostfachAddressBuilder; public class PostfachAddressTestFactory { - public static final String VERSION = OzgCloudPostfachAddressTestFactory.VERSION; - public static final int TYPE = OzgCloudPostfachAddressTestFactory.TYPE; - public static final String POSTFACH_ID = OzgCloudPostfachAddressIdentifierTestFactory.VALUE; + public static final String VERSION = "1.0"; + public static final int TYPE = 1; + public static final String POSTFACH_ID = "0815"; public static PostfachAddress create() { return createBuilder().build(); diff --git a/collaboration-manager-server/src/test/java/de/ozgcloud/collaboration/vorgang/ServiceKontoTestFactory.java b/collaboration-manager-server/src/test/java/de/ozgcloud/collaboration/vorgang/ServiceKontoTestFactory.java index d9b42bdc5bf6131c274dc70c9241aed4423f0c29..b7e01059f1f4adbe6ae885320e6a798aa7537dc9 100644 --- a/collaboration-manager-server/src/test/java/de/ozgcloud/collaboration/vorgang/ServiceKontoTestFactory.java +++ b/collaboration-manager-server/src/test/java/de/ozgcloud/collaboration/vorgang/ServiceKontoTestFactory.java @@ -23,13 +23,12 @@ */ package de.ozgcloud.collaboration.vorgang; -import de.ozgcloud.apilib.vorgang.OzgCloudServiceKontoTestFactory; import de.ozgcloud.collaboration.vorgang.ServiceKonto.ServiceKontoBuilder; public class ServiceKontoTestFactory { public static final TrustLevel TRUST_LEVEL = TrustLevel.LEVEL_1; - public static final String TYPE = OzgCloudServiceKontoTestFactory.TYPE_STR; + public static final String TYPE = "type"; public static final ServiceKonto.PostfachAddress POSTFACH_ADDRESS = PostfachAddressTestFactory.create(); public static ServiceKonto create() {