PrefixFileNameGenerator implements FileNameGenerator { @Override public String generate(String imageUri) { if (imageUri == null) { return null; } return addPrefix(imageUri); } PrefixFileNameGenerator(FileNameGenerator delegate);  PrefixFileNameGenerator(FileNameGenerator delegate, String prefix); @Override String generate(String imageUri);  }
@Test public void shouldReturnExpectedFileNameWhenGenerating() { FileNameGenerator wrapper = new PrefixFileNameGenerator(delegate, TEST_PREFIX); String imageUri = "https: String filename = delegate.generate(imageUri); String wrapperFilename = wrapper.generate(imageUri); String expected = TEST_PREFIX + filename; assertThat(wrapperFilename, is(expected)); }
@Test public void shouldReturnNullWhenImageUriNull() { FileNameGenerator wrapper = new PrefixFileNameGenerator(delegate, TEST_PREFIX); String wrapperFilename = wrapper.generate(null); assertThat(wrapperFilename, is(nullValue())); }