SimplifiedKinesisClient { public GetKinesisRecordsResult getRecords(String shardIterator, String streamName, String shardId) throws TransientKinesisException { return getRecords(shardIterator, streamName, shardId, limit); } SimplifiedKinesisClient(
      AmazonKinesis kinesis, AmazonCloudWatch cloudWatch, Integer limit); static SimplifiedKinesisClient from(AWSClientsProvider provider, Integer limit); String getShardIterator(
      final String streamName,
      final String shardId,
      final ShardIteratorType shardIteratorType,
      final String startingSequenceNumber,
      final Instant timestamp); List<Shard> listShards(final String streamName); GetKinesisRecordsResult getRecords(String shardIterator, String streamName, String shardId); GetKinesisRecordsResult getRecords(
      final String shardIterator,
      final String streamName,
      final String shardId,
      final Integer limit); long getBacklogBytes(String streamName, Instant countSince); long getBacklogBytes(
      final String streamName, final Instant countSince, final Instant countTo);  }
@Test public void shouldReturnLimitedNumberOfRecords() throws Exception { final Integer limit = 100; doAnswer( (Answer<GetRecordsResult>) invocation -> { GetRecordsRequest request = (GetRecordsRequest) invocation.getArguments()[0]; List<Record> records = generateRecords(request.getLimit()); return new GetRecordsResult().withRecords(records).withMillisBehindLatest(1000L); }) .when(kinesis) .getRecords(any(GetRecordsRequest.class)); GetKinesisRecordsResult result = underTest.getRecords(SHARD_ITERATOR, STREAM, SHARD_1, limit); assertThat(result.getRecords().size()).isEqualTo(limit); }