DynamodbRecordTransformer { public static Record toRecordV2(final DynamodbEvent.DynamodbStreamRecord record) { return Record.builder() .awsRegion(record.getAwsRegion()) .dynamodb( DynamodbStreamRecordTransformer.toStreamRecordV2(record.getDynamodb()) ) .eventID(record.getEventID()) .eventName(record.getEventName()) .eventSource(record.getEventSource()) .eventVersion(record.getEventVersion()) .userIdentity( record.getUserIdentity() != null ? DynamodbIdentityTransformer.toIdentityV2(record.getUserIdentity()) : null ) .build(); }  static Record toRecordV2(final DynamodbEvent.DynamodbStreamRecord record);  }
@Test public void testToRecordV2() { Record convertedRecord = DynamodbRecordTransformer.toRecordV2(record_event); Assertions.assertEquals(record_v2, convertedRecord); }
@Test public void testToRecordV2WhenUserIdentityIsNull() { DynamodbEvent.DynamodbStreamRecord record = record_event.clone(); record.setUserIdentity(null); Assertions.assertDoesNotThrow(() -> { DynamodbRecordTransformer.toRecordV2(record); }); }