VideoTitleCleaner implements MetadataTransform { @Override public Track transform(Track track) { String title = track.track(); for (String replacement : REPLACEMENTS) { title = title.replaceAll(replacement, ""); } return track.toBuilder().track(title).build(); }  @Override Track transform(Track track);  }
@Test public void trimsLeadingTrailingWhitespace() { String title = "Some Track (with details)"; String input = String.format(" %s ", title); Track result = transform.transform(Track.builder().track(input).artist("").build()); assertThat(result.track()).isEqualTo(title); }