Skip to content

Commit 3a43ccc

Browse files
committed
Add test to verify NoSuchElementException (No value present) is not thrown
1 parent 323c529 commit 3a43ccc

File tree

1 file changed

+49
-0
lines changed

1 file changed

+49
-0
lines changed

stream-access-control/access-control-core/src/test/java/com/backbase/stream/service/AccessGroupServiceTest.java

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -849,6 +849,55 @@ void updateExistingDataGroupsBatchWithSameInDbsIngestionModeReplace() {
849849
verify(dataGroupIntegrationApi, times(0)).batchUpdateDataItems(any());
850850
}
851851

852+
@Test
853+
void updateExistingDataGroupsBatchWhenNoMatchingInDbsIngestionModeReplace() {
854+
// Given
855+
BatchProductGroupTask batchProductGroupTask = new BatchProductGroupTask();
856+
batchProductGroupTask.setIngestionMode(BatchProductIngestionMode.REPLACE);
857+
batchProductGroupTask.setBatchProductGroup(new BatchProductGroup().productGroups(
858+
List.of(new BaseProductGroup().name("Test product group"))));
859+
860+
DataGroup unmatchedDataGroup1 = buildDataGroupItem(
861+
"Unmatched Data Group 1",
862+
"Unmatched Data Group 1",
863+
"unmatched-1"
864+
);
865+
DataGroup unmatchedDataGroup2 = buildDataGroupItem(
866+
"Unmatched Data Group 2",
867+
"Unmatched Data Group 2",
868+
"unmatched-2"
869+
);
870+
871+
BaseProductGroup productGroup1 = buildBaseProductGroup(
872+
"Different Product Group 1",
873+
"Different Product Group 1",
874+
BaseProductGroup.ProductGroupTypeEnum.REPOSITORIES,
875+
"different-1"
876+
);
877+
BaseProductGroup productGroup2 = buildBaseProductGroup(
878+
"Different Product Group 2",
879+
"Different Product Group 2",
880+
BaseProductGroup.ProductGroupTypeEnum.REPOSITORIES,
881+
"different-2"
882+
);
883+
884+
when(arrangementsApi.postSearchArrangements(any()))
885+
.thenReturn(Mono.just(new ArrangementSearchesListResponse()
886+
.arrangementElements(List.of(
887+
new ArrangementItem().id("unmatched-1").externalArrangementId("ext-unmatched-1"),
888+
new ArrangementItem().id("unmatched-2").externalArrangementId("ext-unmatched-2")
889+
))));
890+
891+
// When
892+
subject.updateExistingDataGroupsBatch(batchProductGroupTask,
893+
List.of(unmatchedDataGroup1, unmatchedDataGroup2),
894+
List.of(productGroup1, productGroup2))
895+
.block();
896+
897+
// Then
898+
verify(dataGroupIntegrationApi, times(0)).batchUpdateDataItems(any());
899+
}
900+
852901
@Test
853902
void updateExistingDataGroupsBatchWithMissingInDbsIngestionModeReplace() {
854903
// Given

0 commit comments

Comments
 (0)