DynamodbStreamRecordTransformer { public static StreamRecord toStreamRecordV2(final com.amazonaws.services.lambda.runtime.events.models.dynamodb.StreamRecord streamRecord) { return StreamRecord.builder() .approximateCreationDateTime( streamRecord.getApproximateCreationDateTime().toInstant() ) .keys( DynamodbAttributeValueTransformer.toAttributeValueMapV2(streamRecord.getKeys()) ) .newImage( streamRecord.getNewImage() != null ? DynamodbAttributeValueTransformer.toAttributeValueMapV2(streamRecord.getNewImage()) : null ) .oldImage( streamRecord.getOldImage() != null ? DynamodbAttributeValueTransformer.toAttributeValueMapV2(streamRecord.getOldImage()) : null ) .sequenceNumber(streamRecord.getSequenceNumber()) .sizeBytes(streamRecord.getSizeBytes()) .streamViewType(streamRecord.getStreamViewType()) .build(); }  static StreamRecord toStreamRecordV2(final com.amazonaws.services.lambda.runtime.events.models.dynamodb.StreamRecord streamRecord);  }
@Test public void testToStreamRecordV2() { StreamRecord convertedStreamRecord = DynamodbStreamRecordTransformer.toStreamRecordV2(streamRecord_event); Assertions.assertEquals(streamRecord_v2, convertedStreamRecord); }
@Test public void testToStreamRecordV2WhenOldImageIsNull() { com.amazonaws.services.lambda.runtime.events.models.dynamodb.StreamRecord streamRecord = streamRecord_event.clone(); streamRecord.setOldImage(null); Assertions.assertDoesNotThrow(() -> { DynamodbStreamRecordTransformer.toStreamRecordV2(streamRecord); }); }
@Test public void testToStreamRecordV2WhenNewImageIsNull() { com.amazonaws.services.lambda.runtime.events.models.dynamodb.StreamRecord streamRecord = streamRecord_event.clone(); streamRecord.setNewImage(null); Assertions.assertDoesNotThrow(() -> { DynamodbStreamRecordTransformer.toStreamRecordV2(streamRecord); }); }