### Question:
TemplateManager implements TemplatingExecutor, TemplateProcessor { @SuppressWarnings({"squid:S2095", "java:S112"}) public Reader getTemplateReader(String name) { try { InputStream is = getInputStream(name); return new InputStreamReader(is, StandardCharsets.UTF_8); } catch (FileNotFoundException e) { LOGGER.error(e.getMessage()); throw new RuntimeException("can't load template " + name); } } TemplateManager(
            TemplateManagerOptions options,
            TemplatingEngineAdapter engineAdapter,
            TemplatePathLocator[] templateLoaders); @Override String getFullTemplateContents(String name); @Override Path getFullTemplatePath(String name); static String getCPResourcePath(final String name); @SuppressWarnings({"java:S112"}) // ignored rule java:S112 as RuntimeException is used to match previous exception type String readTemplate(String name); @SuppressWarnings({"squid:S2095", "java:S112"}) // ignored rule squid:S2095 as used in the CLI and it's required to return a reader // ignored rule java:S112 as RuntimeException is used to match previous exception type Reader getTemplateReader(String name); @Override File write(Map<String, Object> data, String template, File target); @Override void ignore(Path path, String context); @Override void skip(Path path, String context); File writeToFile(String filename, String contents); File writeToFile(String filename, byte[] contents);  }### Answer:
@Test public void getTemplateReader(){ TemplateManagerOptions opts = new TemplateManagerOptions(false,false); TemplateManager manager = new TemplateManager(opts, mustacheEngineAdapter, new TemplatePathLocator[]{ locator }); assertTrue(manager.getTemplateReader("templating/templates/simple.mustache") instanceof InputStreamReader); }
@Test(expectedExceptions = IllegalArgumentException.class, expectedExceptionsMessageRegExp = "Template location must be constrained to template directory\\.") public void getTemplateReaderThrowsForEscapingTemplates(){ TemplateManagerOptions opts = new TemplateManagerOptions(false,false); TemplateManager manager = new TemplateManager(opts, mustacheEngineAdapter, new TemplatePathLocator[]{ locator }); manager.getTemplateReader("../templating/templates/simple.mustache"); fail("Expected an exception that did not occur"); }