public void testVelocityConfigurer() throws IOException, VelocityException {
   VelocityConfigurer vc = new VelocityConfigurer();
   vc.setResourceLoaderPath("file:/mydir");
   vc.afterPropertiesSet();
   assertThat(vc.createVelocityEngine(), instanceOf(VelocityEngine.class));
   VelocityEngine ve = vc.createVelocityEngine();
   assertEquals(
       new File("/mydir").getAbsolutePath(),
       ve.getProperty(VelocityEngine.FILE_RESOURCE_LOADER_PATH));
 }
 @Bean
 public VelocityConfig velocityConfig() {
   Map<String, Object> velocityProperties = new HashMap<>();
   velocityProperties.put("eventhandler.include.class", IncludeRelativePath.class.getName());
   velocityProperties.put("input.encoding", "utf-8");
   velocityProperties.put("output.encoding", "utf-8");
   VelocityConfigurer cfg = new VelocityConfigurer();
   cfg.setResourceLoaderPath("/WEB-INF/views/");
   cfg.setVelocityPropertiesMap(velocityProperties);
   return cfg;
 }
  public void testVelocityConfigurerWithCsvPathAndNonFileAccess()
      throws IOException, VelocityException {
    VelocityConfigurer vc = new VelocityConfigurer();
    vc.setResourceLoaderPath("file:/mydir,file:/yourdir");
    vc.setResourceLoader(
        new ResourceLoader() {
          @Override
          public Resource getResource(String location) {
            if ("file:/yourdir/test".equals(location)) {
              return new DescriptiveResource("");
            }
            return new ByteArrayResource("test".getBytes(), "test");
          }

          @Override
          public ClassLoader getClassLoader() {
            return getClass().getClassLoader();
          }
        });
    vc.setPreferFileSystemAccess(false);
    vc.afterPropertiesSet();
    assertThat(vc.createVelocityEngine(), instanceOf(VelocityEngine.class));
    VelocityEngine ve = vc.createVelocityEngine();
    assertEquals("test", VelocityEngineUtils.mergeTemplateIntoString(ve, "test", new HashMap()));
  }