From b6fd3287b43f930db223d4688600808c7d81ab40 Mon Sep 17 00:00:00 2001 From: Matthias Fischer Date: Thu, 1 Aug 2024 14:43:12 +0200 Subject: [PATCH] fix(exception-handling): [#841] fix test --- .../job/delegate/RelationshipDelegateTest.java | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/irs-api/src/test/java/org/eclipse/tractusx/irs/aaswrapper/job/delegate/RelationshipDelegateTest.java b/irs-api/src/test/java/org/eclipse/tractusx/irs/aaswrapper/job/delegate/RelationshipDelegateTest.java index 2e5eb5b33..540335fa1 100644 --- a/irs-api/src/test/java/org/eclipse/tractusx/irs/aaswrapper/job/delegate/RelationshipDelegateTest.java +++ b/irs-api/src/test/java/org/eclipse/tractusx/irs/aaswrapper/job/delegate/RelationshipDelegateTest.java @@ -412,7 +412,8 @@ void shouldCatchJsonParseExceptionAndPutTombstone() throws EdcClientException { @Test void shouldCatchUsagePolicyExceptionAndPutTombstone() throws EdcClientException { // given - final String businessPartnerNumber = "BPNL000000011111"; + + final PartChainIdentificationKey partChainIdentificationKey = createKey(); final ItemContainerBuilder itemContainerWithShell = ItemContainer.builder() .shell(shell("", shellDescriptor( List.of(submodelDescriptorWithDspEndpoint( @@ -421,9 +422,8 @@ void shouldCatchUsagePolicyExceptionAndPutTombstone() throws EdcClientException // when when(submodelFacade.getSubmodelPayload(any(), any(), any(), any())).thenThrow( - new UsagePolicyPermissionException(List.of(), null, businessPartnerNumber)); + new UsagePolicyPermissionException(List.of(), null, partChainIdentificationKey.getBpn())); when(connectorEndpointsService.fetchConnectorEndpoints(any())).thenReturn(List.of("connector.endpoint.nl")); - final PartChainIdentificationKey partChainIdentificationKey = createKey(); final ItemContainer result = relationshipDelegate.process(itemContainerWithShell, jobParameter(), new AASTransferProcess(), partChainIdentificationKey); @@ -434,12 +434,11 @@ void shouldCatchUsagePolicyExceptionAndPutTombstone() throws EdcClientException assertThat(tombstones).hasSize(1); final Tombstone tombstone = tombstones.get(0); - assertThat(tombstone.getBusinessPartnerNumber()).isEqualTo( - businessPartnerNumber); // TODO (mfischer) is this correct or should it be the bpn from partChainIdentificationKey? + assertThat(tombstone.getBusinessPartnerNumber()).isEqualTo(partChainIdentificationKey.getBpn()); assertThat(tombstone.getEndpointURL()).isEqualTo("address"); assertThat(tombstone.getCatenaXId()).isEqualTo("itemId"); - assertThat(tombstone.getBusinessPartnerNumber()).isEqualTo(businessPartnerNumber); + assertThat(tombstone.getBusinessPartnerNumber()).isEqualTo(partChainIdentificationKey.getBpn()); assertThat(tombstone.getProcessingError().getProcessStep()).isEqualTo(ProcessStep.USAGE_POLICY_VALIDATION); }