FilterByFileFormatterStep implements FormatterStep { @Override public @Nullable String format(String raw, File file) throws Exception { Objects.requireNonNull(raw, "raw"); Objects.requireNonNull(file, "file"); if (filter.accept(file)) { return delegateStep.format(raw, file); } else { return raw; } } FilterByFileFormatterStep(FormatterStep delegateStep, SerializableFileFilter filter); @Override String getName(); @Override @Nullable String format(String raw, File file); @Override boolean equals(Object o); @Override int hashCode();  }
@Test public void behavior() throws Exception { FormatterStep underTest = ReplaceStep.create("makeSpaceA", " ", "a") .filterByFile(SerializableFileFilter.skipFilesNamed("dontFormat")); assertThat(underTest.format(" ", new File("someFileName"))).isEqualTo("a"); assertThat(underTest.format(" ", new File("dontFormat"))).isEqualTo(" "); }