TemplateProcessorGroovyImpl implements TemplateProcessor { Locale lazyLoad(final String lang) { if (lang == null) { return null; } return this.localeCache.computeIfAbsent(lang, Locale::new); } TemplateProcessorGroovyImpl(final TemplateSupport templateSupport); @Override boolean supports(final String template, final String locale, final Map<String, Object> context); @Override String processTemplate(final String template, final String locale, final Map<String, Object> context); @Override void registerFunction(final String name, final FunctionProvider functionProvider);  }
@Test public void lazyLoad() throws Exception { final TemplateProcessorGroovyImpl support = new TemplateProcessorGroovyImpl(null); final Locale locale = support.lazyLoad("en"); assertNotNull(locale); assertEquals("en", locale.getLanguage()); assertSame(locale, support.lazyLoad("en")); }