You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@freemarker.apache.org by dd...@apache.org on 2015/12/19 17:51:16 UTC

[3/8] incubator-freemarker git commit: The new (in 2.3.24-pre01) TemplateConfigurer class was renamed to TemplateConfiguration, and the related configuration setting from template_configurers to template_configurations. Also, the TemplateConfigurer.confi

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/ea5c47d1/src/test/java/freemarker/core/TemplateConfigurerTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/freemarker/core/TemplateConfigurerTest.java b/src/test/java/freemarker/core/TemplateConfigurerTest.java
deleted file mode 100644
index 382bdf0..0000000
--- a/src/test/java/freemarker/core/TemplateConfigurerTest.java
+++ /dev/null
@@ -1,846 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- * 
- *   http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package freemarker.core;
-
-import static org.hamcrest.Matchers.*;
-import static org.junit.Assert.*;
-
-import java.beans.BeanInfo;
-import java.beans.IntrospectionException;
-import java.beans.Introspector;
-import java.beans.PropertyDescriptor;
-import java.io.IOException;
-import java.io.StringReader;
-import java.io.StringWriter;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Locale;
-import java.util.Map;
-import java.util.Set;
-import java.util.TimeZone;
-
-import org.junit.Test;
-
-import com.google.common.collect.ImmutableMap;
-
-import freemarker.template.Configuration;
-import freemarker.template.SimpleObjectWrapper;
-import freemarker.template.Template;
-import freemarker.template.TemplateException;
-import freemarker.template.TemplateExceptionHandler;
-import freemarker.template.Version;
-import freemarker.template.utility.NullArgumentException;
-
-@SuppressWarnings("boxing")
-public class TemplateConfigurerTest {
-
-    private final class DummyArithmeticEngine extends ArithmeticEngine {
-
-        @Override
-        public int compareNumbers(Number first, Number second) throws TemplateException {
-            return 0;
-        }
-
-        @Override
-        public Number add(Number first, Number second) throws TemplateException {
-            return 22;
-        }
-
-        @Override
-        public Number subtract(Number first, Number second) throws TemplateException {
-            return null;
-        }
-
-        @Override
-        public Number multiply(Number first, Number second) throws TemplateException {
-            return 33;
-        }
-
-        @Override
-        public Number divide(Number first, Number second) throws TemplateException {
-            return null;
-        }
-
-        @Override
-        public Number modulus(Number first, Number second) throws TemplateException {
-            return null;
-        }
-
-        @Override
-        public Number toNumber(String s) {
-            return 11;
-        }
-    }
-
-    private static final Version ICI = Configuration.VERSION_2_3_22;
-
-    private static final Configuration DEFAULT_CFG = new Configuration(ICI);
-
-    private static final TimeZone NON_DEFAULT_TZ;
-    static {
-        TimeZone defaultTZ = DEFAULT_CFG.getTimeZone();
-        TimeZone tz = TimeZone.getTimeZone("UTC");
-        if (tz.equals(defaultTZ)) {
-            tz = TimeZone.getTimeZone("GMT+01");
-            if (tz.equals(defaultTZ)) {
-                throw new AssertionError("Couldn't chose a non-default time zone");
-            }
-        }
-        NON_DEFAULT_TZ = tz;
-    }
-
-    private static final Locale NON_DEFAULT_LOCALE;
-    static {
-        Locale defaultLocale = DEFAULT_CFG.getLocale();
-        Locale locale = Locale.GERMAN;
-        if (locale.equals(defaultLocale)) {
-            locale = Locale.US;
-            if (locale.equals(defaultLocale)) {
-                throw new AssertionError("Couldn't chose a non-default locale");
-            }
-        }
-        NON_DEFAULT_LOCALE = locale;
-    }
-
-    private static final String NON_DEFAULT_ENCODING;
-
-    static {
-        String defaultEncoding = DEFAULT_CFG.getDefaultEncoding();
-        String encoding = "UTF-16";
-        if (encoding.equals(defaultEncoding)) {
-            encoding = "UTF-8";
-            if (encoding.equals(defaultEncoding)) {
-                throw new AssertionError("Couldn't chose a non-default locale");
-            }
-        }
-        NON_DEFAULT_ENCODING = encoding;
-    }
-    
-    private static final Map<String, Object> SETTING_ASSIGNMENTS;
-
-    static {
-        SETTING_ASSIGNMENTS = new HashMap<String, Object>();
-
-        // "Configurable" settings:
-        SETTING_ASSIGNMENTS.put("APIBuiltinEnabled", true);
-        SETTING_ASSIGNMENTS.put("SQLDateAndTimeTimeZone", NON_DEFAULT_TZ);
-        SETTING_ASSIGNMENTS.put("URLEscapingCharset", "utf-16");
-        SETTING_ASSIGNMENTS.put("autoFlush", false);
-        SETTING_ASSIGNMENTS.put("booleanFormat", "J,N");
-        SETTING_ASSIGNMENTS.put("classicCompatibleAsInt", 2);
-        SETTING_ASSIGNMENTS.put("dateFormat", "yyyy-#DDD");
-        SETTING_ASSIGNMENTS.put("dateTimeFormat", "yyyy-#DDD-@HH:mm");
-        SETTING_ASSIGNMENTS.put("locale", NON_DEFAULT_LOCALE);
-        SETTING_ASSIGNMENTS.put("logTemplateExceptions", false);
-        SETTING_ASSIGNMENTS.put("newBuiltinClassResolver", TemplateClassResolver.ALLOWS_NOTHING_RESOLVER);
-        SETTING_ASSIGNMENTS.put("numberFormat", "0.0000");
-        SETTING_ASSIGNMENTS.put("objectWrapper", new SimpleObjectWrapper(ICI));
-        SETTING_ASSIGNMENTS.put("outputEncoding", "utf-16");
-        SETTING_ASSIGNMENTS.put("showErrorTips", false);
-        SETTING_ASSIGNMENTS.put("templateExceptionHandler", TemplateExceptionHandler.IGNORE_HANDLER);
-        SETTING_ASSIGNMENTS.put("timeFormat", "@HH:mm");
-        SETTING_ASSIGNMENTS.put("timeZone", NON_DEFAULT_TZ);
-        SETTING_ASSIGNMENTS.put("arithmeticEngine", ArithmeticEngine.CONSERVATIVE_ENGINE);
-        SETTING_ASSIGNMENTS.put("customNumberFormats",
-                ImmutableMap.of("dummy", HexTemplateNumberFormatFactory.INSTANCE));
-        SETTING_ASSIGNMENTS.put("customDateFormats",
-                ImmutableMap.of("dummy", EpochMillisTemplateDateFormatFactory.INSTANCE));
-
-        // Parser-only settings:
-        SETTING_ASSIGNMENTS.put("tagSyntax", Configuration.SQUARE_BRACKET_TAG_SYNTAX);
-        SETTING_ASSIGNMENTS.put("namingConvention", Configuration.LEGACY_NAMING_CONVENTION);
-        SETTING_ASSIGNMENTS.put("whitespaceStripping", false);
-        SETTING_ASSIGNMENTS.put("strictSyntaxMode", false);
-        SETTING_ASSIGNMENTS.put("autoEscapingPolicy", Configuration.DISABLE_AUTO_ESCAPING_POLICY);
-        SETTING_ASSIGNMENTS.put("outputFormat", HTMLOutputFormat.INSTANCE);
-        SETTING_ASSIGNMENTS.put("recognizeStandardFileExtensions", true);
-        
-        // Special settings:
-        SETTING_ASSIGNMENTS.put("encoding", NON_DEFAULT_ENCODING);
-    }
-    
-    public static String getIsSetMethodName(String readMethodName) {
-        String isSetMethodName = (readMethodName.startsWith("get") ? "is" + readMethodName.substring(3)
-                : readMethodName)
-                + "Set";
-        if (isSetMethodName.equals("isClassicCompatibleAsIntSet")) {
-            isSetMethodName = "isClassicCompatibleSet";
-        }
-        return isSetMethodName;
-    }
-
-    public static List<PropertyDescriptor> getTemplateConfigurerSettingPropDescs(
-            boolean includeCompilerSettings, boolean includeSpecialSettings)
-            throws IntrospectionException {
-        List<PropertyDescriptor> settingPropDescs = new ArrayList<PropertyDescriptor>();
-
-        BeanInfo beanInfo = Introspector.getBeanInfo(TemplateConfigurer.class);
-        for (PropertyDescriptor pd : beanInfo.getPropertyDescriptors()) {
-            String name = pd.getName();
-            if (pd.getWriteMethod() != null && !IGNORED_PROP_NAMES.contains(name)
-                    && (includeCompilerSettings
-                            || (CONFIGURABLE_PROP_NAMES.contains(name) || !PARSER_PROP_NAMES.contains(name)))
-                    && (includeSpecialSettings
-                            || !SPECIAL_PROP_NAMES.contains(name))) {
-                if (pd.getReadMethod() == null) {
-                    throw new AssertionError("Property has no read method: " + pd);
-                }
-                settingPropDescs.add(pd);
-            }
-        }
-
-        Collections.sort(settingPropDescs, new Comparator<PropertyDescriptor>() {
-
-            public int compare(PropertyDescriptor o1, PropertyDescriptor o2) {
-                return o1.getName().compareToIgnoreCase(o2.getName());
-            }
-        });
-
-        return settingPropDescs;
-    }
-
-    private static final Set<String> IGNORED_PROP_NAMES;
-
-    static {
-        IGNORED_PROP_NAMES = new HashSet();
-        IGNORED_PROP_NAMES.add("class");
-        IGNORED_PROP_NAMES.add("strictBeanModels");
-        IGNORED_PROP_NAMES.add("parentConfiguration");
-        IGNORED_PROP_NAMES.add("settings");
-        IGNORED_PROP_NAMES.add("classicCompatible");
-    }
-
-    private static final Set<String> CONFIGURABLE_PROP_NAMES;
-    static {
-        CONFIGURABLE_PROP_NAMES = new HashSet<String>();
-        try {
-            for (PropertyDescriptor propDesc : Introspector.getBeanInfo(Configurable.class).getPropertyDescriptors()) {
-                String propName = propDesc.getName();
-                if (!IGNORED_PROP_NAMES.contains(propName)) {
-                    CONFIGURABLE_PROP_NAMES.add(propName);
-                }
-            }
-        } catch (IntrospectionException e) {
-            throw new IllegalStateException("Failed to init static field", e);
-        }
-    }
-    
-    private static final Set<String> PARSER_PROP_NAMES;
-    static {
-        PARSER_PROP_NAMES = new HashSet<String>();
-        // It's an interface; can't use standard Inrospector
-        for (Method m : ParserConfiguration.class.getMethods()) {
-            String propertyName;
-            if (m.getName().startsWith("get")) {
-                propertyName = m.getName().substring(3);
-            } else if (m.getName().startsWith("is")) {
-                propertyName = m.getName().substring(2);
-            } else {
-                propertyName = null;
-            }
-            if (propertyName != null) {
-                if (!Character.isUpperCase(propertyName.charAt(1))) {
-                    propertyName = Character.toLowerCase(propertyName.charAt(0)) + propertyName.substring(1);
-                }
-                PARSER_PROP_NAMES.add(propertyName);
-            }
-        }
-    }
-
-    private static final Set<String> SPECIAL_PROP_NAMES;
-    static {
-        SPECIAL_PROP_NAMES = new HashSet<String>();
-        SPECIAL_PROP_NAMES.add("encoding");
-    }
-    
-    private static final CustomAttribute CA1 = new CustomAttribute(CustomAttribute.SCOPE_TEMPLATE); 
-    private static final CustomAttribute CA2 = new CustomAttribute(CustomAttribute.SCOPE_TEMPLATE); 
-    private static final CustomAttribute CA3 = new CustomAttribute(CustomAttribute.SCOPE_TEMPLATE); 
-    private static final CustomAttribute CA4 = new CustomAttribute(CustomAttribute.SCOPE_TEMPLATE); 
-
-    @Test
-    public void testMergeBasicFunctionality() throws Exception {
-        for (PropertyDescriptor propDesc1 : getTemplateConfigurerSettingPropDescs(true, true)) {
-            for (PropertyDescriptor propDesc2 : getTemplateConfigurerSettingPropDescs(true, true)) {
-                TemplateConfigurer tc1 = new TemplateConfigurer();
-                TemplateConfigurer tc2 = new TemplateConfigurer();
-
-                Object value1 = SETTING_ASSIGNMENTS.get(propDesc1.getName());
-                propDesc1.getWriteMethod().invoke(tc1, value1);
-                Object value2 = SETTING_ASSIGNMENTS.get(propDesc2.getName());
-                propDesc2.getWriteMethod().invoke(tc2, value2);
-
-                tc1.merge(tc2);
-                Object mValue1 = propDesc1.getReadMethod().invoke(tc1);
-                Object mValue2 = propDesc2.getReadMethod().invoke(tc1);
-
-                assertEquals("For " + propDesc1.getName(), value1, mValue1);
-                assertEquals("For " + propDesc2.getName(), value2, mValue2);
-            }
-        }
-    }
-    
-    @Test
-    public void testMergeMapSettings() throws Exception {
-        TemplateConfigurer tc1 = new TemplateConfigurer();
-        tc1.setCustomDateFormats(ImmutableMap.of(
-                "epoch", EpochMillisTemplateDateFormatFactory.INSTANCE,
-                "x", LocAndTZSensitiveTemplateDateFormatFactory.INSTANCE));
-        tc1.setCustomNumberFormats(ImmutableMap.of(
-                "hex", HexTemplateNumberFormatFactory.INSTANCE,
-                "x", LocaleSensitiveTemplateNumberFormatFactory.INSTANCE));
-        
-        TemplateConfigurer tc2 = new TemplateConfigurer();
-        tc2.setCustomDateFormats(ImmutableMap.of(
-                "loc", LocAndTZSensitiveTemplateDateFormatFactory.INSTANCE,
-                "x", EpochMillisDivTemplateDateFormatFactory.INSTANCE));
-        tc2.setCustomNumberFormats(ImmutableMap.of(
-                "loc", LocaleSensitiveTemplateNumberFormatFactory.INSTANCE,
-                "x", BaseNTemplateNumberFormatFactory.INSTANCE));
-        
-        tc1.merge(tc2);
-        
-        Map<String, ? extends TemplateDateFormatFactory> mergedCustomDateFormats = tc1.getCustomDateFormats();
-        assertEquals(EpochMillisTemplateDateFormatFactory.INSTANCE, mergedCustomDateFormats.get("epoch"));
-        assertEquals(LocAndTZSensitiveTemplateDateFormatFactory.INSTANCE, mergedCustomDateFormats.get("loc"));
-        assertEquals(EpochMillisDivTemplateDateFormatFactory.INSTANCE, mergedCustomDateFormats.get("x"));
-        
-        Map<String, ? extends TemplateNumberFormatFactory> mergedCustomNumberFormats = tc1.getCustomNumberFormats();
-        assertEquals(HexTemplateNumberFormatFactory.INSTANCE, mergedCustomNumberFormats.get("hex"));
-        assertEquals(LocaleSensitiveTemplateNumberFormatFactory.INSTANCE, mergedCustomNumberFormats.get("loc"));
-        assertEquals(BaseNTemplateNumberFormatFactory.INSTANCE, mergedCustomNumberFormats.get("x"));
-        
-        // Empty map merging optimization:
-        tc1.merge(new TemplateConfigurer());
-        assertSame(mergedCustomDateFormats, tc1.getCustomDateFormats());
-        assertSame(mergedCustomNumberFormats, tc1.getCustomNumberFormats());
-        
-        // Empty map merging optimization:
-        TemplateConfigurer tc3 = new TemplateConfigurer();
-        tc3.merge(tc1);
-        assertSame(mergedCustomDateFormats, tc3.getCustomDateFormats());
-        assertSame(mergedCustomNumberFormats, tc3.getCustomNumberFormats());
-    }
-    
-    @Test
-    public void testMergePriority() throws Exception {
-        TemplateConfigurer tc1 = new TemplateConfigurer();
-        tc1.setDateFormat("1");
-        tc1.setTimeFormat("1");
-        tc1.setDateTimeFormat("1");
-
-        TemplateConfigurer tc2 = new TemplateConfigurer();
-        tc2.setDateFormat("2");
-        tc2.setTimeFormat("2");
-
-        TemplateConfigurer tc3 = new TemplateConfigurer();
-        tc3.setDateFormat("3");
-
-        tc1.merge(tc2);
-        tc1.merge(tc3);
-
-        assertEquals("3", tc1.getDateFormat());
-        assertEquals("2", tc1.getTimeFormat());
-        assertEquals("1", tc1.getDateTimeFormat());
-    }
-    
-    @Test
-    public void testMergeCustomAttributes() throws Exception {
-        TemplateConfigurer tc1 = new TemplateConfigurer();
-        tc1.setCustomAttribute("k1", "v1");
-        tc1.setCustomAttribute("k2", "v1");
-        tc1.setCustomAttribute("k3", "v1");
-        CA1.set("V1", tc1);
-        CA2.set("V1", tc1);
-        CA3.set("V1", tc1);
-
-        TemplateConfigurer tc2 = new TemplateConfigurer();
-        tc2.setCustomAttribute("k1", "v2");
-        tc2.setCustomAttribute("k2", "v2");
-        CA1.set("V2", tc2);
-        CA2.set("V2", tc2);
-
-        TemplateConfigurer tc3 = new TemplateConfigurer();
-        tc3.setCustomAttribute("k1", "v3");
-        CA1.set("V3", tc2);
-
-        tc1.merge(tc2);
-        tc1.merge(tc3);
-
-        assertEquals("v3", tc1.getCustomAttribute("k1"));
-        assertEquals("v2", tc1.getCustomAttribute("k2"));
-        assertEquals("v1", tc1.getCustomAttribute("k3"));
-        assertEquals("V3", CA1.get(tc1));
-        assertEquals("V2", CA2.get(tc1));
-        assertEquals("V1", CA3.get(tc1));
-    }
-    
-    @Test
-    public void testMergeNullCustomAttributes() throws Exception {
-        TemplateConfigurer tc1 = new TemplateConfigurer();
-        tc1.setCustomAttribute("k1", "v1");
-        tc1.setCustomAttribute("k2", "v1");
-        tc1.setCustomAttribute(null, "v1");
-        CA1.set("V1", tc1);
-        CA2.set("V1", tc1);
-        CA3.set(null, tc1);
-        
-        assertEquals("v1", tc1.getCustomAttribute("k1"));
-        assertEquals("v1", tc1.getCustomAttribute("k2"));
-        assertNull("v1", tc1.getCustomAttribute("k3"));
-        assertEquals("V1", CA1.get(tc1));
-        assertEquals("V1", CA2.get(tc1));
-        assertNull(CA3.get(tc1));
-
-        TemplateConfigurer tc2 = new TemplateConfigurer();
-        tc2.setCustomAttribute("k1", "v2");
-        tc2.setCustomAttribute("k2", null);
-        CA1.set("V2", tc2);
-        CA2.set(null, tc2);
-
-        TemplateConfigurer tc3 = new TemplateConfigurer();
-        tc3.setCustomAttribute("k1", null);
-        CA1.set(null, tc2);
-
-        tc1.merge(tc2);
-        tc1.merge(tc3);
-
-        assertNull(tc1.getCustomAttribute("k1"));
-        assertNull(tc1.getCustomAttribute("k2"));
-        assertNull(tc1.getCustomAttribute("k3"));
-        assertNull(CA1.get(tc1));
-        assertNull(CA2.get(tc1));
-        assertNull(CA3.get(tc1));
-        
-        TemplateConfigurer tc4 = new TemplateConfigurer();
-        tc4.setCustomAttribute("k1", "v4");
-        CA1.set("V4", tc4);
-        
-        tc1.merge(tc4);
-        
-        assertEquals("v4", tc1.getCustomAttribute("k1"));
-        assertNull(tc1.getCustomAttribute("k2"));
-        assertNull(tc1.getCustomAttribute("k3"));
-        assertEquals("V4", CA1.get(tc1));
-        assertNull(CA2.get(tc1));
-        assertNull(CA3.get(tc1));
-    }
-
-    @Test
-    public void testConfigureNonParserConfig() throws Exception {
-        for (PropertyDescriptor pd : getTemplateConfigurerSettingPropDescs(false, true)) {
-            TemplateConfigurer tc = new TemplateConfigurer();
-            tc.setParentConfiguration(DEFAULT_CFG);
-    
-            Object newValue = SETTING_ASSIGNMENTS.get(pd.getName());
-            pd.getWriteMethod().invoke(tc, newValue);
-            
-            Template t = new Template(null, "", DEFAULT_CFG);
-            Method tReaderMethod = t.getClass().getMethod(pd.getReadMethod().getName());
-            
-            assertNotEquals("For \"" + pd.getName() + "\"", newValue, tReaderMethod.invoke(t));
-            tc.configure(t);
-            assertEquals("For \"" + pd.getName() + "\"", newValue, tReaderMethod.invoke(t));
-        }
-    }
-    
-    @Test
-    public void testConfigureCustomAttributes() throws Exception {
-        Configuration cfg = new Configuration(Configuration.VERSION_2_3_22);
-        cfg.setCustomAttribute("k1", "c");
-        cfg.setCustomAttribute("k2", "c");
-        cfg.setCustomAttribute("k3", "c");
-
-        TemplateConfigurer tc = new TemplateConfigurer();
-        tc.setCustomAttribute("k2", "tc");
-        tc.setCustomAttribute("k3", null);
-        tc.setCustomAttribute("k4", "tc");
-        tc.setCustomAttribute("k5", "tc");
-        tc.setCustomAttribute("k6", "tc");
-        CA1.set("tc", tc);
-        CA2.set("tc", tc);
-        CA3.set("tc", tc);
-
-        Template t = new Template(null, "", cfg);
-        t.setCustomAttribute("k5", "t");
-        t.setCustomAttribute("k6", null);
-        t.setCustomAttribute("k7", "t");
-        CA2.set("t", t);
-        CA3.set(null, t);
-        CA4.set("t", t);
-        
-        tc.setParentConfiguration(cfg);
-        tc.configure(t);
-        
-        assertEquals("c", t.getCustomAttribute("k1"));
-        assertEquals("tc", t.getCustomAttribute("k2"));
-        assertNull(t.getCustomAttribute("k3"));
-        assertEquals("tc", t.getCustomAttribute("k4"));
-        assertEquals("t", t.getCustomAttribute("k5"));
-        assertNull(t.getCustomAttribute("k6"));
-        assertEquals("t", t.getCustomAttribute("k7"));
-        assertEquals("tc", CA1.get(t));
-        assertEquals("t", CA2.get(t));
-        assertNull(CA3.get(t));
-        assertEquals("t", CA4.get(t));
-    }
-    
-    @Test
-    public void testConfigureParser() throws Exception {
-        Set<String> testedProps = new HashSet<String>();
-        
-        {
-            TemplateConfigurer tc = new TemplateConfigurer();
-            tc.setParentConfiguration(DEFAULT_CFG);
-            tc.setTagSyntax(Configuration.SQUARE_BRACKET_TAG_SYNTAX);
-            assertOutputWithoutAndWithTC(tc, "[#if true]y[/#if]", "[#if true]y[/#if]", "y");
-            testedProps.add(Configuration.TAG_SYNTAX_KEY_CAMEL_CASE);
-        }
-        
-        {
-            TemplateConfigurer tc = new TemplateConfigurer();
-            tc.setParentConfiguration(DEFAULT_CFG);
-            tc.setNamingConvention(Configuration.CAMEL_CASE_NAMING_CONVENTION);
-            assertOutputWithoutAndWithTC(tc, "<#if true>y<#elseif false>n</#if>", "y", null);
-            testedProps.add(Configuration.NAMING_CONVENTION_KEY_CAMEL_CASE);
-        }
-        
-        {
-            TemplateConfigurer tc = new TemplateConfigurer();
-            tc.setParentConfiguration(DEFAULT_CFG);
-            tc.setWhitespaceStripping(false);
-            assertOutputWithoutAndWithTC(tc, "<#if true>\nx\n</#if>\n", "x\n", "\nx\n\n");
-            testedProps.add(Configuration.WHITESPACE_STRIPPING_KEY_CAMEL_CASE);
-        }
-
-        {
-            TemplateConfigurer tc = new TemplateConfigurer();
-            tc.setParentConfiguration(DEFAULT_CFG);
-            tc.setArithmeticEngine(new DummyArithmeticEngine());
-            assertOutputWithoutAndWithTC(tc, "${1} ${1+1}", "1 2", "11 22");
-            testedProps.add(Configuration.ARITHMETIC_ENGINE_KEY_CAMEL_CASE);
-        }
-
-        {
-            TemplateConfigurer tc = new TemplateConfigurer();
-            tc.setParentConfiguration(DEFAULT_CFG);
-            tc.setOutputFormat(XMLOutputFormat.INSTANCE);
-            assertOutputWithoutAndWithTC(tc, "${.outputFormat} ${\"a'b\"}",
-                    UndefinedOutputFormat.INSTANCE.getName() + " a'b",
-                    XMLOutputFormat.INSTANCE.getName() + " a&apos;b");
-            testedProps.add(Configuration.OUTPUT_FORMAT_KEY_CAMEL_CASE);
-        }
-
-        {
-            TemplateConfigurer tc = new TemplateConfigurer();
-            tc.setParentConfiguration(DEFAULT_CFG);
-            tc.setOutputFormat(XMLOutputFormat.INSTANCE);
-            tc.setAutoEscapingPolicy(Configuration.DISABLE_AUTO_ESCAPING_POLICY);
-            assertOutputWithoutAndWithTC(tc, "${'a&b'}", "a&b", "a&b");
-            testedProps.add(Configuration.AUTO_ESCAPING_POLICY_KEY_CAMEL_CASE);
-        }
-        
-        {
-            TemplateConfigurer tc = new TemplateConfigurer();
-            tc.setParentConfiguration(DEFAULT_CFG);
-            tc.setStrictSyntaxMode(false);
-            assertOutputWithoutAndWithTC(tc, "<if true>y</if>", "<if true>y</if>", "y");
-            testedProps.add("strictSyntaxMode");
-        }
-
-        {
-            TemplateConfigurer tc = new TemplateConfigurer();
-            tc.setParentConfiguration(new Configuration(new Version(2, 3, 0)));
-            assertOutputWithoutAndWithTC(tc, "<#foo>", null, "<#foo>");
-            testedProps.add(Configuration.INCOMPATIBLE_IMPROVEMENTS_KEY_CAMEL_CASE);
-        }
-
-
-        {
-            TemplateConfigurer tc = new TemplateConfigurer();
-            tc.setParentConfiguration(new Configuration(new Version(2, 3, 0)));
-            tc.setRecognizeStandardFileExtensions(true);
-            assertOutputWithoutAndWithTC(tc, "${.outputFormat}",
-                    UndefinedOutputFormat.INSTANCE.getName(), HTMLOutputFormat.INSTANCE.getName());
-            testedProps.add(Configuration.RECOGNIZE_STANDARD_FILE_EXTENSIONS_KEY_CAMEL_CASE);
-        }
-        
-        assertEquals("Check that you have tested all parser settings; ", PARSER_PROP_NAMES, testedProps);
-    }
-    
-    @Test
-    public void testConfigureParserTooLowIcI() throws Exception {
-        Configuration cfgWithTooLowIcI = new Configuration(Configuration.VERSION_2_3_21);
-        for (PropertyDescriptor propDesc : getTemplateConfigurerSettingPropDescs(true, false)) {
-            TemplateConfigurer tc = new TemplateConfigurer();
-
-            String propName = propDesc.getName();
-            Object value = SETTING_ASSIGNMENTS.get(propName);
-            propDesc.getWriteMethod().invoke(tc, value);
-            
-            boolean shouldFail;
-            if (CONFIGURABLE_PROP_NAMES.contains(propName)) {
-                shouldFail = true;
-            } else if (PARSER_PROP_NAMES.contains(propName)) {
-                shouldFail = false;
-            } else {
-                fail("Uncategorized property: " + propName);
-                return;
-            }
-            
-            try {
-                tc.setParentConfiguration(cfgWithTooLowIcI);
-                if (shouldFail) {
-                    fail("Should fail with property: " + propName);
-                }
-            } catch (IllegalStateException e) {
-                if (!shouldFail) {
-                    throw e;
-                }
-                assertThat(e.getMessage(), containsString("2.3.22"));
-            }
-        }
-    }
-    
-    @Test
-    public void testArithmeticEngine() throws TemplateException, IOException {
-        TemplateConfigurer tc = new TemplateConfigurer();
-        tc.setParentConfiguration(DEFAULT_CFG);
-        tc.setArithmeticEngine(new DummyArithmeticEngine());
-        assertOutputWithoutAndWithTC(tc,
-                "<#setting locale='en_US'>${1} ${1+1} ${1*3} <#assign x = 1>${x + x} ${x * 3}",
-                "1 2 3 2 3", "11 22 33 22 33");
-        
-        // Doesn't affect template.arithmeticEngine, only affects the parsing:
-        Template t = new Template(null, null, new StringReader(""), DEFAULT_CFG, tc, null);
-        assertEquals(DEFAULT_CFG.getArithmeticEngine(), t.getArithmeticEngine());
-    }
-
-    @Test
-    public void testStringInterpolate() throws TemplateException, IOException {
-        TemplateConfigurer tc = new TemplateConfigurer();
-        tc.setParentConfiguration(DEFAULT_CFG);
-        tc.setArithmeticEngine(new DummyArithmeticEngine());
-        assertOutputWithoutAndWithTC(tc,
-                "<#setting locale='en_US'>${'${1} ${1+1} ${1*3}'} <#assign x = 1>${'${x + x} ${x * 3}'}",
-                "1 2 3 2 3", "11 22 33 22 33");
-        
-        // Doesn't affect template.arithmeticEngine, only affects the parsing:
-        Template t = new Template(null, null, new StringReader(""), DEFAULT_CFG, tc, null);
-        assertEquals(DEFAULT_CFG.getArithmeticEngine(), t.getArithmeticEngine());
-    }
-    
-    @Test
-    public void testInterpret() throws TemplateException, IOException {
-        TemplateConfigurer tc = new TemplateConfigurer();
-        tc.setParentConfiguration(DEFAULT_CFG);
-        tc.setArithmeticEngine(new DummyArithmeticEngine());
-        assertOutputWithoutAndWithTC(tc,
-                "<#setting locale='en_US'><#assign src = r'${1} <#assign x = 1>${x + x}'><@src?interpret />",
-                "1 2", "11 22");
-        
-        tc.setWhitespaceStripping(false);
-        assertOutputWithoutAndWithTC(tc,
-                "<#if true>\nX</#if><#assign src = r'<#if true>\nY</#if>'><@src?interpret />",
-                "XY", "\nX\nY");
-    }
-
-    @Test
-    public void testEval() throws TemplateException, IOException {
-        {
-            TemplateConfigurer tc = new TemplateConfigurer();
-            tc.setParentConfiguration(DEFAULT_CFG);
-            tc.setArithmeticEngine(new DummyArithmeticEngine());
-            assertOutputWithoutAndWithTC(tc,
-                    "<#assign x = 1>${r'1 + x'?eval?c}",
-                    "2", "22");
-            assertOutputWithoutAndWithTC(tc,
-                    "${r'1?c'?eval}",
-                    "1", "11");
-        }
-        
-        {
-            TemplateConfigurer tc = new TemplateConfigurer();
-            tc.setParentConfiguration(DEFAULT_CFG);
-            String outputEncoding = "ISO-8859-2";
-            tc.setOutputEncoding(outputEncoding);
-
-            String legacyNCFtl = "${r'.output_encoding!\"null\"'?eval}";
-            String camelCaseNCFtl = "${r'.outputEncoding!\"null\"'?eval}";
-
-            // Default is re-auto-detecting in ?eval:
-            assertOutputWithoutAndWithTC(tc, legacyNCFtl, "null", outputEncoding);
-            assertOutputWithoutAndWithTC(tc, camelCaseNCFtl, "null", outputEncoding);
-            
-            // Force camelCase:
-            tc.setNamingConvention(Configuration.CAMEL_CASE_NAMING_CONVENTION);
-            assertOutputWithoutAndWithTC(tc, legacyNCFtl, "null", null);
-            assertOutputWithoutAndWithTC(tc, camelCaseNCFtl, "null", outputEncoding);
-            
-            // Force legacy:
-            tc.setNamingConvention(Configuration.LEGACY_NAMING_CONVENTION);
-            assertOutputWithoutAndWithTC(tc, legacyNCFtl, "null", outputEncoding);
-            assertOutputWithoutAndWithTC(tc, camelCaseNCFtl, "null", null);
-        }
-    }
-    
-    @Test
-    public void testSetParentConfiguration() throws IOException {
-        TemplateConfigurer tc = new TemplateConfigurer();
-        
-        Template t = new Template(null, "", DEFAULT_CFG);
-        try {
-            tc.configure(t);
-            fail();
-        } catch (IllegalStateException e) {
-            assertThat(e.getMessage(), containsString("Configuration"));
-        }
-        
-        tc.setParent(DEFAULT_CFG);
-        
-        try {
-            tc.setParentConfiguration(new Configuration());
-            fail();
-        } catch (IllegalStateException e) {
-            assertThat(e.getMessage(), containsString("Configuration"));
-        }
-
-        try {
-            // Same as setParentConfiguration
-            tc.setParent(new Configuration());
-            fail();
-        } catch (IllegalStateException e) {
-            assertThat(e.getMessage(), containsString("Configuration"));
-        }
-        
-        try {
-            tc.setParentConfiguration(null);
-            fail();
-        } catch (NullArgumentException e) {
-            // exected
-        }
-        
-        tc.setParent(DEFAULT_CFG);
-        
-        tc.configure(t);
-    }
-    
-    private void assertOutputWithoutAndWithTC(TemplateConfigurer tc, String ftl, String expectedDefaultOutput,
-            String expectedConfiguredOutput) throws TemplateException, IOException {
-        assertOutput(tc, ftl, expectedConfiguredOutput);
-        assertOutput(null, ftl, expectedDefaultOutput);
-    }
-
-    private void assertOutput(TemplateConfigurer tc, String ftl, String expectedConfiguredOutput)
-            throws TemplateException, IOException {
-        StringWriter sw = new StringWriter();
-        try {
-            Configuration cfg = tc != null ? tc.getParentConfiguration() : DEFAULT_CFG;
-            Template t = new Template("adhoc.ftlh", null, new StringReader(ftl), cfg, tc, null);
-            if (tc != null) {
-                tc.configure(t);
-            }
-            t.process(null, sw);
-            if (expectedConfiguredOutput == null) {
-                fail("Template should have fail.");
-            }
-        } catch (TemplateException e) {
-            if (expectedConfiguredOutput != null) {
-                throw e;
-            }
-        } catch (ParseException e) {
-            if (expectedConfiguredOutput != null) {
-                throw e;
-            }
-        }
-        if (expectedConfiguredOutput != null) {
-            assertEquals(expectedConfiguredOutput, sw.toString());
-        }
-    }
-
-    @Test
-    public void testIsSet() throws Exception {
-        for (PropertyDescriptor pd : getTemplateConfigurerSettingPropDescs(true, true)) {
-            TemplateConfigurer tc = new TemplateConfigurer();
-            checkAllIsSetFalseExcept(tc, null);
-            pd.getWriteMethod().invoke(tc, SETTING_ASSIGNMENTS.get(pd.getName()));
-            checkAllIsSetFalseExcept(tc, pd.getName());
-        }
-    }
-
-    private void checkAllIsSetFalseExcept(TemplateConfigurer tc, String setSetting)
-            throws SecurityException, IntrospectionException,
-            IllegalArgumentException, IllegalAccessException, InvocationTargetException {
-        for (PropertyDescriptor pd : getTemplateConfigurerSettingPropDescs(true, true)) {
-            String isSetMethodName = getIsSetMethodName(pd.getReadMethod().getName());
-            Method isSetMethod;
-            try {
-                isSetMethod = TemplateConfigurer.class.getMethod(isSetMethodName);
-            } catch (NoSuchMethodException e) {
-                fail("Missing " + isSetMethodName + " method for \"" + pd.getName() + "\".");
-                return;
-            }
-            if (pd.getName().equals(setSetting)) {
-                assertTrue(isSetMethod + " should return true", (Boolean) (isSetMethod.invoke(tc)));
-            } else {
-                assertFalse(isSetMethod + " should return false", (Boolean) (isSetMethod.invoke(tc)));
-            }
-        }
-    }
-
-    /**
-     * Test case self-check.
-     */
-    @Test
-    public void checkTestAssignments() throws Exception {
-        for (PropertyDescriptor pd : getTemplateConfigurerSettingPropDescs(true, true)) {
-            String propName = pd.getName();
-            if (!SETTING_ASSIGNMENTS.containsKey(propName)) {
-                fail("Test case doesn't cover all settings in SETTING_ASSIGNMENTS. Missing: " + propName);
-            }
-            Method readMethod = pd.getReadMethod();
-            String cfgMethodName = readMethod.getName();
-            if (cfgMethodName.equals("getEncoding")) {
-                // Because Configuration has local-to-encoding map too, this has a different name there.
-                cfgMethodName = "getDefaultEncoding";
-            }
-            Method cfgMethod = DEFAULT_CFG.getClass().getMethod(cfgMethodName, readMethod.getParameterTypes());
-            Object defaultSettingValue = cfgMethod.invoke(DEFAULT_CFG);
-            Object assignedValue = SETTING_ASSIGNMENTS.get(propName);
-            assertNotEquals("SETTING_ASSIGNMENTS must contain a non-default value for " + propName,
-                    assignedValue, defaultSettingValue);
-
-            TemplateConfigurer tc = new TemplateConfigurer();
-            try {
-                pd.getWriteMethod().invoke(tc, assignedValue);
-            } catch (Exception e) {
-                throw new IllegalStateException("For setting \"" + propName + "\" and assigned value of type "
-                        + (assignedValue != null ? assignedValue.getClass().getName() : "Null"),
-                        e);
-            }
-        }
-    }
-    
-}

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/ea5c47d1/src/test/java/freemarker/core/TemplateConfigurerWithTemplateCacheTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/freemarker/core/TemplateConfigurerWithTemplateCacheTest.java b/src/test/java/freemarker/core/TemplateConfigurerWithTemplateCacheTest.java
deleted file mode 100644
index 53e8193..0000000
--- a/src/test/java/freemarker/core/TemplateConfigurerWithTemplateCacheTest.java
+++ /dev/null
@@ -1,325 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- * 
- *   http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package freemarker.core;
-
-import static org.junit.Assert.*;
-
-import java.io.IOException;
-import java.io.StringWriter;
-import java.io.UnsupportedEncodingException;
-import java.util.Locale;
-
-import org.junit.Test;
-
-import freemarker.cache.ByteArrayTemplateLoader;
-import freemarker.cache.ConditionalTemplateConfigurerFactory;
-import freemarker.cache.FileNameGlobMatcher;
-import freemarker.cache.FirstMatchTemplateConfigurerFactory;
-import freemarker.cache.MergingTemplateConfigurerFactory;
-import freemarker.cache.StringTemplateLoader;
-import freemarker.template.Configuration;
-import freemarker.template.Template;
-import freemarker.template.TemplateException;
-
-public class TemplateConfigurerWithTemplateCacheTest {
-
-    private static final String TEXT_WITH_ACCENTS = "pr\u00F3ba";
-
-    private static final CustomAttribute CUST_ATT_1 = new CustomAttribute(CustomAttribute.SCOPE_TEMPLATE);
-    private static final CustomAttribute CUST_ATT_2 = new CustomAttribute(CustomAttribute.SCOPE_TEMPLATE);
-
-    @Test
-    public void testEncoding() throws Exception {
-        Configuration cfg = createCommonEncodingTesterConfig();
-        
-        {
-            Template t = cfg.getTemplate("utf8.ftl");
-            assertEquals("utf-8", t.getEncoding());
-            assertEquals(TEXT_WITH_ACCENTS, getTemplateOutput(t));
-        }
-        {
-            Template t = cfg.getTemplate("utf8.ftl", "iso-8859-1");
-            assertEquals("utf-8", t.getEncoding());
-            assertEquals(TEXT_WITH_ACCENTS, getTemplateOutput(t));
-        }
-        {
-            Template t = cfg.getTemplate("utf16.ftl");
-            assertEquals("utf-16", t.getEncoding());
-            assertEquals(TEXT_WITH_ACCENTS, getTemplateOutput(t));
-        }
-        {
-            Template t = cfg.getTemplate("default.ftl");
-            assertEquals("iso-8859-1", t.getEncoding());
-            assertEquals(TEXT_WITH_ACCENTS, getTemplateOutput(t));
-        }
-        {
-            Template t = cfg.getTemplate("default.ftl", "iso-8859-5");
-            assertEquals("iso-8859-5", t.getEncoding());
-            assertEquals(new String(TEXT_WITH_ACCENTS.getBytes("iso-8859-1"), "iso-8859-5"),
-                    getTemplateOutput(t));
-        }
-        {
-            Template t = cfg.getTemplate("utf8-latin2.ftl");
-            assertEquals("iso-8859-2", t.getEncoding());
-            assertEquals(TEXT_WITH_ACCENTS, getTemplateOutput(t));
-        }
-        {
-            Template t = cfg.getTemplate("default-latin2.ftl");
-            assertEquals("iso-8859-2", t.getEncoding());
-            assertEquals(TEXT_WITH_ACCENTS, getTemplateOutput(t));
-        }
-    }
-    
-    @Test
-    public void testIncludeAndEncoding() throws Exception {
-        Configuration cfg = createCommonEncodingTesterConfig();
-        ByteArrayTemplateLoader tl = (ByteArrayTemplateLoader) cfg.getTemplateLoader();
-        tl.putTemplate("main.ftl", (
-                        "<#include 'utf8.ftl'>"
-                        + "<#include 'utf16.ftl'>"
-                        + "<#include 'default.ftl'>"
-                        + "<#include 'utf8-latin2.ftl'>"
-                        // With mostly ignored encoding params:
-                        + "<#include 'utf8.ftl' encoding='utf-16'>"
-                        + "<#include 'utf16.ftl' encoding='iso-8859-5'>"
-                        + "<#include 'default.ftl' encoding='iso-8859-5'>"
-                        + "<#include 'utf8-latin2.ftl' encoding='iso-8859-5'>"
-                ).getBytes("iso-8859-1"));
-        assertEquals(
-                TEXT_WITH_ACCENTS + TEXT_WITH_ACCENTS + TEXT_WITH_ACCENTS + TEXT_WITH_ACCENTS
-                + TEXT_WITH_ACCENTS + TEXT_WITH_ACCENTS
-                + new String(TEXT_WITH_ACCENTS.getBytes("iso-8859-1"), "iso-8859-5")
-                + TEXT_WITH_ACCENTS,
-                getTemplateOutput(cfg.getTemplate("main.ftl")));
-    }
-
-    @Test
-    public void testLocale() throws Exception {
-        Configuration cfg = new Configuration(Configuration.VERSION_2_3_23);
-        cfg.setLocale(Locale.US);
-        
-        StringTemplateLoader tl = new StringTemplateLoader();
-        tl.putTemplate("(de).ftl", "${.locale}");
-        tl.putTemplate("default.ftl", "${.locale}");
-        tl.putTemplate("(de)-fr.ftl",
-                ("<#ftl locale='fr_FR'>${.locale}"));
-        tl.putTemplate("default-fr.ftl",
-                ("<#ftl locale='fr_FR'>${.locale}"));
-        cfg.setTemplateLoader(tl);
-
-        TemplateConfigurer tcDe = new TemplateConfigurer();
-        tcDe.setLocale(Locale.GERMANY);
-        cfg.setTemplateConfigurers(new ConditionalTemplateConfigurerFactory(new FileNameGlobMatcher("*(de)*"), tcDe));
-        
-        {
-            Template t = cfg.getTemplate("(de).ftl");
-            assertEquals(Locale.GERMANY, t.getLocale());
-            assertEquals("de_DE", getTemplateOutput(t));
-        }
-        {
-            Template t = cfg.getTemplate("(de).ftl", Locale.ITALY);
-            assertEquals(Locale.GERMANY, t.getLocale());
-            assertEquals("de_DE", getTemplateOutput(t));
-        }
-        {
-            Template t = cfg.getTemplate("default.ftl");
-            assertEquals(Locale.US, t.getLocale());
-            assertEquals("en_US", getTemplateOutput(t));
-        }
-        {
-            Template t = cfg.getTemplate("default.ftl", Locale.ITALY);
-            assertEquals(Locale.ITALY, t.getLocale());
-            assertEquals("it_IT", getTemplateOutput(t));
-        }
-    }
-
-    @Test
-    public void testPlainText() throws Exception {
-        Configuration cfg = createCommonEncodingTesterConfig();
-        cfg.setIncompatibleImprovements(Configuration.VERSION_2_3_22);
-        
-        TemplateConfigurer tcDE = new TemplateConfigurer();
-        tcDE.setLocale(Locale.GERMANY);
-        TemplateConfigurer tcYN = new TemplateConfigurer();
-        tcYN.setBooleanFormat("Y,N");
-        cfg.setTemplateConfigurers(
-                    new MergingTemplateConfigurerFactory(
-                            cfg.getTemplateConfigurers(),
-                            new ConditionalTemplateConfigurerFactory(new FileNameGlobMatcher("utf16.ftl"), tcDE),
-                            new ConditionalTemplateConfigurerFactory(new FileNameGlobMatcher("utf16.ftl"), tcYN)
-                    )
-                );
-        
-        {
-            Template t = cfg.getTemplate("utf8.ftl", null, null, false);
-            assertEquals("utf-8", t.getEncoding());
-            assertEquals(TEXT_WITH_ACCENTS, getTemplateOutput(t));
-            assertEquals(Locale.US, t.getLocale());
-            assertEquals("true,false", t.getBooleanFormat());
-        }
-        {
-            Template t = cfg.getTemplate("utf8.ftl", null, "iso-8859-1", false);
-            assertEquals("utf-8", t.getEncoding());
-            assertEquals(TEXT_WITH_ACCENTS, getTemplateOutput(t));
-        }
-        {
-            Template t = cfg.getTemplate("utf16.ftl", null, null, false);
-            assertEquals("utf-16", t.getEncoding());
-            assertEquals(TEXT_WITH_ACCENTS, getTemplateOutput(t));
-            assertEquals(Locale.GERMANY, t.getLocale());
-            assertEquals("Y,N", t.getBooleanFormat());
-        }
-        {
-            Template t = cfg.getTemplate("default.ftl", null, null, false);
-            assertEquals("iso-8859-1", t.getEncoding());
-            assertEquals(TEXT_WITH_ACCENTS, getTemplateOutput(t));
-        }
-    }
-
-    @Test
-    public void testConfigurableSettings() throws Exception {
-        Configuration cfg = new Configuration(Configuration.VERSION_2_3_22);
-        cfg.setLocale(Locale.US);
-        
-        TemplateConfigurer tcFR = new TemplateConfigurer();
-        tcFR.setLocale(Locale.FRANCE);
-        TemplateConfigurer tcYN = new TemplateConfigurer();
-        tcYN.setBooleanFormat("Y,N");
-        TemplateConfigurer tc00 = new TemplateConfigurer();
-        tc00.setNumberFormat("0.00");
-        cfg.setTemplateConfigurers(
-                new MergingTemplateConfigurerFactory(
-                        new ConditionalTemplateConfigurerFactory(new FileNameGlobMatcher("*(fr)*"), tcFR),
-                        new ConditionalTemplateConfigurerFactory(new FileNameGlobMatcher("*(yn)*"), tcYN),
-                        new ConditionalTemplateConfigurerFactory(new FileNameGlobMatcher("*(00)*"), tc00)
-                )
-        );
-        
-        String commonFTL = "${.locale} ${true?string} ${1.2}";
-        StringTemplateLoader tl = new StringTemplateLoader();
-        tl.putTemplate("default", commonFTL);
-        tl.putTemplate("(fr)", commonFTL);
-        tl.putTemplate("(yn)(00)", commonFTL);
-        tl.putTemplate("(00)(fr)", commonFTL);
-        cfg.setTemplateLoader(tl);
-        
-        assertEquals("en_US true 1.2", getTemplateOutput(cfg.getTemplate("default")));
-        assertEquals("fr_FR true 1,2", getTemplateOutput(cfg.getTemplate("(fr)")));
-        assertEquals("en_US Y 1.20", getTemplateOutput(cfg.getTemplate("(yn)(00)")));
-        assertEquals("fr_FR true 1,20", getTemplateOutput(cfg.getTemplate("(00)(fr)")));
-    }
-    
-    @Test
-    public void testCustomAttributes() throws Exception {
-        Configuration cfg = new Configuration(Configuration.VERSION_2_3_22);
-        
-        TemplateConfigurer tc1 = new TemplateConfigurer();
-        tc1.setCustomAttribute("a1", "a1tc1");
-        tc1.setCustomAttribute("a2", "a2tc1");
-        tc1.setCustomAttribute("a3", "a3tc1");
-        CUST_ATT_1.set("ca1tc1", tc1);
-        CUST_ATT_2.set("ca2tc1", tc1);
-        
-        TemplateConfigurer tc2 = new TemplateConfigurer();
-        tc2.setCustomAttribute("a1", "a1tc2");
-        CUST_ATT_1.set("ca1tc2", tc2);
-        
-        cfg.setTemplateConfigurers(
-                new MergingTemplateConfigurerFactory(
-                        new ConditionalTemplateConfigurerFactory(new FileNameGlobMatcher("*(tc1)*"), tc1),
-                        new ConditionalTemplateConfigurerFactory(new FileNameGlobMatcher("*(tc2)*"), tc2)
-                )
-        );
-        
-        String commonFTL = "<#ftl attributes={ 'a3': 'a3temp' }>";
-        StringTemplateLoader tl = new StringTemplateLoader();
-        tl.putTemplate("(tc1)", commonFTL);
-        tl.putTemplate("(tc1)noHeader", "");
-        tl.putTemplate("(tc2)", commonFTL);
-        tl.putTemplate("(tc1)(tc2)", commonFTL);
-        cfg.setTemplateLoader(tl);
-
-        {
-            Template t = cfg.getTemplate("(tc1)");
-            assertEquals("a1tc1", t.getCustomAttribute("a1"));
-            assertEquals("a2tc1", t.getCustomAttribute("a2"));
-            assertEquals("a3temp", t.getCustomAttribute("a3"));
-            assertEquals("ca1tc1", CUST_ATT_1.get(t));
-            assertEquals("ca2tc1", CUST_ATT_2.get(t));
-        }
-        {
-            Template t = cfg.getTemplate("(tc1)noHeader");
-            assertEquals("a1tc1", t.getCustomAttribute("a1"));
-            assertEquals("a2tc1", t.getCustomAttribute("a2"));
-            assertEquals("a3tc1", t.getCustomAttribute("a3"));
-            assertEquals("ca1tc1", CUST_ATT_1.get(t));
-            assertEquals("ca2tc1", CUST_ATT_2.get(t));
-        }
-        {
-            Template t = cfg.getTemplate("(tc2)");
-            assertEquals("a1tc2", t.getCustomAttribute("a1"));
-            assertNull(t.getCustomAttribute("a2"));
-            assertEquals("a3temp", t.getCustomAttribute("a3"));
-            assertEquals("ca1tc2", CUST_ATT_1.get(t));
-            assertNull(CUST_ATT_2.get(t));
-        }
-        {
-            Template t = cfg.getTemplate("(tc1)(tc2)");
-            assertEquals("a1tc2", t.getCustomAttribute("a1"));
-            assertEquals("a2tc1", t.getCustomAttribute("a2"));
-            assertEquals("a3temp", t.getCustomAttribute("a3"));
-            assertEquals("ca1tc2", CUST_ATT_1.get(t));
-            assertEquals("ca2tc1", CUST_ATT_2.get(t));
-        }
-    }
-    
-    private String getTemplateOutput(Template t) throws TemplateException, IOException {
-        StringWriter sw = new StringWriter();
-        t.process(null, sw);
-        return sw.toString();
-    }
-
-    private Configuration createCommonEncodingTesterConfig() throws UnsupportedEncodingException {
-        Configuration cfg = new Configuration(Configuration.VERSION_2_3_0);
-        cfg.setDefaultEncoding("iso-8859-1");
-        cfg.setLocale(Locale.US);
-        
-        ByteArrayTemplateLoader tl = new ByteArrayTemplateLoader();
-        tl.putTemplate("utf8.ftl", TEXT_WITH_ACCENTS.getBytes("utf-8"));
-        tl.putTemplate("utf16.ftl", TEXT_WITH_ACCENTS.getBytes("utf-16"));
-        tl.putTemplate("default.ftl", TEXT_WITH_ACCENTS.getBytes("iso-8859-2"));
-        tl.putTemplate("utf8-latin2.ftl",
-                ("<#ftl encoding='iso-8859-2'>" + TEXT_WITH_ACCENTS).getBytes("iso-8859-2"));
-        tl.putTemplate("default-latin2.ftl",
-                ("<#ftl encoding='iso-8859-2'>" + TEXT_WITH_ACCENTS).getBytes("iso-8859-2"));
-        cfg.setTemplateLoader(tl);
-        
-        TemplateConfigurer tcUtf8 = new TemplateConfigurer();
-        tcUtf8.setEncoding("utf-8");
-        TemplateConfigurer tcUtf16 = new TemplateConfigurer();
-        tcUtf16.setEncoding("utf-16");
-        cfg.setTemplateConfigurers(
-                new FirstMatchTemplateConfigurerFactory(
-                        new ConditionalTemplateConfigurerFactory(new FileNameGlobMatcher("*utf8*"), tcUtf8),
-                        new ConditionalTemplateConfigurerFactory(new FileNameGlobMatcher("*utf16*"), tcUtf16)
-                ).allowNoMatch(true));
-        return cfg;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/ea5c47d1/src/test/java/freemarker/ext/servlet/FreemarkerServletTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/freemarker/ext/servlet/FreemarkerServletTest.java b/src/test/java/freemarker/ext/servlet/FreemarkerServletTest.java
index f008280..0e9f539 100644
--- a/src/test/java/freemarker/ext/servlet/FreemarkerServletTest.java
+++ b/src/test/java/freemarker/ext/servlet/FreemarkerServletTest.java
@@ -38,13 +38,13 @@ import org.springframework.mock.web.MockHttpServletResponse;
 import org.springframework.mock.web.MockServletConfig;
 import org.springframework.mock.web.MockServletContext;
 
-import freemarker.cache.ConditionalTemplateConfigurerFactory;
+import freemarker.cache.ConditionalTemplateConfigurationFactory;
 import freemarker.cache.FileNameGlobMatcher;
-import freemarker.cache.FirstMatchTemplateConfigurerFactory;
+import freemarker.cache.FirstMatchTemplateConfigurationFactory;
 import freemarker.cache.StringTemplateLoader;
 import freemarker.cache.TemplateLoader;
 import freemarker.core.Environment;
-import freemarker.core.TemplateConfigurer;
+import freemarker.core.TemplateConfiguration;
 import freemarker.template.Configuration;
 import freemarker.template.Template;
 import freemarker.template.TemplateException;
@@ -491,7 +491,7 @@ public class FreemarkerServletTest {
         @Override
         protected Configuration createConfiguration() {
             Configuration cfg = super.createConfiguration();
-            // Needed for the TemplateConfigurer that sets outputEncoding:
+            // Needed for the TemplateConfiguration that sets outputEncoding:
             cfg.setIncompatibleImprovements(Configuration.VERSION_2_3_22);
 
             // Set a test runner environment independent default locale:
@@ -499,17 +499,17 @@ public class FreemarkerServletTest {
             cfg.setDefaultEncoding(CFG_DEFAULT_ENCODING);
 
             {
-                TemplateConfigurer outUtf8TC = new TemplateConfigurer();
+                TemplateConfiguration outUtf8TC = new TemplateConfiguration();
                 outUtf8TC.setOutputEncoding("UTF-8");
                 
-                TemplateConfigurer srcUtf8TC = new TemplateConfigurer();
+                TemplateConfiguration srcUtf8TC = new TemplateConfiguration();
                 srcUtf8TC.setEncoding("UTF-8");
                 
-                cfg.setTemplateConfigurers(
-                        new FirstMatchTemplateConfigurerFactory(
-                                new ConditionalTemplateConfigurerFactory(
+                cfg.setTemplateConfigurations(
+                        new FirstMatchTemplateConfigurationFactory(
+                                new ConditionalTemplateConfigurationFactory(
                                         new FileNameGlobMatcher(FOO_SRC_UTF8_FTL), srcUtf8TC),
-                                new ConditionalTemplateConfigurerFactory(
+                                new ConditionalTemplateConfigurationFactory(
                                         new FileNameGlobMatcher(FOO_OUT_UTF8_FTL), outUtf8TC)
                         )
                         .allowNoMatch(true)

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/ea5c47d1/src/test/java/freemarker/manual/ConfigureOutputFormatExamples.java
----------------------------------------------------------------------
diff --git a/src/test/java/freemarker/manual/ConfigureOutputFormatExamples.java b/src/test/java/freemarker/manual/ConfigureOutputFormatExamples.java
index 5f5fb9f..8aa6ff4 100644
--- a/src/test/java/freemarker/manual/ConfigureOutputFormatExamples.java
+++ b/src/test/java/freemarker/manual/ConfigureOutputFormatExamples.java
@@ -22,14 +22,14 @@ import static org.junit.Assert.*;
 
 import org.junit.Test;
 
-import freemarker.cache.ConditionalTemplateConfigurerFactory;
+import freemarker.cache.ConditionalTemplateConfigurationFactory;
 import freemarker.cache.FileExtensionMatcher;
-import freemarker.cache.FirstMatchTemplateConfigurerFactory;
+import freemarker.cache.FirstMatchTemplateConfigurationFactory;
 import freemarker.cache.OrMatcher;
 import freemarker.cache.PathGlobMatcher;
 import freemarker.core.HTMLOutputFormat;
 import freemarker.core.RTFOutputFormat;
-import freemarker.core.TemplateConfigurer;
+import freemarker.core.TemplateConfiguration;
 import freemarker.core.XMLOutputFormat;
 import freemarker.template.Configuration;
 
@@ -47,11 +47,11 @@ public class ConfigureOutputFormatExamples extends ExamplesTest {
         
         // Example 2/a:
         {
-            TemplateConfigurer tcHTML = new TemplateConfigurer();
+            TemplateConfiguration tcHTML = new TemplateConfiguration();
             tcHTML.setOutputFormat(HTMLOutputFormat.INSTANCE);
             
-            cfg.setTemplateConfigurers(
-                    new ConditionalTemplateConfigurerFactory(
+            cfg.setTemplateConfigurations(
+                    new ConditionalTemplateConfigurationFactory(
                             new PathGlobMatcher("mail/**"),
                             tcHTML));
             
@@ -60,7 +60,7 @@ public class ConfigureOutputFormatExamples extends ExamplesTest {
 
         // Example 2/b:
         {
-            cfg.setTemplateConfigurers(null); // Just to be sure...
+            cfg.setTemplateConfigurations(null); // Just to be sure...
             
             cfg.setSettings(loadPropertiesFile("ConfigureOutputFormatExamples1.properties"));
                 
@@ -69,26 +69,26 @@ public class ConfigureOutputFormatExamples extends ExamplesTest {
         
         // Example 3/a:
         {
-            TemplateConfigurer tcHTML = new TemplateConfigurer();
+            TemplateConfiguration tcHTML = new TemplateConfiguration();
             tcHTML.setOutputFormat(HTMLOutputFormat.INSTANCE);
             
-            TemplateConfigurer tcXML = new TemplateConfigurer();
+            TemplateConfiguration tcXML = new TemplateConfiguration();
             tcXML.setOutputFormat(XMLOutputFormat.INSTANCE);
 
-            TemplateConfigurer tcRTF = new TemplateConfigurer();
+            TemplateConfiguration tcRTF = new TemplateConfiguration();
             tcRTF.setOutputFormat(RTFOutputFormat.INSTANCE);
             
-            cfg.setTemplateConfigurers(
-                    new FirstMatchTemplateConfigurerFactory(
-                            new ConditionalTemplateConfigurerFactory(
+            cfg.setTemplateConfigurations(
+                    new FirstMatchTemplateConfigurationFactory(
+                            new ConditionalTemplateConfigurationFactory(
                                     new FileExtensionMatcher("xml"),
                                     tcXML),
-                            new ConditionalTemplateConfigurerFactory(
+                            new ConditionalTemplateConfigurationFactory(
                                     new OrMatcher(
                                             new FileExtensionMatcher("html"),
                                             new FileExtensionMatcher("htm")),
                                     tcHTML),
-                            new ConditionalTemplateConfigurerFactory(
+                            new ConditionalTemplateConfigurationFactory(
                                     new FileExtensionMatcher("rtf"),
                                     tcRTF)
                     ).allowNoMatch(true)
@@ -102,7 +102,7 @@ public class ConfigureOutputFormatExamples extends ExamplesTest {
 
         // Example 3/b:
         {
-            cfg.setTemplateConfigurers(null); // Just to be sure...
+            cfg.setTemplateConfigurations(null); // Just to be sure...
             
             cfg.setSettings(loadPropertiesFile("ConfigureOutputFormatExamples2.properties"));
             

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/ea5c47d1/src/test/java/freemarker/manual/TemplateConfigurationExamples.java
----------------------------------------------------------------------
diff --git a/src/test/java/freemarker/manual/TemplateConfigurationExamples.java b/src/test/java/freemarker/manual/TemplateConfigurationExamples.java
new file mode 100644
index 0000000..97e16f9
--- /dev/null
+++ b/src/test/java/freemarker/manual/TemplateConfigurationExamples.java
@@ -0,0 +1,186 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package freemarker.manual;
+
+import static org.junit.Assert.*;
+
+import java.util.Date;
+
+import org.junit.Test;
+
+import freemarker.cache.ConditionalTemplateConfigurationFactory;
+import freemarker.cache.FileExtensionMatcher;
+import freemarker.cache.FileNameGlobMatcher;
+import freemarker.cache.FirstMatchTemplateConfigurationFactory;
+import freemarker.cache.MergingTemplateConfigurationFactory;
+import freemarker.cache.OrMatcher;
+import freemarker.cache.PathGlobMatcher;
+import freemarker.core.HTMLOutputFormat;
+import freemarker.core.PlainTextOutputFormat;
+import freemarker.core.TemplateConfiguration;
+import freemarker.core.UndefinedOutputFormat;
+import freemarker.core.XMLOutputFormat;
+import freemarker.template.Configuration;
+import freemarker.template.Template;
+import freemarker.template.utility.DateUtil;
+
+public class TemplateConfigurationExamples extends ExamplesTest {
+
+    @Test
+    public void example1() throws Exception {
+        Configuration cfg = getConfiguration();
+
+        addTemplate("t.xml", "");
+        
+        TemplateConfiguration tcUTF8XML = new TemplateConfiguration();
+        tcUTF8XML.setEncoding("utf-8");
+        tcUTF8XML.setOutputFormat(XMLOutputFormat.INSTANCE);
+
+        {
+            cfg.setTemplateConfigurations(new ConditionalTemplateConfigurationFactory(
+                    new FileExtensionMatcher("xml"), tcUTF8XML));
+            
+            Template t = cfg.getTemplate("t.xml");
+            assertEquals("utf-8", t.getEncoding());
+            assertEquals(XMLOutputFormat.INSTANCE, t.getOutputFormat());
+        }
+
+        {
+            cfg.setTemplateConfigurations(null);
+            cfg.setSettings(loadPropertiesFile("TemplateConfigurationExamples1.properties"));
+            
+            Template t = cfg.getTemplate("t.xml");
+            assertEquals("utf-8", t.getEncoding());
+            assertEquals(XMLOutputFormat.INSTANCE, t.getOutputFormat());
+        }
+    }
+
+    @Test
+    public void example2() throws Exception {
+        Configuration cfg = getConfiguration();
+        
+        addTemplate("t.subject.ftl", "");
+        addTemplate("mail/t.subject.ftl", "");
+        addTemplate("mail/t.body.ftl", "");
+
+        TemplateConfiguration tcSubject = new TemplateConfiguration();
+        tcSubject.setOutputFormat(PlainTextOutputFormat.INSTANCE);
+        
+        TemplateConfiguration tcBody = new TemplateConfiguration();
+        tcBody.setOutputFormat(HTMLOutputFormat.INSTANCE);
+        
+        cfg.setTemplateConfigurations(
+                new ConditionalTemplateConfigurationFactory(
+                        new PathGlobMatcher("mail/**"),
+                        new FirstMatchTemplateConfigurationFactory(
+                                new ConditionalTemplateConfigurationFactory(
+                                        new FileNameGlobMatcher("*.subject.*"),
+                                        tcSubject),
+                                new ConditionalTemplateConfigurationFactory(
+                                        new FileNameGlobMatcher("*.body.*"),
+                                        tcBody)
+                                )
+                                .noMatchErrorDetails("Mail template names must contain \".subject.\" or \".body.\"!")
+                        ));
+        
+        assertEquals(UndefinedOutputFormat.INSTANCE, cfg.getTemplate("t.subject.ftl").getOutputFormat());
+        assertEquals(PlainTextOutputFormat.INSTANCE, cfg.getTemplate("mail/t.subject.ftl").getOutputFormat());
+        assertEquals(HTMLOutputFormat.INSTANCE, cfg.getTemplate("mail/t.body.ftl").getOutputFormat());
+        
+        // From properties:
+        
+        cfg.setTemplateConfigurations(null);
+        cfg.setSettings(loadPropertiesFile("TemplateConfigurationExamples2.properties"));
+        
+        assertEquals(UndefinedOutputFormat.INSTANCE, cfg.getTemplate("t.subject.ftl").getOutputFormat());
+        assertEquals(PlainTextOutputFormat.INSTANCE, cfg.getTemplate("mail/t.subject.ftl").getOutputFormat());
+        assertEquals(HTMLOutputFormat.INSTANCE, cfg.getTemplate("mail/t.body.ftl").getOutputFormat());
+    };
+    
+    @Test
+    public void example3() throws Exception {
+        Configuration cfg = getConfiguration();
+        cfg.setDefaultEncoding("ISO-8859-1");
+        cfg.setSharedVariable("ts", new Date(1440431606011L));
+        
+        addTemplate("t.stats.html", "${ts?datetime} ${ts?date} ${ts?time}");
+        addTemplate("t.html", "");
+        addTemplate("t.htm", "");
+        addTemplate("t.xml", "");
+        addTemplate("mail/t.html", "");
+
+        TemplateConfiguration tcStats = new TemplateConfiguration();
+        tcStats.setDateTimeFormat("iso");
+        tcStats.setDateFormat("iso");
+        tcStats.setTimeFormat("iso");
+        tcStats.setTimeZone(DateUtil.UTC);
+
+        TemplateConfiguration tcMail = new TemplateConfiguration();
+        tcMail.setEncoding("utf-8");
+        
+        TemplateConfiguration tcHTML = new TemplateConfiguration();
+        tcHTML.setOutputFormat(HTMLOutputFormat.INSTANCE);
+        
+        TemplateConfiguration tcXML = new TemplateConfiguration();
+        tcXML.setOutputFormat(XMLOutputFormat.INSTANCE);
+        
+        cfg.setTemplateConfigurations(
+                new MergingTemplateConfigurationFactory(
+                        new ConditionalTemplateConfigurationFactory(
+                                new FileNameGlobMatcher("*.stats.*"),
+                                tcStats),
+                        new ConditionalTemplateConfigurationFactory(
+                                new PathGlobMatcher("mail/**"),
+                                tcMail),
+                        new FirstMatchTemplateConfigurationFactory(
+                                new ConditionalTemplateConfigurationFactory(
+                                        new FileExtensionMatcher("xml"),
+                                        tcXML),
+                                new ConditionalTemplateConfigurationFactory(
+                                        new OrMatcher(
+                                                new FileExtensionMatcher("html"),
+                                                new FileExtensionMatcher("htm")),
+                                        tcHTML)
+                        ).allowNoMatch(true)
+                )
+        );
+        
+        assertEquals(HTMLOutputFormat.INSTANCE, cfg.getTemplate("t.html").getOutputFormat());
+        assertEquals("ISO-8859-1", cfg.getTemplate("t.html").getEncoding());
+        assertEquals(HTMLOutputFormat.INSTANCE, cfg.getTemplate("t.htm").getOutputFormat());
+        assertEquals(XMLOutputFormat.INSTANCE, cfg.getTemplate("t.xml").getOutputFormat());
+        assertEquals(HTMLOutputFormat.INSTANCE, cfg.getTemplate("t.stats.html").getOutputFormat());
+        assertOutputForNamed("t.stats.html", "2015-08-24T15:53:26.011Z 2015-08-24 15:53:26.011Z");
+        assertEquals("utf-8", cfg.getTemplate("mail/t.html").getEncoding());
+        
+        // From properties:
+        
+        cfg.setTemplateConfigurations(null);
+        cfg.setSettings(loadPropertiesFile("TemplateConfigurationExamples3.properties"));
+        
+        assertEquals(HTMLOutputFormat.INSTANCE, cfg.getTemplate("t.html").getOutputFormat());
+        assertEquals("ISO-8859-1", cfg.getTemplate("t.html").getEncoding());
+        assertEquals(HTMLOutputFormat.INSTANCE, cfg.getTemplate("t.htm").getOutputFormat());
+        assertEquals(XMLOutputFormat.INSTANCE, cfg.getTemplate("t.xml").getOutputFormat());
+        assertEquals(HTMLOutputFormat.INSTANCE, cfg.getTemplate("t.stats.html").getOutputFormat());
+        assertOutputForNamed("t.stats.html", "2015-08-24T15:53:26.011Z 2015-08-24 15:53:26.011Z");
+        assertEquals("utf-8", cfg.getTemplate("mail/t.html").getEncoding());
+    }
+    
+}

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/ea5c47d1/src/test/java/freemarker/manual/TemplateConfigurerExamples.java
----------------------------------------------------------------------
diff --git a/src/test/java/freemarker/manual/TemplateConfigurerExamples.java b/src/test/java/freemarker/manual/TemplateConfigurerExamples.java
deleted file mode 100644
index 8e3844d..0000000
--- a/src/test/java/freemarker/manual/TemplateConfigurerExamples.java
+++ /dev/null
@@ -1,186 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- * 
- *   http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package freemarker.manual;
-
-import static org.junit.Assert.*;
-
-import java.util.Date;
-
-import org.junit.Test;
-
-import freemarker.cache.ConditionalTemplateConfigurerFactory;
-import freemarker.cache.FileExtensionMatcher;
-import freemarker.cache.FileNameGlobMatcher;
-import freemarker.cache.FirstMatchTemplateConfigurerFactory;
-import freemarker.cache.MergingTemplateConfigurerFactory;
-import freemarker.cache.OrMatcher;
-import freemarker.cache.PathGlobMatcher;
-import freemarker.core.HTMLOutputFormat;
-import freemarker.core.PlainTextOutputFormat;
-import freemarker.core.TemplateConfigurer;
-import freemarker.core.UndefinedOutputFormat;
-import freemarker.core.XMLOutputFormat;
-import freemarker.template.Configuration;
-import freemarker.template.Template;
-import freemarker.template.utility.DateUtil;
-
-public class TemplateConfigurerExamples extends ExamplesTest {
-
-    @Test
-    public void example1() throws Exception {
-        Configuration cfg = getConfiguration();
-
-        addTemplate("t.xml", "");
-        
-        TemplateConfigurer tcUTF8XML = new TemplateConfigurer();
-        tcUTF8XML.setEncoding("utf-8");
-        tcUTF8XML.setOutputFormat(XMLOutputFormat.INSTANCE);
-
-        {
-            cfg.setTemplateConfigurers(new ConditionalTemplateConfigurerFactory(
-                    new FileExtensionMatcher("xml"), tcUTF8XML));
-            
-            Template t = cfg.getTemplate("t.xml");
-            assertEquals("utf-8", t.getEncoding());
-            assertEquals(XMLOutputFormat.INSTANCE, t.getOutputFormat());
-        }
-
-        {
-            cfg.setTemplateConfigurers(null);
-            cfg.setSettings(loadPropertiesFile("TemplateConfigurerExamples1.properties"));
-            
-            Template t = cfg.getTemplate("t.xml");
-            assertEquals("utf-8", t.getEncoding());
-            assertEquals(XMLOutputFormat.INSTANCE, t.getOutputFormat());
-        }
-    }
-
-    @Test
-    public void example2() throws Exception {
-        Configuration cfg = getConfiguration();
-        
-        addTemplate("t.subject.ftl", "");
-        addTemplate("mail/t.subject.ftl", "");
-        addTemplate("mail/t.body.ftl", "");
-
-        TemplateConfigurer tcSubject = new TemplateConfigurer();
-        tcSubject.setOutputFormat(PlainTextOutputFormat.INSTANCE);
-        
-        TemplateConfigurer tcBody = new TemplateConfigurer();
-        tcBody.setOutputFormat(HTMLOutputFormat.INSTANCE);
-        
-        cfg.setTemplateConfigurers(
-                new ConditionalTemplateConfigurerFactory(
-                        new PathGlobMatcher("mail/**"),
-                        new FirstMatchTemplateConfigurerFactory(
-                                new ConditionalTemplateConfigurerFactory(
-                                        new FileNameGlobMatcher("*.subject.*"),
-                                        tcSubject),
-                                new ConditionalTemplateConfigurerFactory(
-                                        new FileNameGlobMatcher("*.body.*"),
-                                        tcBody)
-                                )
-                                .noMatchErrorDetails("Mail template names must contain \".subject.\" or \".body.\"!")
-                        ));
-        
-        assertEquals(UndefinedOutputFormat.INSTANCE, cfg.getTemplate("t.subject.ftl").getOutputFormat());
-        assertEquals(PlainTextOutputFormat.INSTANCE, cfg.getTemplate("mail/t.subject.ftl").getOutputFormat());
-        assertEquals(HTMLOutputFormat.INSTANCE, cfg.getTemplate("mail/t.body.ftl").getOutputFormat());
-        
-        // From properties:
-        
-        cfg.setTemplateConfigurers(null);
-        cfg.setSettings(loadPropertiesFile("TemplateConfigurerExamples2.properties"));
-        
-        assertEquals(UndefinedOutputFormat.INSTANCE, cfg.getTemplate("t.subject.ftl").getOutputFormat());
-        assertEquals(PlainTextOutputFormat.INSTANCE, cfg.getTemplate("mail/t.subject.ftl").getOutputFormat());
-        assertEquals(HTMLOutputFormat.INSTANCE, cfg.getTemplate("mail/t.body.ftl").getOutputFormat());
-    };
-    
-    @Test
-    public void example3() throws Exception {
-        Configuration cfg = getConfiguration();
-        cfg.setDefaultEncoding("ISO-8859-1");
-        cfg.setSharedVariable("ts", new Date(1440431606011L));
-        
-        addTemplate("t.stats.html", "${ts?datetime} ${ts?date} ${ts?time}");
-        addTemplate("t.html", "");
-        addTemplate("t.htm", "");
-        addTemplate("t.xml", "");
-        addTemplate("mail/t.html", "");
-
-        TemplateConfigurer tcStats = new TemplateConfigurer();
-        tcStats.setDateTimeFormat("iso");
-        tcStats.setDateFormat("iso");
-        tcStats.setTimeFormat("iso");
-        tcStats.setTimeZone(DateUtil.UTC);
-
-        TemplateConfigurer tcMail = new TemplateConfigurer();
-        tcMail.setEncoding("utf-8");
-        
-        TemplateConfigurer tcHTML = new TemplateConfigurer();
-        tcHTML.setOutputFormat(HTMLOutputFormat.INSTANCE);
-        
-        TemplateConfigurer tcXML = new TemplateConfigurer();
-        tcXML.setOutputFormat(XMLOutputFormat.INSTANCE);
-        
-        cfg.setTemplateConfigurers(
-                new MergingTemplateConfigurerFactory(
-                        new ConditionalTemplateConfigurerFactory(
-                                new FileNameGlobMatcher("*.stats.*"),
-                                tcStats),
-                        new ConditionalTemplateConfigurerFactory(
-                                new PathGlobMatcher("mail/**"),
-                                tcMail),
-                        new FirstMatchTemplateConfigurerFactory(
-                                new ConditionalTemplateConfigurerFactory(
-                                        new FileExtensionMatcher("xml"),
-                                        tcXML),
-                                new ConditionalTemplateConfigurerFactory(
-                                        new OrMatcher(
-                                                new FileExtensionMatcher("html"),
-                                                new FileExtensionMatcher("htm")),
-                                        tcHTML)
-                        ).allowNoMatch(true)
-                )
-        );
-        
-        assertEquals(HTMLOutputFormat.INSTANCE, cfg.getTemplate("t.html").getOutputFormat());
-        assertEquals("ISO-8859-1", cfg.getTemplate("t.html").getEncoding());
-        assertEquals(HTMLOutputFormat.INSTANCE, cfg.getTemplate("t.htm").getOutputFormat());
-        assertEquals(XMLOutputFormat.INSTANCE, cfg.getTemplate("t.xml").getOutputFormat());
-        assertEquals(HTMLOutputFormat.INSTANCE, cfg.getTemplate("t.stats.html").getOutputFormat());
-        assertOutputForNamed("t.stats.html", "2015-08-24T15:53:26.011Z 2015-08-24 15:53:26.011Z");
-        assertEquals("utf-8", cfg.getTemplate("mail/t.html").getEncoding());
-        
-        // From properties:
-        
-        cfg.setTemplateConfigurers(null);
-        cfg.setSettings(loadPropertiesFile("TemplateConfigurerExamples3.properties"));
-        
-        assertEquals(HTMLOutputFormat.INSTANCE, cfg.getTemplate("t.html").getOutputFormat());
-        assertEquals("ISO-8859-1", cfg.getTemplate("t.html").getEncoding());
-        assertEquals(HTMLOutputFormat.INSTANCE, cfg.getTemplate("t.htm").getOutputFormat());
-        assertEquals(XMLOutputFormat.INSTANCE, cfg.getTemplate("t.xml").getOutputFormat());
-        assertEquals(HTMLOutputFormat.INSTANCE, cfg.getTemplate("t.stats.html").getOutputFormat());
-        assertOutputForNamed("t.stats.html", "2015-08-24T15:53:26.011Z 2015-08-24 15:53:26.011Z");
-        assertEquals("utf-8", cfg.getTemplate("mail/t.html").getEncoding());
-    }
-    
-}

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/ea5c47d1/src/test/java/freemarker/template/ConfigurationTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/freemarker/template/ConfigurationTest.java b/src/test/java/freemarker/template/ConfigurationTest.java
index b7de38e..9e69d90 100644
--- a/src/test/java/freemarker/template/ConfigurationTest.java
+++ b/src/test/java/freemarker/template/ConfigurationTest.java
@@ -66,7 +66,6 @@ import freemarker.core.HTMLOutputFormat;
 import freemarker.core.HexTemplateNumberFormatFactory;
 import freemarker.core.MarkupOutputFormat;
 import freemarker.core.OutputFormat;
-import freemarker.core.ParseException;
 import freemarker.core.RTFOutputFormat;
 import freemarker.core.TemplateDateFormatFactory;
 import freemarker.core.TemplateNumberFormatFactory;
@@ -812,9 +811,9 @@ public class ConfigurationTest extends TestCase {
         assertEquals(0, cache.getSize());
     }
     
-    public void testSetTemplateConfigurers() throws TemplateException, TemplateNotFoundException, MalformedTemplateNameException, ParseException, IOException {
+    public void testSetTemplateConfigurations() throws Exception {
         Configuration cfg = new Configuration(Configuration.VERSION_2_3_23);
-        assertNull(cfg.getTemplateConfigurers());
+        assertNull(cfg.getTemplateConfigurations());
 
         StringTemplateLoader tl = new StringTemplateLoader();
         tl.putTemplate("t.de.ftlh", "");
@@ -825,25 +824,25 @@ public class ConfigurationTest extends TestCase {
         
         cfg.setTimeZone(TimeZone.getTimeZone("GMT+09"));
         
-        cfg.setSetting(Configuration.TEMPLATE_CONFIGURERS_KEY,
-                "MergingTemplateConfigurerFactory("
-                    + "FirstMatchTemplateConfigurerFactory("
-                        + "ConditionalTemplateConfigurerFactory("
-                            + "FileNameGlobMatcher('*.de.*'), TemplateConfigurer(timeZone=TimeZone('GMT+01'))), "
-                        + "ConditionalTemplateConfigurerFactory("
-                            + "FileNameGlobMatcher('*.fr.*'), TemplateConfigurer(timeZone=TimeZone('GMT'))), "
+        cfg.setSetting(Configuration.TEMPLATE_CONFIGURATIONS_KEY,
+                "MergingTemplateConfigurationFactory("
+                    + "FirstMatchTemplateConfigurationFactory("
+                        + "ConditionalTemplateConfigurationFactory("
+                            + "FileNameGlobMatcher('*.de.*'), TemplateConfiguration(timeZone=TimeZone('GMT+01'))), "
+                        + "ConditionalTemplateConfigurationFactory("
+                            + "FileNameGlobMatcher('*.fr.*'), TemplateConfiguration(timeZone=TimeZone('GMT'))), "
                         + "allowNoMatch=true"
                     + "), "
-                    + "FirstMatchTemplateConfigurerFactory("
-                        + "ConditionalTemplateConfigurerFactory("
-                            + "FileExtensionMatcher('ftlh'), TemplateConfigurer(booleanFormat='TODO,HTML')), "
-                        + "ConditionalTemplateConfigurerFactory("
-                            + "FileExtensionMatcher('ftlx'), TemplateConfigurer(booleanFormat='TODO,XML')), "
+                    + "FirstMatchTemplateConfigurationFactory("
+                        + "ConditionalTemplateConfigurationFactory("
+                            + "FileExtensionMatcher('ftlh'), TemplateConfiguration(booleanFormat='TODO,HTML')), "
+                        + "ConditionalTemplateConfigurationFactory("
+                            + "FileExtensionMatcher('ftlx'), TemplateConfiguration(booleanFormat='TODO,XML')), "
                         + "noMatchErrorDetails='Unrecognized template file extension'"
                     + "), "
-                    + "ConditionalTemplateConfigurerFactory("
+                    + "ConditionalTemplateConfigurationFactory("
                         + "PathGlobMatcher('stat/**', caseInsensitive=true), "
-                        + "TemplateConfigurer(timeZone=TimeZone('UTC'))"
+                        + "TemplateConfiguration(timeZone=TimeZone('UTC'))"
                     + ")"
                 + ")");
         
@@ -868,9 +867,9 @@ public class ConfigurationTest extends TestCase {
             assertEquals(DateUtil.UTC, t.getTimeZone());
         }
         
-        assertNotNull(cfg.getTemplateConfigurers());
-        cfg.setSetting(Configuration.TEMPLATE_CONFIGURERS_KEY, "null");
-        assertNull(cfg.getTemplateConfigurers());
+        assertNotNull(cfg.getTemplateConfigurations());
+        cfg.setSetting(Configuration.TEMPLATE_CONFIGURATIONS_KEY, "null");
+        assertNull(cfg.getTemplateConfigurations());
     }
 
     public void testSetAutoEscaping() throws Exception {
@@ -1013,7 +1012,7 @@ public class ConfigurationTest extends TestCase {
                 new ArrayList(cfg.getRegisteredCustomOutputFormats()));
         
         try {
-            cfg.setSetting(Configuration.REGISTERED_CUSTOM_OUTPUT_FORMATS_KEY_SNAKE_CASE, "[TemplateConfigurer()]");
+            cfg.setSetting(Configuration.REGISTERED_CUSTOM_OUTPUT_FORMATS_KEY_SNAKE_CASE, "[TemplateConfiguration()]");
             fail();
         } catch (Exception e) {
             assertThat(e.getCause().getMessage(), containsString(OutputFormat.class.getSimpleName()));

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/ea5c47d1/src/test/resources/freemarker/manual/ConfigureOutputFormatExamples1.properties
----------------------------------------------------------------------
diff --git a/src/test/resources/freemarker/manual/ConfigureOutputFormatExamples1.properties b/src/test/resources/freemarker/manual/ConfigureOutputFormatExamples1.properties
index 0f59312..f21272a 100644
--- a/src/test/resources/freemarker/manual/ConfigureOutputFormatExamples1.properties
+++ b/src/test/resources/freemarker/manual/ConfigureOutputFormatExamples1.properties
@@ -1,4 +1,4 @@
-templateConfigurers = \
-    ConditionalTemplateConfigurerFactory( \
+templateConfigurations = \
+    ConditionalTemplateConfigurationFactory( \
         PathGlobMatcher("mail/**"), \
-        TemplateConfigurer(outputFormat = HTMLOutputFormat()))
\ No newline at end of file
+        TemplateConfiguration(outputFormat = HTMLOutputFormat()))
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/ea5c47d1/src/test/resources/freemarker/manual/ConfigureOutputFormatExamples2.properties
----------------------------------------------------------------------
diff --git a/src/test/resources/freemarker/manual/ConfigureOutputFormatExamples2.properties b/src/test/resources/freemarker/manual/ConfigureOutputFormatExamples2.properties
index 23fcee3..b01090b 100644
--- a/src/test/resources/freemarker/manual/ConfigureOutputFormatExamples2.properties
+++ b/src/test/resources/freemarker/manual/ConfigureOutputFormatExamples2.properties
@@ -1,14 +1,14 @@
-templateConfigurers = \
-    FirstMatchTemplateConfigurerFactory( \
-        ConditionalTemplateConfigurerFactory( \
+templateConfigurations = \
+    FirstMatchTemplateConfigurationFactory( \
+        ConditionalTemplateConfigurationFactory( \
             FileExtensionMatcher("xml"), \
-            TemplateConfigurer(outputFormat = XMLOutputFormat())), \
-        ConditionalTemplateConfigurerFactory( \
+            TemplateConfiguration(outputFormat = XMLOutputFormat())), \
+        ConditionalTemplateConfigurationFactory( \
             OrMatcher( \
                 FileExtensionMatcher("html"), \
                 FileExtensionMatcher("htm")), \
-            TemplateConfigurer(outputFormat = HTMLOutputFormat())), \
-        ConditionalTemplateConfigurerFactory( \
+            TemplateConfiguration(outputFormat = HTMLOutputFormat())), \
+        ConditionalTemplateConfigurationFactory( \
             FileExtensionMatcher("rtf"), \
-            TemplateConfigurer(outputFormat = RTFOutputFormat())), \
+            TemplateConfiguration(outputFormat = RTFOutputFormat())), \
         allowNoMatch = true)

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/ea5c47d1/src/test/resources/freemarker/manual/TemplateConfigurationExamples1.properties
----------------------------------------------------------------------
diff --git a/src/test/resources/freemarker/manual/TemplateConfigurationExamples1.properties b/src/test/resources/freemarker/manual/TemplateConfigurationExamples1.properties
new file mode 100644
index 0000000..b6edf1a
--- /dev/null
+++ b/src/test/resources/freemarker/manual/TemplateConfigurationExamples1.properties
@@ -0,0 +1,8 @@
+templateConfigurations = \
+    ConditionalTemplateConfigurationFactory( \
+        FileExtensionMatcher("xml"), \
+        TemplateConfiguration( \
+            encoding = "utf-8", \
+            outputFormat = XMLOutputFormat() \
+        ) \
+    )
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/ea5c47d1/src/test/resources/freemarker/manual/TemplateConfigurationExamples2.properties
----------------------------------------------------------------------
diff --git a/src/test/resources/freemarker/manual/TemplateConfigurationExamples2.properties b/src/test/resources/freemarker/manual/TemplateConfigurationExamples2.properties
new file mode 100644
index 0000000..a39acca
--- /dev/null
+++ b/src/test/resources/freemarker/manual/TemplateConfigurationExamples2.properties
@@ -0,0 +1,15 @@
+templateConfigurations = \
+    ConditionalTemplateConfigurationFactory( \
+        PathGlobMatcher("mail/**"), \
+        FirstMatchTemplateConfigurationFactory( \
+            ConditionalTemplateConfigurationFactory( \
+                FileNameGlobMatcher("*.subject.*"), \
+                TemplateConfiguration(outputFormat = PlainTextOutputFormat()) \
+            ), \
+            ConditionalTemplateConfigurationFactory( \
+                FileNameGlobMatcher("*.body.*"), \
+                TemplateConfiguration(outputFormat = HTMLOutputFormat()) \
+            ), \
+            noMatchErrorDetails = 'Mail template names must contain ".subject." or ".body."!' \
+        ) \
+    )

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/ea5c47d1/src/test/resources/freemarker/manual/TemplateConfigurationExamples3.properties
----------------------------------------------------------------------
diff --git a/src/test/resources/freemarker/manual/TemplateConfigurationExamples3.properties b/src/test/resources/freemarker/manual/TemplateConfigurationExamples3.properties
new file mode 100644
index 0000000..424330b
--- /dev/null
+++ b/src/test/resources/freemarker/manual/TemplateConfigurationExamples3.properties
@@ -0,0 +1,30 @@
+templateConfigurations = \
+    MergingTemplateConfigurationFactory( \
+        ConditionalTemplateConfigurationFactory( \
+            FileNameGlobMatcher("*.stats.*"), \
+            TemplateConfiguration( \
+                dateTimeFormat = "iso", \
+                dateFormat = "iso", \
+                timeFormat = "iso", \
+                timeZone = TimeZone("UTC") \
+            ) \
+        ), \
+        ConditionalTemplateConfigurationFactory( \
+            PathGlobMatcher("mail/**"), \
+            TemplateConfiguration(encoding = "utf-8") \
+        ), \
+        FirstMatchTemplateConfigurationFactory( \
+            ConditionalTemplateConfigurationFactory( \
+                FileExtensionMatcher("xml"), \
+                TemplateConfiguration(outputFormat = XMLOutputFormat()) \
+            ), \
+            ConditionalTemplateConfigurationFactory( \
+                OrMatcher( \
+                    FileExtensionMatcher("html"), \
+                    FileExtensionMatcher("htm") \
+                ), \
+                TemplateConfiguration(outputFormat = HTMLOutputFormat()) \
+            ), \
+            allowNoMatch = true \
+        ) \
+    )