TemplateResource (final String templateName) { Collection<TemplateResource> templates = ToStringTemplatesManager.getInstance().getAllTemplates(); TemplateResource template = ContainerUtil.find(templates, x -> x.getFileName().equals(templateName)); assertNotNull(template); return template; }