@Test public void shouldTruncateCreatorNamesWhenItIsNotNull() { DataSetReference source = createDataSetReference(); List<CharSequence> creatorNames = Collections.singletonList("creator name"); source.setCreatorNames(creatorNames); List<CharSequence> truncated = Collections.singletonList("truncated"); when(creatorNamesTruncator.apply(creatorNames)).thenReturn(truncated); DataSetReference result = dataSetReferenceAvroTruncator.truncate(source); assertEquals(truncated, result.getCreatorNames()); }
@Override public DataSetReference truncate(DataSetReference source) { if (Objects.nonNull(source.getCreatorNames())) { source.setCreatorNames(creatorNamesTruncator.apply(source.getCreatorNames())); } if (Objects.nonNull(source.getTitles())) { source.setTitles(titlesTruncator.apply(source.getTitles())); } if (Objects.nonNull(source.getDescription())) { source.setDescription(descriptionTruncator.apply(source.getDescription())); } return source; }
DataSetReferenceAvroTruncator implements AvroTruncator<DataSetReference> { @Override public DataSetReference truncate(DataSetReference source) { if (Objects.nonNull(source.getCreatorNames())) { source.setCreatorNames(creatorNamesTruncator.apply(source.getCreatorNames())); } if (Objects.nonNull(source.getTitles())) { source.setTitles(titlesTruncator.apply(source.getTitles())); } if (Objects.nonNull(source.getDescription())) { source.setDescription(descriptionTruncator.apply(source.getDescription())); } return source; } }
DataSetReferenceAvroTruncator implements AvroTruncator<DataSetReference> { @Override public DataSetReference truncate(DataSetReference source) { if (Objects.nonNull(source.getCreatorNames())) { source.setCreatorNames(creatorNamesTruncator.apply(source.getCreatorNames())); } if (Objects.nonNull(source.getTitles())) { source.setTitles(titlesTruncator.apply(source.getTitles())); } if (Objects.nonNull(source.getDescription())) { source.setDescription(descriptionTruncator.apply(source.getDescription())); } return source; } private  DataSetReferenceAvroTruncator(int maxCreatorNamesSize,
                                          int maxCreatorNameLength,
                                          int maxTitlesSize,
                                          int maxTitleLength,
                                          int maxDescriptionLength); }
DataSetReferenceAvroTruncator implements AvroTruncator<DataSetReference> { @Override public DataSetReference truncate(DataSetReference source) { if (Objects.nonNull(source.getCreatorNames())) { source.setCreatorNames(creatorNamesTruncator.apply(source.getCreatorNames())); } if (Objects.nonNull(source.getTitles())) { source.setTitles(titlesTruncator.apply(source.getTitles())); } if (Objects.nonNull(source.getDescription())) { source.setDescription(descriptionTruncator.apply(source.getDescription())); } return source; } private  DataSetReferenceAvroTruncator(int maxCreatorNamesSize,
                                          int maxCreatorNameLength,
                                          int maxTitlesSize,
                                          int maxTitleLength,
                                          int maxDescriptionLength); @Override DataSetReference truncate(DataSetReference source); static Builder newBuilder(); }
DataSetReferenceAvroTruncator implements AvroTruncator<DataSetReference> { @Override public DataSetReference truncate(DataSetReference source) { if (Objects.nonNull(source.getCreatorNames())) { source.setCreatorNames(creatorNamesTruncator.apply(source.getCreatorNames())); } if (Objects.nonNull(source.getTitles())) { source.setTitles(titlesTruncator.apply(source.getTitles())); } if (Objects.nonNull(source.getDescription())) { source.setDescription(descriptionTruncator.apply(source.getDescription())); } return source; } private  DataSetReferenceAvroTruncator(int maxCreatorNamesSize,
                                          int maxCreatorNameLength,
                                          int maxTitlesSize,
                                          int maxTitleLength,
                                          int maxDescriptionLength); @Override DataSetReference truncate(DataSetReference source); static Builder newBuilder();  }