    @Test
    public void testCheckAndCreateLeasesForShardsWithShardListMultiStream() throws Exception {

        final List<Shard> latestShards = constructShardListForGraphA();

        final ArgumentCaptor<Lease> leaseCaptor = ArgumentCaptor.forClass(Lease.class);
        when(shardDetector.listShards()).thenReturn(latestShards);
        when(dynamoDBLeaseRefresher.listLeases()).thenReturn(Collections.emptyList());
        when(dynamoDBLeaseRefresher.createLeaseIfNotExists(leaseCaptor.capture())).thenReturn(true);
        setupMultiStream();
        hierarchicalShardSyncer
                .checkAndCreateLeaseForNewShards(shardDetector, dynamoDBLeaseRefresher, INITIAL_POSITION_LATEST,
                        latestShards, false, SCOPE,
                        dynamoDBLeaseRefresher.isLeaseTableEmpty());

        final Set<String> expectedShardIds = new HashSet<>(
                toMultiStreamLeaseList(Arrays.asList("shardId-4", "shardId-8", "shardId-9", "shardId-10")));

        final List<Lease> requestLeases = leaseCaptor.getAllValues();
        final Set<String> requestLeaseKeys = requestLeases.stream().map(Lease::leaseKey).collect(Collectors.toSet());
        final Set<ExtendedSequenceNumber> extendedSequenceNumbers = requestLeases.stream().map(Lease::checkpoint)
                .collect(Collectors.toSet());

        assertThat(requestLeases.size(), equalTo(expectedShardIds.size()));
        assertThat(requestLeaseKeys, equalTo(expectedShardIds));
        assertThat(extendedSequenceNumbers.size(), equalTo(1));
        validateHashRangeinLease(requestLeases);
        extendedSequenceNumbers.forEach(seq -> assertThat(seq, equalTo(ExtendedSequenceNumber.LATEST)));

        verify(shardDetector, never()).listShards();
        verify(dynamoDBLeaseRefresher, times(expectedShardIds.size())).createLeaseIfNotExists(any(Lease.class));
        verify(dynamoDBLeaseRefresher, never()).deleteLease(any(Lease.class));
    }