### Question:
VerifyingFileFactory { public File create(String path) { File file = new File(path); return validate(file); } VerifyingFileFactory(Builder builder); File create(String path); File validate(File file);  }### Answer:
@Test public void testForWarningOnRelativePath() { VerifyingFileFactory vff = new VerifyingFileFactory.Builder(log).warnForRelativePath().build(); vff.create("a/relative/path"); }
@Test public void testForNoWarningOnIntendedRelativePath() { VerifyingFileFactory vff = new VerifyingFileFactory.Builder(log).warnForRelativePath().build(); vff.create("./an/intended/relative/path"); }
@Test public void testForFailForNonExistingPath() { assertThrows(IllegalArgumentException.class, () -> { VerifyingFileFactory vff = new VerifyingFileFactory.Builder(log).failForNonExistingPath().build(); vff.create("/I/H0p3/this/path/d035/n0t/ex15t"); }); }
@Test public void testFileHasCorrectPath() { File file = new File("/some/path"); VerifyingFileFactory vff = new VerifyingFileFactory.Builder(log).build(); assertEquals(file, vff.create(file.getPath())); }