@Test(dataProvider = "fileResourceDP") public void testGetFileResource(String basePath, String fileName, String fileExtension, boolean shouldExist) throws Exception { final TemplateHelper testling = TemplateHelper.instance(basePath, UTF_8); final Resource fileResource = testling.getFileResource(fileName, fileExtension); Assert.assertEquals(shouldExist, fileResource.exists()); }
public Resource getFileResource(String resourcePath, String resourceExtension) { String adaptedFileExtension = resourceExtension; if (StringUtils.hasLength(resourceExtension) && !StringUtils.startsWithIgnoreCase(resourceExtension, ".")) { adaptedFileExtension = "." + resourceExtension; } return new ClassPathResource(basePath + resourcePath + adaptedFileExtension); }
TemplateHelper { public Resource getFileResource(String resourcePath, String resourceExtension) { String adaptedFileExtension = resourceExtension; if (StringUtils.hasLength(resourceExtension) && !StringUtils.startsWithIgnoreCase(resourceExtension, ".")) { adaptedFileExtension = "." + resourceExtension; } return new ClassPathResource(basePath + resourcePath + adaptedFileExtension); } }
TemplateHelper { public Resource getFileResource(String resourcePath, String resourceExtension) { String adaptedFileExtension = resourceExtension; if (StringUtils.hasLength(resourceExtension) && !StringUtils.startsWithIgnoreCase(resourceExtension, ".")) { adaptedFileExtension = "." + resourceExtension; } return new ClassPathResource(basePath + resourcePath + adaptedFileExtension); } private  TemplateHelper(String basePath, Charset charset); }
TemplateHelper { public Resource getFileResource(String resourcePath, String resourceExtension) { String adaptedFileExtension = resourceExtension; if (StringUtils.hasLength(resourceExtension) && !StringUtils.startsWithIgnoreCase(resourceExtension, ".")) { adaptedFileExtension = "." + resourceExtension; } return new ClassPathResource(basePath + resourcePath + adaptedFileExtension); } private  TemplateHelper(String basePath, Charset charset); static TemplateHelper instance(String basePath, Charset charset); static TemplateHelper instance(String basePath); String getXmlMessageTemplate(String templatePath); String getJsonMessageTemplate(String templatePath); String getMessageTemplate(String templatePath, String templateExtension); Resource getFileResource(String resourcePath, String resourceExtension); }
TemplateHelper { public Resource getFileResource(String resourcePath, String resourceExtension) { String adaptedFileExtension = resourceExtension; if (StringUtils.hasLength(resourceExtension) && !StringUtils.startsWithIgnoreCase(resourceExtension, ".")) { adaptedFileExtension = "." + resourceExtension; } return new ClassPathResource(basePath + resourcePath + adaptedFileExtension); } private  TemplateHelper(String basePath, Charset charset); static TemplateHelper instance(String basePath, Charset charset); static TemplateHelper instance(String basePath); String getXmlMessageTemplate(String templatePath); String getJsonMessageTemplate(String templatePath); String getMessageTemplate(String templatePath, String templateExtension); Resource getFileResource(String resourcePath, String resourceExtension);  }