### Question:
Scaffolder { public void scaffold() throws IOException, ScaffoldingException { try { Map<String, Template> mapping = loadMapping(); for (Map.Entry<String, Template> entry : mapping.entrySet()) { String s = entry.getKey(); Template template = entry.getValue(); Path path = baseDirectory.resolve(s); Path parentDirectory = path.getParent(); Files.createDirectories(parentDirectory); writeFile(path, template); } } catch (TemplateException e) { throw new ScaffoldingException("error processing template", e); } } Scaffolder(TemplateSet templateSet, Map<String, Object> configuration); TemplateSet getTemplateSet(); void setTemplateSet(TemplateSet templateSet); Map<String, Object> getConfiguration(); void setConfiguration(Map<String, Object> configuration); void scaffold(); Path getBaseDirectory(); void setBaseDirectory(Path baseDirectory); String getMappingTemplatePath(); void setMappingTemplatePath(String mappingTemplatePath);  }### Answer:
@Test public void scaffold() throws Exception { final String DEFAULT_MAPPING_TEMPLATE_PATH = "mapping.yml.ftl"; Map<String, Template> templates = new HashMap<>(); templates.put("example.txt.ftl", configuration.getTemplate("example.txt.ftl")); templates.put(DEFAULT_MAPPING_TEMPLATE_PATH, configuration.getTemplate(DEFAULT_MAPPING_TEMPLATE_PATH)); List<Variable> variables = Collections.singletonList(new Variable("name")); TemplateSet templateSet = new TemplateSet(templates, variables); Map<String, Object> configuration = Collections.singletonMap("name", "world"); Scaffolder scaffolder = new Scaffolder(templateSet, configuration); assertSame(templateSet, scaffolder.getTemplateSet()); assertSame(configuration, scaffolder.getConfiguration()); scaffolder.setTemplateSet(templateSet); scaffolder.setConfiguration(configuration); assertSame(templateSet, scaffolder.getTemplateSet()); assertSame(configuration, scaffolder.getConfiguration()); scaffolder.setBaseDirectory(baseDirectory); assertEquals(baseDirectory, scaffolder.getBaseDirectory()); scaffolder.setMappingTemplatePath(DEFAULT_MAPPING_TEMPLATE_PATH); assertEquals(DEFAULT_MAPPING_TEMPLATE_PATH, scaffolder.getMappingTemplatePath()); scaffolder.scaffold(); assertEquals("Hello, world!\n", new String(Files.readAllBytes(baseDirectory.resolve("hello.world.txt")))); }