@Test public void throwsIllegalArgumentExceptionIfTemplatesWithTheSameNameAlreadyRegistered() { xsltTemplatesContextResolver.addTemplates("templates 1", mock(Templates.class)); thrown.expect(IllegalArgumentException.class); xsltTemplatesContextResolver.addTemplates("templates 1", mock(Templates.class)); }
public void addTemplates(String name, Templates templates) { if (templatesMap.putIfAbsent(name, templates) != null) { throw new IllegalArgumentException(String.format("Template with name '%s' already registered", name)); } }
XSLTTemplatesContextResolver implements ContextResolver<XSLTTemplatesContextResolver> { public void addTemplates(String name, Templates templates) { if (templatesMap.putIfAbsent(name, templates) != null) { throw new IllegalArgumentException(String.format("Template with name '%s' already registered", name)); } } }
XSLTTemplatesContextResolver implements ContextResolver<XSLTTemplatesContextResolver> { public void addTemplates(String name, Templates templates) { if (templatesMap.putIfAbsent(name, templates) != null) { throw new IllegalArgumentException(String.format("Template with name '%s' already registered", name)); } } XSLTTemplatesContextResolver(TemplatesParser templatesParser); }
XSLTTemplatesContextResolver implements ContextResolver<XSLTTemplatesContextResolver> { public void addTemplates(String name, Templates templates) { if (templatesMap.putIfAbsent(name, templates) != null) { throw new IllegalArgumentException(String.format("Template with name '%s' already registered", name)); } } XSLTTemplatesContextResolver(TemplatesParser templatesParser); @Override XSLTTemplatesContextResolver getContext(Class<?> type); void addAsTemplate(String name, Source source); void addTemplates(String name, Templates templates); void removeTemplates(String name); Templates getTemplates(String name); }
XSLTTemplatesContextResolver implements ContextResolver<XSLTTemplatesContextResolver> { public void addTemplates(String name, Templates templates) { if (templatesMap.putIfAbsent(name, templates) != null) { throw new IllegalArgumentException(String.format("Template with name '%s' already registered", name)); } } XSLTTemplatesContextResolver(TemplatesParser templatesParser); @Override XSLTTemplatesContextResolver getContext(Class<?> type); void addAsTemplate(String name, Source source); void addTemplates(String name, Templates templates); void removeTemplates(String name); Templates getTemplates(String name);  }