diff --git a/irs-api/src/main/java/org/eclipse/tractusx/irs/aaswrapper/job/delegate/DigitalTwinDelegate.java b/irs-api/src/main/java/org/eclipse/tractusx/irs/aaswrapper/job/delegate/DigitalTwinDelegate.java index af4392bfce..468a221ba6 100644 --- a/irs-api/src/main/java/org/eclipse/tractusx/irs/aaswrapper/job/delegate/DigitalTwinDelegate.java +++ b/irs-api/src/main/java/org/eclipse/tractusx/irs/aaswrapper/job/delegate/DigitalTwinDelegate.java @@ -37,7 +37,6 @@ import org.eclipse.tractusx.irs.registryclient.DigitalTwinRegistryKey; import org.eclipse.tractusx.irs.registryclient.DigitalTwinRegistryService; import org.eclipse.tractusx.irs.registryclient.exceptions.RegistryServiceException; -import org.springframework.web.client.RestClientException; /** * Retrieves AAShell from Digital Twin Registry service and storing it inside {@link ItemContainer}. @@ -55,8 +54,10 @@ public DigitalTwinDelegate(final AbstractDelegate nextStep, } @Override - public ItemContainer process(final ItemContainer.ItemContainerBuilder itemContainerBuilder, final JobParameter jobData, - final AASTransferProcess aasTransferProcess, final PartChainIdentificationKey itemId) { + @SuppressWarnings("PMD.AvoidCatchingGenericException") + public ItemContainer process(final ItemContainer.ItemContainerBuilder itemContainerBuilder, + final JobParameter jobData, final AASTransferProcess aasTransferProcess, + final PartChainIdentificationKey itemId) { if (StringUtils.isBlank(itemId.getBpn())) { log.warn("Could not process item with id {} because no BPN was provided. Creating Tombstone.", @@ -65,7 +66,9 @@ public ItemContainer process(final ItemContainer.ItemContainerBuilder itemContai Tombstone.from(itemId.getGlobalAssetId(), null, "Can't get relationship without a BPN", 0, ProcessStep.DIGITAL_TWIN_REQUEST)).build(); } + try { + final AssetAdministrationShellDescriptor shell = digitalTwinRegistryService.fetchShells( List.of(new DigitalTwinRegistryKey(itemId.getGlobalAssetId(), itemId.getBpn()))) .stream() @@ -79,9 +82,13 @@ public ItemContainer process(final ItemContainer.ItemContainerBuilder itemContai // filter submodel descriptors if next delegate will not be executed itemContainerBuilder.shell(shell.withFilteredSubmodelDescriptors(jobData.getAspects())); } - } catch (final RestClientException | RegistryServiceException e) { + + } catch (final RegistryServiceException | RuntimeException e) { + // catching generic exception is intended here, + // otherwise Jobs stay in state RUNNING forever log.info("Shell Endpoint could not be retrieved for Item: {}. Creating Tombstone.", itemId); - itemContainerBuilder.tombstone(Tombstone.from(itemId.getGlobalAssetId(), null, e, retryCount, ProcessStep.DIGITAL_TWIN_REQUEST)); + itemContainerBuilder.tombstone( + Tombstone.from(itemId.getGlobalAssetId(), null, e, retryCount, ProcessStep.DIGITAL_TWIN_REQUEST)); } if (expectedDepthOfTreeIsNotReached(jobData.getDepth(), aasTransferProcess.getDepth())) { diff --git a/irs-common/src/main/java/org/eclipse/tractusx/irs/common/util/concurrent/ResultFinder.java b/irs-common/src/main/java/org/eclipse/tractusx/irs/common/util/concurrent/ResultFinder.java index 28b585da3f..2c9e44c2e5 100644 --- a/irs-common/src/main/java/org/eclipse/tractusx/irs/common/util/concurrent/ResultFinder.java +++ b/irs-common/src/main/java/org/eclipse/tractusx/irs/common/util/concurrent/ResultFinder.java @@ -31,11 +31,12 @@ import java.util.concurrent.CompletionException; import java.util.function.BiFunction; import java.util.function.Function; +import java.util.stream.Collectors; import lombok.Getter; import lombok.ToString; import lombok.extern.slf4j.Slf4j; -import org.slf4j.Logger; +import org.apache.commons.lang3.exception.ExceptionUtils; /** * Helper class to find the relevant result from a list of futures. @@ -80,8 +81,15 @@ public CompletableFuture getFastestResult(final List log.info(logPrefix + "All of the futures completed"); if (ex != null) { - log.error(logPrefix + "Exception occurred: " + ex.getMessage(), ex); - fastestResultPromise.completeExceptionally(new CompletionExceptions(exceptions)); + + log.warn("All failed: " + System.lineSeparator() // + + exceptions.stream() + .map(ExceptionUtils::getStackTrace) + .collect(Collectors.joining(System.lineSeparator())), ex); + + fastestResultPromise.completeExceptionally( + new CompletionExceptions(LOGPREFIX_TO_BE_REMOVED_LATER + "None successful", exceptions)); + } else if (fastestResultPromise.isDone()) { log.info(logPrefix + "Fastest result already found, ignoring the others"); } else { @@ -145,20 +153,11 @@ private static Function collectingExceptionsAndThrow(final Lis public static class CompletionExceptions extends CompletionException { private final List causes; - - public CompletionExceptions(final List causes) { - super(LOGPREFIX_TO_BE_REMOVED_LATER + "All failing, use getCauses() for details"); + + public CompletionExceptions(final String msg, final List causes) { + super(msg); this.causes = causes; } - public void logWarn(final Logger log, final String prefix) { - - log.warn("{}{}", prefix, this.getMessage(), this.getCause()); - - for (final Throwable cause : this.getCauses()) { - log.warn(prefix + cause.getMessage(), cause); - } - } - } } diff --git a/irs-registry-client/src/main/java/org/eclipse/tractusx/irs/registryclient/decentral/DecentralDigitalTwinRegistryService.java b/irs-registry-client/src/main/java/org/eclipse/tractusx/irs/registryclient/decentral/DecentralDigitalTwinRegistryService.java index 94e380436a..7f27851fc2 100644 --- a/irs-registry-client/src/main/java/org/eclipse/tractusx/irs/registryclient/decentral/DecentralDigitalTwinRegistryService.java +++ b/irs-registry-client/src/main/java/org/eclipse/tractusx/irs/registryclient/decentral/DecentralDigitalTwinRegistryService.java @@ -26,7 +26,6 @@ import static org.eclipse.tractusx.irs.common.util.concurrent.ResultFinder.LOGPREFIX_TO_BE_REMOVED_LATER; import java.util.Collection; -import java.util.Collections; import java.util.HashSet; import java.util.List; import java.util.Map; @@ -47,7 +46,6 @@ import org.eclipse.tractusx.irs.registryclient.DigitalTwinRegistryService; import org.eclipse.tractusx.irs.registryclient.discovery.ConnectorEndpointsService; import org.eclipse.tractusx.irs.registryclient.exceptions.RegistryServiceException; -import org.eclipse.tractusx.irs.registryclient.exceptions.RegistryServiceRuntimeException; import org.eclipse.tractusx.irs.registryclient.exceptions.ShellNotFoundException; import org.jetbrains.annotations.NotNull; import org.springframework.util.StopWatch; @@ -82,6 +80,7 @@ private static Stream>> groupKeys } @Override + @SuppressWarnings("PMD.AvoidCatchingGenericException") public Collection fetchShells(final Collection keys) throws RegistryServiceException { @@ -90,11 +89,20 @@ public Collection fetchShells(final Collecti LOGPREFIX_TO_BE_REMOVED_LATER + "Fetching shell(s) for %s key(s)".formatted(keys.size())); try { - final var calledEndpoints = new HashSet(); - final var collectedShells = groupKeysByBpn(keys).flatMap( - entry -> fetchShellDescriptors(calledEndpoints, entry.getKey(), entry.getValue()).stream()) - .toList(); + + final var collectedShells = groupKeysByBpn(keys).flatMap(entry -> { + + try { + return fetchShellDescriptors(entry, calledEndpoints); + } catch (RuntimeException e) { + // catching generic exception is intended here, + // otherwise Jobs stay in state RUNNING forever + log.warn(e.getMessage(), e); + return Stream.empty(); + } + + }).toList(); if (collectedShells.isEmpty()) { log.info(LOGPREFIX_TO_BE_REMOVED_LATER + "No shells found"); @@ -110,9 +118,27 @@ public Collection fetchShells(final Collecti } } - @NotNull - private List fetchShellDescriptors(final Set calledEndpoints, - final String bpn, final List keys) { + private Stream fetchShellDescriptors( + final Map.Entry> entry, final Set calledEndpoints) { + + try { + + final var futures = fetchShellDescriptors(calledEndpoints, entry.getKey(), entry.getValue()); + final var shellDescriptors = futures.get(); + return shellDescriptors.stream(); + + } catch (InterruptedException e) { + log.error(e.getMessage(), e); + Thread.currentThread().interrupt(); + return Stream.empty(); + } catch (ExecutionException e) { + log.warn(e.getMessage(), e); + return Stream.empty(); + } + } + + private CompletableFuture> fetchShellDescriptors( + final Set calledEndpoints, final String bpn, final List keys) { final var watch = new StopWatch(); StopwatchUtils.startWatch(log, watch, @@ -125,56 +151,34 @@ private List fetchShellDescriptors(final Set connectorEndpoints.size(), bpn); calledEndpoints.addAll(connectorEndpoints); - return fetchShellDescriptorsForConnectorEndpoints(bpn, keys, connectorEndpoints); + return fetchShellDescriptorsForConnectorEndpoints(keys, connectorEndpoints); } finally { StopwatchUtils.stopWatch(log, watch); } } - private List fetchShellDescriptorsForConnectorEndpoints(final String bpn, + private CompletableFuture> fetchShellDescriptorsForConnectorEndpoints( final List keys, final List connectorEndpoints) { - final String logPrefix = LOGPREFIX_TO_BE_REMOVED_LATER + "fetchShellDescriptorsForConnectorEndpoints - "; - - final EndpointDataForConnectorsService service = endpointDataForConnectorsService; - try { - final var futures = service.createFindEndpointDataForConnectorsFutures(connectorEndpoints) - .stream() - .map(edrFuture -> edrFuture.thenCompose(edr -> CompletableFuture.supplyAsync( - () -> fetchShellDescriptorsForKey(keys, edr)))) - .toList(); - - log.info(logPrefix + " Created {} futures", futures.size()); - - return resultFinder.getFastestResult(futures).get(); - - } catch (InterruptedException e) { - - handleInterruptedException(e, - logPrefix + "InterruptedException occurred while fetching shells for bpn '%s'".formatted(bpn)); - return Collections.emptyList(); + final var logPrefix = LOGPREFIX_TO_BE_REMOVED_LATER + "fetchShellDescriptorsForConnectorEndpoints - "; - } catch (ResultFinder.CompletionExceptions e) { + final var service = endpointDataForConnectorsService; + final var futures = service.createFindEndpointDataForConnectorsFutures(connectorEndpoints) + .stream() + .map(edrFuture -> edrFuture.thenCompose(edr -> CompletableFuture.supplyAsync( + () -> fetchShellDescriptorsForKey(keys, edr)))) + .toList(); - e.logWarn(log, logPrefix); + log.info(logPrefix + " Created {} futures", futures.size()); - throw new RegistryServiceRuntimeException( - "Exception occurred while fetching shells for bpn '%s'".formatted(bpn), e); - - } catch (ExecutionException e) { - - log.error(logPrefix + e.getMessage(), e); - throw new RegistryServiceRuntimeException( - "Exception occurred while fetching shells for bpn '%s'".formatted(bpn), e); - - } + return resultFinder.getFastestResult(futures); } private List fetchShellDescriptorsForKey( final List keys, final EndpointDataReference endpointDataReference) { - final String logPrefix = LOGPREFIX_TO_BE_REMOVED_LATER + " fetchShellDescriptorsForKey - "; + final var logPrefix = LOGPREFIX_TO_BE_REMOVED_LATER + " fetchShellDescriptorsForKey - "; final var watch = new StopWatch(); StopwatchUtils.startWatch(log, watch, @@ -190,7 +194,7 @@ private List fetchShellDescriptorsForKey( private AssetAdministrationShellDescriptor fetchShellDescriptor(final EndpointDataReference endpointDataReference, final DigitalTwinRegistryKey key) { - final String logPrefix = LOGPREFIX_TO_BE_REMOVED_LATER + " fetchShellDescriptor - "; + final var logPrefix = LOGPREFIX_TO_BE_REMOVED_LATER + " fetchShellDescriptor - "; final var watch = new StopWatch(); StopwatchUtils.startWatch(log, watch, @@ -216,7 +220,7 @@ private AssetAdministrationShellDescriptor fetchShellDescriptor(final EndpointDa @NotNull private String mapToShellId(final EndpointDataReference endpointDataReference, final String key) { - final String logPrefix = LOGPREFIX_TO_BE_REMOVED_LATER + "mapToShellId - "; + final var logPrefix = LOGPREFIX_TO_BE_REMOVED_LATER + "mapToShellId - "; final var watch = new StopWatch(); StopwatchUtils.startWatch(log, watch, logPrefix + "Mapping '%s' to shell ID for endpoint '%s'".formatted(key, @@ -248,9 +252,10 @@ private String mapToShellId(final EndpointDataReference endpointDataReference, f } } - private Collection lookupShellIds(final String bpn) { + @SuppressWarnings("PMD.AvoidCatchingGenericException") + private Collection lookupShellIds(final String bpn) throws RegistryServiceException { - final String logPrefix = LOGPREFIX_TO_BE_REMOVED_LATER + "lookupShellIds - "; + final var logPrefix = LOGPREFIX_TO_BE_REMOVED_LATER + "lookupShellIds - "; log.info(logPrefix + "Looking up shell ids for bpn {}", bpn); final var connectorEndpoints = connectorEndpointsService.fetchConnectorEndpoints(bpn); @@ -260,6 +265,25 @@ private Collection lookupShellIds(final String bpn) { connectorEndpoints); log.info(logPrefix + "Created endpointDataReferenceFutures"); + try { + + return lookupShellIds(bpn, endpointDataReferenceFutures, logPrefix); + + } catch (RuntimeException e) { + // catching generic exception is intended here, + // otherwise Jobs stay in state RUNNING forever + log.error(logPrefix + e.getMessage(), e); // TODO (mfischer) #214 do not log and throw + final var msg = logPrefix + e.getClass().getSimpleName() + + " occurred while looking up shell ids for bpn '%s'".formatted(bpn); + throw new RegistryServiceException(msg, e); + } + } + + @NotNull + private Collection lookupShellIds(final String bpn, + final List> endpointDataReferenceFutures, final String logPrefix) + throws RegistryServiceException { + try { final var futures = endpointDataReferenceFutures.stream() .map(edrFuture -> edrFuture.thenCompose( @@ -272,27 +296,19 @@ private Collection lookupShellIds(final String bpn) { return shellIds; } catch (InterruptedException e) { - - handleInterruptedException(e, - logPrefix + "InterruptedException occurred while looking up shells ids for bpn '%s'".formatted( - bpn)); - return Collections.emptyList(); - - } catch (ResultFinder.CompletionExceptions e) { - - e.logWarn(log, logPrefix); - - throw new RegistryServiceRuntimeException(LOGPREFIX_TO_BE_REMOVED_LATER - + "Exception occurred while looking up shell ids for bpn '%s'".formatted(bpn), e); - + log.error(logPrefix + "InterruptedException occurred while looking up shells ids for bpn '%s': ".formatted( + bpn) + e.getMessage(), e); // #214 do not log and throw + Thread.currentThread().interrupt(); + throw new RegistryServiceException(LOGPREFIX_TO_BE_REMOVED_LATER + e.getClass().getSimpleName() + + " occurred while looking up shell ids for bpn '%s'".formatted(bpn), e); } catch (ExecutionException e) { - log.error(logPrefix + e.getMessage(), e); - throw new RegistryServiceRuntimeException(LOGPREFIX_TO_BE_REMOVED_LATER - + "Exception occurred while looking up shell ids for bpn '%s'".formatted(bpn), e); + log.error(logPrefix + e.getMessage(), e); // TODO (mfischer) #214 do not log and throw + throw new RegistryServiceException(LOGPREFIX_TO_BE_REMOVED_LATER + e.getClass().getSimpleName() + + " occurred while looking up shell ids for bpn '%s'".formatted(bpn), e); } } - private List lookupShellIds(final String bpn, final EndpointDataReference endpointDataReference) { + private Collection lookupShellIds(final String bpn, final EndpointDataReference endpointDataReference) { final String logPrefix = LOGPREFIX_TO_BE_REMOVED_LATER + "lookupShellIds - "; final var watch = new StopWatch(); @@ -310,12 +326,8 @@ private List lookupShellIds(final String bpn, final EndpointDataReferenc } @Override - public Collection lookupShellIdentifiers(final String bpn) { + public Collection lookupShellIdentifiers(final String bpn) throws RegistryServiceException { return lookupShellIds(bpn).stream().map(id -> new DigitalTwinRegistryKey(id, bpn)).toList(); } - private void handleInterruptedException(final InterruptedException interruptedException, final String msg) { - log.warn(msg, interruptedException); - Thread.currentThread().interrupt(); - } } diff --git a/irs-registry-client/src/main/java/org/eclipse/tractusx/irs/registryclient/exceptions/RegistryServiceException.java b/irs-registry-client/src/main/java/org/eclipse/tractusx/irs/registryclient/exceptions/RegistryServiceException.java index 1aebfdad34..3995b27a30 100644 --- a/irs-registry-client/src/main/java/org/eclipse/tractusx/irs/registryclient/exceptions/RegistryServiceException.java +++ b/irs-registry-client/src/main/java/org/eclipse/tractusx/irs/registryclient/exceptions/RegistryServiceException.java @@ -31,4 +31,8 @@ public class RegistryServiceException extends Exception { public RegistryServiceException(final String msg) { super(msg); } + + public RegistryServiceException(final String msg, final Throwable cause) { + super(msg, cause); + } } diff --git a/irs-registry-client/src/main/java/org/eclipse/tractusx/irs/registryclient/exceptions/RegistryServiceRuntimeException.java b/irs-registry-client/src/main/java/org/eclipse/tractusx/irs/registryclient/exceptions/RegistryServiceRuntimeException.java deleted file mode 100644 index 8ce90c32f3..0000000000 --- a/irs-registry-client/src/main/java/org/eclipse/tractusx/irs/registryclient/exceptions/RegistryServiceRuntimeException.java +++ /dev/null @@ -1,30 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2021,2024 Contributors to the Eclipse Foundation - * - * See the NOTICE file(s) distributed with this work for additional - * information regarding copyright ownership. - * - * This program and the accompanying materials are made available under the - * terms of the Apache License, Version 2.0 which is available at - * https://www.apache.org/licenses/LICENSE-2.0. - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations - * under the License. - * - * SPDX-License-Identifier: Apache-2.0 - ********************************************************************************/ -package org.eclipse.tractusx.irs.registryclient.exceptions; - -/** - * Base runtime exception for the registry client - */ -public class RegistryServiceRuntimeException extends RuntimeException { - - public RegistryServiceRuntimeException(final String msg, final Throwable cause) { - super(msg, cause); - } - -} diff --git a/irs-registry-client/src/test/java/org/eclipse/tractusx/irs/registryclient/decentral/DecentralDigitalTwinRegistryServiceTest.java b/irs-registry-client/src/test/java/org/eclipse/tractusx/irs/registryclient/decentral/DecentralDigitalTwinRegistryServiceTest.java index 76b26d5008..5d182a3f38 100644 --- a/irs-registry-client/src/test/java/org/eclipse/tractusx/irs/registryclient/decentral/DecentralDigitalTwinRegistryServiceTest.java +++ b/irs-registry-client/src/test/java/org/eclipse/tractusx/irs/registryclient/decentral/DecentralDigitalTwinRegistryServiceTest.java @@ -45,12 +45,14 @@ import org.eclipse.tractusx.irs.registryclient.DigitalTwinRegistryKey; import org.eclipse.tractusx.irs.registryclient.discovery.ConnectorEndpointsService; import org.eclipse.tractusx.irs.registryclient.exceptions.RegistryServiceException; -import org.eclipse.tractusx.irs.registryclient.exceptions.RegistryServiceRuntimeException; import org.eclipse.tractusx.irs.registryclient.exceptions.ShellNotFoundException; import org.junit.jupiter.api.DisplayName; +import org.junit.jupiter.api.DisplayNameGeneration; +import org.junit.jupiter.api.DisplayNameGenerator; import org.junit.jupiter.api.Nested; import org.junit.jupiter.api.Test; +@DisplayNameGeneration(DisplayNameGenerator.ReplaceUnderscores.class) class DecentralDigitalTwinRegistryServiceTest { private final ConnectorEndpointsService connectorEndpointsService = mock(ConnectorEndpointsService.class); @@ -80,7 +82,7 @@ public static AssetAdministrationShellDescriptor shellDescriptor( class FetchShellsTests { @Test - void shouldReturnExpectedShell() throws RegistryServiceException { + void should_return_expected_shell() throws RegistryServiceException { // given final var digitalTwinRegistryKey = new DigitalTwinRegistryKey( "urn:uuid:4132cd2b-cbe7-4881-a6b4-39fdc31cca2b", "bpn"); @@ -107,7 +109,7 @@ void shouldReturnExpectedShell() throws RegistryServiceException { } @Test - void whenInterruptedExceptionOccurs() throws ExecutionException, InterruptedException { + void when_InterruptedException_occurs() throws ExecutionException, InterruptedException { // given simulateResultFinderInterrupted(); @@ -141,7 +143,7 @@ void whenInterruptedExceptionOccurs() throws ExecutionException, InterruptedExce } @Test - void whenExecutionExceptionOccurs() { + void when_ExecutionException_occurs() { // given simulateGetFastestResultFailedFuture(); @@ -166,14 +168,13 @@ void whenExecutionExceptionOccurs() { List.of(new DigitalTwinRegistryKey("dummyShellId", bpn))); // then - assertThatThrownBy(call).isInstanceOf(RegistryServiceRuntimeException.class) - .hasMessageContaining("Exception occurred while fetching shells for bpn") - .hasMessageContaining("'" + bpn + "'"); + assertThatThrownBy(call).isInstanceOf(ShellNotFoundException.class) + .hasMessageContaining("Unable to find any of the requested shells"); } @Test - void shouldThrowShellNotFound_IfNoDigitalTwinRegistryKeys() { + void should_throw_ShellNotFoundException_if_no_digital_twin_registry_keys_given() { assertThatThrownBy(() -> sut.fetchShells(emptyList())).isInstanceOf(ShellNotFoundException.class); } @@ -203,7 +204,7 @@ private static EndpointDataReference endpointDataReference(final String url) { class LookupGlobalAssetIdsTests { @Test - void shouldReturnExpectedGlobalAssetId() throws RegistryServiceException { + void should_return_the_expected_globalAssetId() throws RegistryServiceException { // given final var digitalTwinRegistryKey = new DigitalTwinRegistryKey( "urn:uuid:4132cd2b-cbe7-4881-a6b4-39fdc31cca2b", "bpn"); @@ -235,7 +236,7 @@ void shouldReturnExpectedGlobalAssetId() throws RegistryServiceException { } @Test - void whenInterruptedExceptionOccurs() throws ExecutionException, InterruptedException { + void when_InterruptedException_occurs() throws ExecutionException, InterruptedException { // given simulateResultFinderInterrupted(); @@ -243,12 +244,14 @@ void whenInterruptedExceptionOccurs() throws ExecutionException, InterruptedExce final ThrowingCallable call = () -> sut.lookupShellsByBPN("dummyBpn"); // then - assertThatThrownBy(call).isInstanceOf(ShellNotFoundException.class) - .hasMessage("Unable to find any of the requested shells"); + assertThatThrownBy(call).isInstanceOf(RegistryServiceException.class) + .hasMessageContaining( + "InterruptedException occurred while looking up shell ids for bpn") + .hasMessageContaining("dummyBpn"); } @Test - void whenExecutionExceptionOccurs() { + void when_ExecutionException_occurs() { // given simulateGetFastestResultFailedFuture(); @@ -257,7 +260,7 @@ void whenExecutionExceptionOccurs() { final ThrowingCallable call = () -> sut.lookupShellsByBPN(bpn); // then - assertThatThrownBy(call).isInstanceOf(RegistryServiceRuntimeException.class) + assertThatThrownBy(call).isInstanceOf(RegistryServiceException.class) .hasMessageContaining("Exception occurred while looking up shell ids for bpn") .hasMessageContaining("'" + bpn + "'"); } diff --git a/irs-registry-client/src/test/java/org/eclipse/tractusx/irs/registryclient/exceptions/RegistryServiceRuntimeExceptionTest.java b/irs-registry-client/src/test/java/org/eclipse/tractusx/irs/registryclient/exceptions/RegistryServiceRuntimeExceptionTest.java deleted file mode 100644 index 40c0a99f30..0000000000 --- a/irs-registry-client/src/test/java/org/eclipse/tractusx/irs/registryclient/exceptions/RegistryServiceRuntimeExceptionTest.java +++ /dev/null @@ -1,36 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2021,2022,2024 Contributors to the Eclipse Foundation - * - * See the NOTICE file(s) distributed with this work for additional - * information regarding copyright ownership. - * - * This program and the accompanying materials are made available under the - * terms of the Apache License, Version 2.0 which is available at - * https://www.apache.org/licenses/LICENSE-2.0. - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations - * under the License. - * - * SPDX-License-Identifier: Apache-2.0 - ********************************************************************************/ -package org.eclipse.tractusx.irs.registryclient.exceptions; - -import static org.assertj.core.api.Assertions.assertThat; - -import org.junit.jupiter.api.Test; - -class RegistryServiceRuntimeExceptionTest { - - @Test - void test() { - final IllegalArgumentException expectedCause = new IllegalArgumentException("original cause"); - final RegistryServiceRuntimeException exception = new RegistryServiceRuntimeException("message", expectedCause); - - assertThat(exception).hasMessage("message") - .hasCauseInstanceOf(IllegalArgumentException.class) - .hasCause(expectedCause); - } -} \ No newline at end of file