@Test(dataProvider = "getTemplatePathDP") public void getTemplatePath(String converterName, String expectedTemplate) throws Exception { String expectedTemplatePath = tmp_output_builder_test.toString() + File.separator + expectedTemplate; Path expectedFile = Paths.get(expectedTemplatePath); Files.createDirectory(expectedFile.getParent()); Files.createFile(expectedFile); doReturn(tmp_output_builder_test.toString()).when(sakuliProperties).getForwarderTemplateFolder(); doReturn(converterName).when(testling).getConverterName(); assertEquals(testling.getTemplatePath().toString(), expectedTemplatePath); }
protected Path getTemplatePath() throws FileNotFoundException { String templateFolder = sakuliProperties.getForwarderTemplateFolder(); Path templatePath = Paths.get( templateFolder + File.separator + getConverterName().toLowerCase() + File.separator + MAIN_TEMPLATE_NAME) .normalize().toAbsolutePath(); if (Files.notExists(templatePath)) { throw new FileNotFoundException(String.format("JTwig template folder for %s could not be found under '%s'", getConverterName(), templatePath.toString())); } logger.debug(String.format("Load JTwig template from following location: '%s'", templatePath)); return templatePath; }
AbstractTemplateOutputBuilder extends AbstractOutputBuilder { protected Path getTemplatePath() throws FileNotFoundException { String templateFolder = sakuliProperties.getForwarderTemplateFolder(); Path templatePath = Paths.get( templateFolder + File.separator + getConverterName().toLowerCase() + File.separator + MAIN_TEMPLATE_NAME) .normalize().toAbsolutePath(); if (Files.notExists(templatePath)) { throw new FileNotFoundException(String.format("JTwig template folder for %s could not be found under '%s'", getConverterName(), templatePath.toString())); } logger.debug(String.format("Load JTwig template from following location: '%s'", templatePath)); return templatePath; } }
AbstractTemplateOutputBuilder extends AbstractOutputBuilder { protected Path getTemplatePath() throws FileNotFoundException { String templateFolder = sakuliProperties.getForwarderTemplateFolder(); Path templatePath = Paths.get( templateFolder + File.separator + getConverterName().toLowerCase() + File.separator + MAIN_TEMPLATE_NAME) .normalize().toAbsolutePath(); if (Files.notExists(templatePath)) { throw new FileNotFoundException(String.format("JTwig template folder for %s could not be found under '%s'", getConverterName(), templatePath.toString())); } logger.debug(String.format("Load JTwig template from following location: '%s'", templatePath)); return templatePath; }  }
AbstractTemplateOutputBuilder extends AbstractOutputBuilder { protected Path getTemplatePath() throws FileNotFoundException { String templateFolder = sakuliProperties.getForwarderTemplateFolder(); Path templatePath = Paths.get( templateFolder + File.separator + getConverterName().toLowerCase() + File.separator + MAIN_TEMPLATE_NAME) .normalize().toAbsolutePath(); if (Files.notExists(templatePath)) { throw new FileNotFoundException(String.format("JTwig template folder for %s could not be found under '%s'", getConverterName(), templatePath.toString())); } logger.debug(String.format("Load JTwig template from following location: '%s'", templatePath)); return templatePath; }  abstract String getConverterName(); abstract Map<TemplateModelEntityName, Object> getSpecificModelEntities(); String createOutput(AbstractTestDataEntity abstractTestDataEntity); }
AbstractTemplateOutputBuilder extends AbstractOutputBuilder { protected Path getTemplatePath() throws FileNotFoundException { String templateFolder = sakuliProperties.getForwarderTemplateFolder(); Path templatePath = Paths.get( templateFolder + File.separator + getConverterName().toLowerCase() + File.separator + MAIN_TEMPLATE_NAME) .normalize().toAbsolutePath(); if (Files.notExists(templatePath)) { throw new FileNotFoundException(String.format("JTwig template folder for %s could not be found under '%s'", getConverterName(), templatePath.toString())); } logger.debug(String.format("Load JTwig template from following location: '%s'", templatePath)); return templatePath; }  abstract String getConverterName(); abstract Map<TemplateModelEntityName, Object> getSpecificModelEntities(); String createOutput(AbstractTestDataEntity abstractTestDataEntity); static final String MAIN_TEMPLATE_NAME; }