Skip to content

Commit

Permalink
fix(exception-handling): [#841] fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
dsmf committed Aug 1, 2024
1 parent 1c4ab9e commit b6fd328
Showing 1 changed file with 5 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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);

Expand All @@ -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);
}

Expand Down

0 comments on commit b6fd328

Please sign in to comment.