freemarker-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ddek...@apache.org
Subject [04/20] incubator-freemarker git commit: Removed BeansWrapper, merging it into DefaultObjectWrapper (the o.a.f.core.model.impl.beans packageis gone now). It works, but there's a lot of unused classes and logic now, which will have to be removed.
Date Tue, 28 Feb 2017 22:57:38 GMT
http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/051a0822/src/test/java/org/apache/freemarker/core/model/impl/beans/BeansWrapperMiscTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/freemarker/core/model/impl/beans/BeansWrapperMiscTest.java b/src/test/java/org/apache/freemarker/core/model/impl/beans/BeansWrapperMiscTest.java
deleted file mode 100644
index fd20bd6..0000000
--- a/src/test/java/org/apache/freemarker/core/model/impl/beans/BeansWrapperMiscTest.java
+++ /dev/null
@@ -1,57 +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 org.apache.freemarker.core.model.impl.beans;
-
-import static org.junit.Assert.*;
-
-import org.apache.freemarker.core.Configuration;
-import org.apache.freemarker.core.model.TemplateBooleanModel;
-import org.apache.freemarker.core.model.TemplateHashModel;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.JUnit4;
-
-@RunWith(JUnit4.class)
-public class BeansWrapperMiscTest {
-
-    @Test
-    public void booleans() throws Exception {
-        final BeansWrapper bw = new BeansWrapper(Configuration.VERSION_3_0_0);
-
-        assertTrue(((TemplateBooleanModel) bw.wrap(Boolean.TRUE)).getAsBoolean());
-        assertFalse(((TemplateBooleanModel) bw.wrap(Boolean.FALSE)).getAsBoolean());
-        
-        TemplateHashModel tm = (TemplateHashModel) bw.wrap(Boolean.TRUE);
-        assertNotNull(tm.get("hashCode"));
-        assertNotNull(tm.get("class"));
-        bw.setExposureLevel(BeansWrapper.EXPOSE_PROPERTIES_ONLY);
-        assertNull(tm.get("hashCode"));
-        assertNotNull(tm.get("class"));
-        bw.setExposureLevel(BeansWrapper.EXPOSE_NOTHING);
-        assertNull(tm.get("hashCode"));
-        assertNull(tm.get("class"));
-        bw.setExposureLevel(BeansWrapper.EXPOSE_ALL);
-        assertNotNull(tm.get("hashCode"));
-        assertNotNull(tm.get("class"));
-        
-        assertSame(tm, bw.wrap(Boolean.TRUE));
-    }
-    
-}

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/051a0822/src/test/java/org/apache/freemarker/core/model/impl/beans/BeansWrapperReadOnlyTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/freemarker/core/model/impl/beans/BeansWrapperReadOnlyTest.java b/src/test/java/org/apache/freemarker/core/model/impl/beans/BeansWrapperReadOnlyTest.java
deleted file mode 100644
index 2ab748f..0000000
--- a/src/test/java/org/apache/freemarker/core/model/impl/beans/BeansWrapperReadOnlyTest.java
+++ /dev/null
@@ -1,95 +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 org.apache.freemarker.core.model.impl.beans;
-
-import java.beans.BeanInfo;
-import java.beans.Introspector;
-import java.beans.PropertyDescriptor;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-
-import org.apache.freemarker.core.Configuration;
-import org.apache.freemarker.core.model.ObjectWrapper;
-import org.apache.freemarker.core.model.impl.DefaultObjectWrapper;
-import org.apache.freemarker.core.util.WriteProtectable;
-import org.apache.freemarker.core.util._ClassUtil;
-
-import junit.framework.TestCase;
-
-/**
- * Tests if all JavaBean properties of the standard {@link ObjectWrapper} classes are locked by
- * {@link WriteProtectable#writeProtect()}. 
- */
-public class BeansWrapperReadOnlyTest extends TestCase {
-
-    private static final String EXPECTED_MESSAGE_PART = "write protected";
-
-    public BeansWrapperReadOnlyTest(String name) {
-        super(name);
-    }
-    
-    public void testBeansWrapper() throws Exception {
-        BeansWrapper bw = new BeansWrapper(Configuration.VERSION_3_0_0);
-        bw.writeProtect();
-        checkAllPropertiesReadOnly(bw);
-    }
-
-    public void testDefaultObjectWrapper() throws Exception {
-        BeansWrapper bw = new DefaultObjectWrapper(Configuration.VERSION_3_0_0);
-        bw.writeProtect();
-        checkAllPropertiesReadOnly(bw);        
-    }
-    
-    private void checkAllPropertiesReadOnly(Object o) throws Exception {
-        BeanInfo bi = Introspector.getBeanInfo(o.getClass());
-        for (PropertyDescriptor pd : bi.getPropertyDescriptors()) {
-            Method setter = pd.getWriteMethod();
-            if (setter != null) {
-                Class t = pd.getPropertyType();
-                
-                Object val;
-                if (_ClassUtil.isNumerical(t)) {
-                    val = Byte.valueOf((byte) 1);
-                } else if (t == boolean.class) {
-                    val = Boolean.TRUE;
-                } else if (t == char.class) {
-                    val = Character.valueOf('c');
-                } else if (t.isAssignableFrom(String.class)) {
-                    val = "s";
-                } else {
-                    val = null;
-                }
-                try {
-                    setter.invoke(o, val);
-                    fail("This setter should have failed as the property should be read-only now: " + setter);
-                } catch (InvocationTargetException e) {
-                    Throwable target = e.getTargetException();
-                    if (!(target instanceof IllegalStateException
-                            && target.getMessage() != null
-                            && target.getMessage().contains(EXPECTED_MESSAGE_PART))) {
-                        fail("Expected IllegalStateException with message containing \"" + EXPECTED_MESSAGE_PART
-                                + "\", got this instead: " + target);
-                    }
-                }
-            }
-        }
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/051a0822/src/test/java/org/apache/freemarker/core/model/impl/beans/BeansWrapperSingletonsTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/freemarker/core/model/impl/beans/BeansWrapperSingletonsTest.java b/src/test/java/org/apache/freemarker/core/model/impl/beans/BeansWrapperSingletonsTest.java
deleted file mode 100644
index 027e6f2..0000000
--- a/src/test/java/org/apache/freemarker/core/model/impl/beans/BeansWrapperSingletonsTest.java
+++ /dev/null
@@ -1,743 +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 org.apache.freemarker.core.model.impl.beans;
-
-import static org.hamcrest.Matchers.*;
-import static org.junit.Assert.*;
-
-import java.lang.ref.Reference;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.freemarker.core.Configuration;
-import org.apache.freemarker.core.Version;
-import org.apache.freemarker.core.model.TemplateDateModel;
-import org.apache.freemarker.core.model.TemplateHashModel;
-import org.apache.freemarker.core.model.TemplateModelException;
-import org.apache.freemarker.core.model.TemplateScalarModel;
-import org.apache.freemarker.core.model.impl.SimpleObjectWrapper;
-import org.apache.freemarker.core.model.impl._ModelImplApi;
-import org.apache.freemarker.core.model.impl.beans.BeansWrapper.MethodAppearanceDecision;
-import org.apache.freemarker.core.model.impl.beans.BeansWrapper.MethodAppearanceDecisionInput;
-import org.apache.freemarker.test.util.TestUtil;
-
-import junit.framework.TestCase;
-
-public class BeansWrapperSingletonsTest extends TestCase {
-
-    public BeansWrapperSingletonsTest(String name) {
-        super(name);
-    }
-    
-    @Override
-    protected void setUp() throws Exception {
-        BeansWrapperBuilder.clearInstanceCache();  // otherwise ClassInrospector cache couldn't become cleared in reality
-        _ModelImplApi.DefaultObjectWrapperFactory_clearInstanceCache();
-        BeansWrapperBuilder.clearInstanceCache();
-    }
-
-    public void testBeansWrapperFactoryEquals() throws Exception {
-        assertEquals(Configuration.VERSION_3_0_0, new BeansWrapperBuilder(Configuration.VERSION_3_0_0).getIncompatibleImprovements());
-        try {
-            new BeansWrapperBuilder(TestUtil.getClosestFutureVersion());
-            fail("Maybe you need to update this test for the new FreeMarker version");
-        } catch (IllegalArgumentException e) {
-            assertThat(e.getMessage(), containsString("upgrade"));
-        }
-
-        BeansWrapperBuilder pa1;
-        BeansWrapperBuilder pa2;
-        
-        pa1 = new BeansWrapperBuilder(Configuration.VERSION_3_0_0);
-        pa2 = new BeansWrapperBuilder(Configuration.VERSION_3_0_0);
-        assertEquals(pa1, pa2);
-        
-        pa1.setSimpleMapWrapper(true);
-        assertNotEquals(pa1, pa2);
-        assertFalse(pa1.hashCode() == pa2.hashCode());
-        pa2.setSimpleMapWrapper(true);
-        assertEquals(pa1, pa2);
-        assertTrue(pa1.hashCode() == pa2.hashCode());
-        
-        pa1.setExposeFields(true);
-        assertNotEquals(pa1, pa2);
-        assertFalse(pa1.hashCode() == pa2.hashCode());
-        pa2.setExposeFields(true);
-        assertEquals(pa1, pa2);
-        assertTrue(pa1.hashCode() == pa2.hashCode());
-        
-        pa1.setExposureLevel(0);
-        assertNotEquals(pa1, pa2);
-        assertFalse(pa1.hashCode() == pa2.hashCode());
-        pa2.setExposureLevel(0);
-        assertEquals(pa1, pa2);
-        assertTrue(pa1.hashCode() == pa2.hashCode());
-        
-        pa1.setExposureLevel(1);
-        assertNotEquals(pa1, pa2);
-        assertFalse(pa1.hashCode() == pa2.hashCode());
-        pa2.setExposureLevel(1);
-        assertEquals(pa1, pa2);
-        assertTrue(pa1.hashCode() == pa2.hashCode());
-        
-        pa1.setDefaultDateType(TemplateDateModel.DATE);
-        assertNotEquals(pa1, pa2);
-        pa2.setDefaultDateType(TemplateDateModel.DATE);
-        assertEquals(pa1, pa2);
-        assertTrue(pa1.hashCode() == pa2.hashCode());
-        
-        pa1.setStrict(true);
-        assertNotEquals(pa1, pa2);
-        assertFalse(pa1.hashCode() == pa2.hashCode());
-        pa2.setStrict(true);
-        assertEquals(pa1, pa2);
-        assertTrue(pa1.hashCode() == pa2.hashCode());
-
-        pa1.setUseModelCache(true);
-        assertNotEquals(pa1, pa2);
-        assertFalse(pa1.hashCode() == pa2.hashCode());
-        pa2.setUseModelCache(true);
-        assertEquals(pa1, pa2);
-        assertTrue(pa1.hashCode() == pa2.hashCode());
-        
-        AlphabeticalMethodSorter ms = new AlphabeticalMethodSorter(true);
-        pa1.setMethodSorter(ms);
-        assertNotEquals(pa1, pa2);
-        pa2.setMethodSorter(ms);
-        assertEquals(pa1, pa2);
-        assertTrue(pa1.hashCode() == pa2.hashCode());
-        
-        MethodAppearanceFineTuner maft = new MethodAppearanceFineTuner() {
-            @Override
-            public void process(MethodAppearanceDecisionInput in, MethodAppearanceDecision out) { }
-        };
-        pa1.setMethodAppearanceFineTuner(maft);
-        assertNotEquals(pa1, pa2);
-        pa2.setMethodAppearanceFineTuner(maft);
-        assertEquals(pa1, pa2);
-        assertTrue(pa1.hashCode() == pa2.hashCode());
-    }
-    
-    public void testBeansWrapperFactoryProducts() throws Exception {
-        List<BeansWrapper> hardReferences = new LinkedList<>();
-        
-        assertEquals(0, getBeansWrapperInstanceCacheSize());
-        
-        {
-            BeansWrapper bw = getBeansWrapperWithSetting(Configuration.VERSION_3_0_0, true);
-            assertEquals(1, getBeansWrapperInstanceCacheSize());
-            assertSame(bw.getClass(), BeansWrapper.class);
-            assertEquals(Configuration.VERSION_3_0_0, bw.getIncompatibleImprovements());
-            assertTrue(bw.isWriteProtected());
-            assertTrue(bw.isSimpleMapWrapper());
-            assertThat(bw.wrap(new HashMap()), instanceOf(SimpleMapModel.class));
-            assertFalse(bw.isStrict());
-            assertFalse(bw.getUseModelCache());
-            assertEquals(TemplateDateModel.UNKNOWN, bw.getDefaultDateType());
-            assertSame(bw, bw.getOuterIdentity());
-            assertTrue(bw.isClassIntrospectionCacheRestricted());
-            assertNull(bw.getMethodAppearanceFineTuner());
-            assertNull(bw.getMethodSorter());
-            
-            try {
-                bw.setExposeFields(true);  // can't modify the settings of a (potential) singleton
-                fail();
-            } catch (IllegalStateException e) {
-                assertThat(e.getMessage(), containsString("modify"));
-            }
-            
-            assertSame(bw, getBeansWrapperWithSetting(Configuration.VERSION_3_0_0, true));
-            assertEquals(1, getBeansWrapperInstanceCacheSize());
-            
-            hardReferences.add(bw);            
-        }
-        
-        {
-            BeansWrapper bw = getBeansWrapperWithSetting(Configuration.VERSION_3_0_0, false);
-            assertEquals(2, getBeansWrapperInstanceCacheSize());
-            assertSame(bw.getClass(), BeansWrapper.class);
-            assertEquals(Configuration.VERSION_3_0_0, bw.getIncompatibleImprovements());
-            assertTrue(bw.isWriteProtected());
-            assertFalse(bw.isSimpleMapWrapper());
-            assertThat(bw.wrap(new HashMap()), instanceOf(MapModel.class));
-            
-            assertSame(bw, getBeansWrapperWithSetting(Configuration.VERSION_3_0_0, false));
-            
-            hardReferences.add(bw);            
-        }
-        
-        {
-            BeansWrapperBuilder factory = new BeansWrapperBuilder(Configuration.VERSION_3_0_0);
-            factory.setExposureLevel(BeansWrapper.EXPOSE_PROPERTIES_ONLY);
-            BeansWrapper bw = factory.build();
-            BeansWrapper bw2 = factory.build();
-            assertEquals(3, getBeansWrapperInstanceCacheSize());
-            assertSame(bw, bw2);
-            
-            assertSame(bw.getClass(), BeansWrapper.class);
-            assertEquals(Configuration.VERSION_3_0_0, bw.getIncompatibleImprovements());
-            assertTrue(bw.isWriteProtected());
-            assertFalse(bw.isSimpleMapWrapper());
-            assertThat(bw.wrap(new HashMap()), instanceOf(MapModel.class));
-            assertEquals(BeansWrapper.EXPOSE_PROPERTIES_ONLY, bw.getExposureLevel());
-            assertFalse(bw.isStrict());
-            assertEquals(TemplateDateModel.UNKNOWN, bw.getDefaultDateType());
-            assertSame(bw, bw.getOuterIdentity());
-            
-            hardReferences.add(bw);            
-        }
-        
-        {
-            BeansWrapperBuilder factory = new BeansWrapperBuilder(Configuration.VERSION_3_0_0);
-            factory.setExposeFields(true);
-            BeansWrapper bw = factory.build();
-            BeansWrapper bw2 = factory.build();
-            assertEquals(4, getBeansWrapperInstanceCacheSize());
-            assertSame(bw, bw2);
-            
-            assertSame(bw.getClass(), BeansWrapper.class);
-            assertEquals(Configuration.VERSION_3_0_0, bw.getIncompatibleImprovements());
-            assertTrue(bw.isWriteProtected());
-            assertFalse(bw.isSimpleMapWrapper());
-            assertTrue(bw.isExposeFields());
-            
-            hardReferences.add(bw);            
-        }
-        
-        {
-            BeansWrapperBuilder factory = new BeansWrapperBuilder(Configuration.VERSION_3_0_0);
-            factory.setStrict(true);
-            factory.setDefaultDateType(TemplateDateModel.DATETIME);
-            factory.setOuterIdentity(new SimpleObjectWrapper(Configuration.VERSION_3_0_0));
-            BeansWrapper bw = factory.build();
-            assertEquals(5, getBeansWrapperInstanceCacheSize());
-            assertTrue(bw.isStrict());
-            assertEquals(TemplateDateModel.DATETIME, bw.getDefaultDateType());
-            assertSame(SimpleObjectWrapper.class, bw.getOuterIdentity().getClass());
-            
-            hardReferences.add(bw);            
-        }
-        
-        // Effect of reference and cache clearings:
-        {
-            BeansWrapper bw1 = new BeansWrapperBuilder(Configuration.VERSION_3_0_0).build();
-            assertEquals(5, getBeansWrapperInstanceCacheSize());
-            assertEquals(5, getBeansWrapperNonClearedInstanceCacheSize());
-            
-            clearBeansWrapperInstanceCacheReferences(false);
-            assertEquals(5, getBeansWrapperInstanceCacheSize());
-            assertEquals(0, getBeansWrapperNonClearedInstanceCacheSize());
-            
-            BeansWrapper bw2 = new BeansWrapperBuilder(Configuration.VERSION_3_0_0).build();
-            assertNotSame(bw1, bw2);
-            assertEquals(5, getBeansWrapperInstanceCacheSize());
-            assertEquals(1, getBeansWrapperNonClearedInstanceCacheSize());
-            
-            assertSame(bw2, new BeansWrapperBuilder(Configuration.VERSION_3_0_0).build());
-            assertEquals(1, getBeansWrapperNonClearedInstanceCacheSize());
-            
-            clearBeansWrapperInstanceCacheReferences(true);
-            BeansWrapper bw3 = new BeansWrapperBuilder(Configuration.VERSION_3_0_0).build();
-            assertNotSame(bw2, bw3);
-            assertEquals(1, getBeansWrapperInstanceCacheSize());
-            assertEquals(1, getBeansWrapperNonClearedInstanceCacheSize());
-        }
-
-        {
-            BeansWrapperBuilder factory = new BeansWrapperBuilder(Configuration.VERSION_3_0_0);
-            factory.setUseModelCache(true);
-            BeansWrapper bw = factory.build();
-            assertTrue(bw.getUseModelCache());
-            assertEquals(2, getBeansWrapperInstanceCacheSize());
-            
-            hardReferences.add(bw);            
-        }
-        
-        assertTrue(hardReferences.size() != 0);  // just to save it from GC until this line        
-    }
-    
-    private BeansWrapper getBeansWrapperWithSetting(Version ici, boolean simpleMapWrapper) {
-        BeansWrapperBuilder f = new BeansWrapperBuilder(ici);
-        f.setSimpleMapWrapper(simpleMapWrapper);
-        return f.build();
-    }
-
-    public void testMultipleTCCLs() {
-        List<BeansWrapper> hardReferences = new LinkedList<>();
-        
-        assertEquals(0, getBeansWrapperInstanceCacheSize());
-        
-        BeansWrapper bw1 = new BeansWrapperBuilder(Configuration.VERSION_3_0_0).build();
-        assertEquals(1, getBeansWrapperInstanceCacheSize());
-        hardReferences.add(bw1);
-        
-        ClassLoader oldTCCL = Thread.currentThread().getContextClassLoader();
-        // Doesn't mater what, just be different from oldTCCL: 
-        ClassLoader newTCCL = oldTCCL == null ? getClass().getClassLoader() : null;
-        
-        BeansWrapper bw2;
-        Thread.currentThread().setContextClassLoader(newTCCL);
-        try {
-            bw2 = new BeansWrapperBuilder(Configuration.VERSION_3_0_0).build();
-            assertEquals(2, getBeansWrapperInstanceCacheSize());
-            hardReferences.add(bw2);
-            
-            assertNotSame(bw1, bw2);
-            assertSame(bw2, new BeansWrapperBuilder(Configuration.VERSION_3_0_0).build());
-        } finally {
-            Thread.currentThread().setContextClassLoader(oldTCCL);
-        }
-        
-        assertSame(bw1, new BeansWrapperBuilder(Configuration.VERSION_3_0_0).build());
-        assertEquals(2, getBeansWrapperInstanceCacheSize());
-
-        BeansWrapper bw3;
-        Thread.currentThread().setContextClassLoader(newTCCL);
-        try {
-            assertSame(bw2, new BeansWrapperBuilder(Configuration.VERSION_3_0_0).build());
-            
-            BeansWrapperBuilder bwb = new BeansWrapperBuilder(Configuration.VERSION_3_0_0);
-            bwb.setExposeFields(true);
-            bw3 = bwb.build();
-            assertEquals(3, getBeansWrapperInstanceCacheSize());
-            hardReferences.add(bw3);
-        } finally {
-            Thread.currentThread().setContextClassLoader(oldTCCL);
-        }
-        
-        {
-            BeansWrapperBuilder bwb = new BeansWrapperBuilder(Configuration.VERSION_3_0_0);
-            bwb.setExposeFields(true);
-            BeansWrapper bw4 = bwb.build();
-            assertEquals(4, getBeansWrapperInstanceCacheSize());
-            assertNotSame(bw3, bw4);
-            hardReferences.add(bw4);
-        }
-        
-        assertTrue(hardReferences.size() != 0);  // just to save it from GC until this line        
-    }
-    
-    public void testClassInrospectorCache() throws TemplateModelException {
-        assertFalse(new BeansWrapper(Configuration.VERSION_3_0_0).isClassIntrospectionCacheRestricted());
-        assertTrue(new BeansWrapperBuilder(Configuration.VERSION_3_0_0).build().isClassIntrospectionCacheRestricted());
-        
-        ClassIntrospectorBuilder.clearInstanceCache();
-        BeansWrapperBuilder.clearInstanceCache();
-        checkClassIntrospectorCacheSize(0);
-        
-        List<BeansWrapper> hardReferences = new LinkedList<>();
-        BeansWrapperBuilder factory;
-        
-        {
-            factory = new BeansWrapperBuilder(Configuration.VERSION_3_0_0);
-            
-            BeansWrapper bw1 = factory.build();
-            checkClassIntrospectorCacheSize(1);
-            
-            factory.setExposureLevel(BeansWrapper.EXPOSE_SAFE);  // this was already set to this
-            factory.setSimpleMapWrapper(true);  // this shouldn't matter for the introspection cache
-            BeansWrapper bw2 = factory.build();
-            checkClassIntrospectorCacheSize(1);
-            
-            assertSame(bw2.getClassIntrospector(), bw1.getClassIntrospector());
-            assertNotSame(bw1, bw2);
-            
-            // Wrapping tests:
-            assertFalse(exposesFields(bw1));
-            assertTrue(exposesProperties(bw1));
-            assertTrue(exposesMethods(bw1));
-            assertFalse(exposesUnsafe(bw1));
-            assertFalse(isSimpleMapWrapper(bw1));
-            assertTrue(bw1.isClassIntrospectionCacheRestricted());
-            // Prevent introspection cache GC:
-            hardReferences.add(bw1);
-            hardReferences.add(bw2);
-        }
-        
-        {
-            factory = new BeansWrapperBuilder(Configuration.VERSION_3_0_0);
-            factory.setExposeFields(true);
-            BeansWrapper bw = factory.build();
-            checkClassIntrospectorCacheSize(2);
-            // Wrapping tests:
-            assertTrue(exposesFields(bw));
-            assertTrue(exposesProperties(bw));
-            assertTrue(exposesMethods(bw));
-            assertFalse(exposesUnsafe(bw));
-            assertFalse(isSimpleMapWrapper(bw));
-            // Prevent introspection cache GC:
-            hardReferences.add(bw);
-        }
-
-        {
-            factory.setExposureLevel(BeansWrapper.EXPOSE_ALL);
-            BeansWrapper bw = factory.build();
-            checkClassIntrospectorCacheSize(3);
-            // Wrapping tests:
-            assertTrue(exposesFields(bw));
-            assertTrue(exposesProperties(bw));
-            assertTrue(exposesMethods(bw));
-            assertTrue(exposesUnsafe(bw));
-            assertFalse(isSimpleMapWrapper(bw));
-            // Prevent introspection cache GC:
-            hardReferences.add(bw);
-        }
-        
-        {
-            factory.setExposeFields(false);
-            BeansWrapper bw = factory.build();
-            checkClassIntrospectorCacheSize(4);
-            // Wrapping tests:
-            assertFalse(exposesFields(bw));
-            assertTrue(exposesProperties(bw));
-            assertTrue(exposesMethods(bw));
-            assertTrue(exposesUnsafe(bw));
-            assertFalse(isSimpleMapWrapper(bw));
-            // Prevent introspection cache GC:
-            hardReferences.add(bw);
-        }
-        
-        {
-            factory.setExposureLevel(BeansWrapper.EXPOSE_NOTHING);
-            BeansWrapper bw = factory.build();
-            checkClassIntrospectorCacheSize(5);
-            // Wrapping tests:
-            assertFalse(exposesFields(bw));
-            assertFalse(exposesProperties(bw));
-            assertFalse(exposesMethods(bw));
-            assertFalse(exposesUnsafe(bw));
-            assertFalse(isSimpleMapWrapper(bw));
-            // Prevent introspection cache GC:
-            hardReferences.add(bw);
-        }
-
-        {
-            factory.setExposeFields(true);
-            BeansWrapper bw = factory.build();
-            checkClassIntrospectorCacheSize(6);
-            // Wrapping tests:
-            assertTrue(exposesFields(bw));
-            assertFalse(exposesProperties(bw));
-            assertFalse(exposesMethods(bw));
-            assertFalse(exposesUnsafe(bw));
-            assertFalse(isSimpleMapWrapper(bw));
-            // Prevent introspection cache GC:
-            hardReferences.add(bw);
-        }
-
-        {
-            factory.setExposureLevel(BeansWrapper.EXPOSE_PROPERTIES_ONLY);
-            BeansWrapper bw = factory.build();
-            checkClassIntrospectorCacheSize(7);
-            // Wrapping tests:
-            assertTrue(exposesFields(bw));
-            assertTrue(exposesProperties(bw));
-            assertFalse(exposesMethods(bw));
-            assertFalse(exposesUnsafe(bw));
-            assertFalse(isSimpleMapWrapper(bw));
-            // Prevent introspection cache GC:
-            hardReferences.add(bw);
-        }
-        
-        {
-            factory = new BeansWrapperBuilder(Configuration.VERSION_3_0_0);
-            factory.setExposeFields(false);
-            factory.setExposureLevel(BeansWrapper.EXPOSE_PROPERTIES_ONLY);
-            
-            BeansWrapper bw1 = factory.build();
-            checkClassIntrospectorCacheSize(8);
-            ClassIntrospector ci1 = bw1.getClassIntrospector();
-            
-            factory.setSimpleMapWrapper(true);  // Shouldn't mater
-            BeansWrapper bw2 = factory.build();
-            ClassIntrospector ci2 = bw2.getClassIntrospector();
-            checkClassIntrospectorCacheSize(8);
-            
-            assertSame(ci1, ci2);
-            assertNotSame(bw1, bw2);
-            
-            // Wrapping tests:
-            assertFalse(exposesFields(bw1));
-            assertTrue(exposesProperties(bw1));
-            assertFalse(exposesMethods(bw1));
-            assertFalse(exposesUnsafe(bw1));
-            assertFalse(isSimpleMapWrapper(bw1));
-            
-            // Prevent introspection cache GC:
-            hardReferences.add(bw1);
-            hardReferences.add(bw2);
-        }
-        
-        BeansWrapperBuilder.clearInstanceCache();  // otherwise ClassInrospector cache couldn't become cleared in reality
-        _ModelImplApi.DefaultObjectWrapperFactory_clearInstanceCache();
-        clearClassIntrospectorInstanceCacheReferences(false);
-        checkClassIntrospectorCacheSize(8);
-        assertEquals(0, getClassIntrospectorNonClearedInstanceCacheSize());
-
-        {
-            factory.setSimpleMapWrapper(false);
-            factory.setExposeFields(false);
-            
-            BeansWrapper bw1 = factory.build();
-            checkClassIntrospectorCacheSize(8);
-            assertEquals(1, getClassIntrospectorNonClearedInstanceCacheSize());
-            ClassIntrospector ci1 = bw1.getClassIntrospector();
-            
-            factory.setSimpleMapWrapper(true);  // Shouldn't mater
-            BeansWrapper bw2 = factory.build();
-            ClassIntrospector ci2 = bw2.getClassIntrospector();
-            
-            assertSame(ci1, ci2);
-            assertNotSame(bw1, bw2);
-            
-            // Wrapping tests:
-            assertFalse(exposesFields(bw1));
-            assertTrue(exposesProperties(bw1));
-            assertFalse(exposesMethods(bw1));
-            assertFalse(exposesUnsafe(bw1));
-            assertFalse(isSimpleMapWrapper(bw1));
-            
-            // Prevent introspection cache GC:
-            hardReferences.add(bw1);
-            hardReferences.add(bw2);
-        }
-        
-        {
-            factory = new BeansWrapperBuilder(Configuration.VERSION_3_0_0);
-            BeansWrapper bw = factory.build();
-            checkClassIntrospectorCacheSize(8);
-            assertEquals(2, getClassIntrospectorNonClearedInstanceCacheSize());
-            // Wrapping tests:
-            assertFalse(exposesFields(bw));
-            assertTrue(exposesProperties(bw));
-            assertTrue(exposesMethods(bw));
-            assertFalse(exposesUnsafe(bw));
-            // Prevent introspection cache GC:
-            hardReferences.add(bw);
-        }
-
-        clearClassIntrospectorInstanceCacheReferences(true);
-        checkClassIntrospectorCacheSize(8);
-        assertEquals(0, getClassIntrospectorNonClearedInstanceCacheSize());
-        
-        {
-            factory = new BeansWrapperBuilder(Configuration.VERSION_3_0_0);
-            factory.setExposeFields(true);
-            BeansWrapper bw = factory.build();
-            checkClassIntrospectorCacheSize(1);
-            // Wrapping tests:
-            assertTrue(exposesFields(bw));
-            assertTrue(exposesProperties(bw));
-            assertTrue(exposesMethods(bw));
-            assertFalse(exposesUnsafe(bw));
-            // Prevent introspection cache GC:
-            hardReferences.add(bw);
-        }
-        
-        {
-            factory = new BeansWrapperBuilder(Configuration.VERSION_3_0_0);
-            factory.setMethodAppearanceFineTuner(new MethodAppearanceFineTuner() {
-                @Override
-                public void process(MethodAppearanceDecisionInput in, MethodAppearanceDecision out) {
-                }
-            });  // spoils ClassIntrospector() sharing
-            
-            BeansWrapper bw1 = factory.build();
-            assertSame(bw1, factory.build());
-            
-            factory.setSimpleMapWrapper(true);
-            BeansWrapper bw2 = factory.build();
-            checkClassIntrospectorCacheSize(1);
-            assertNotSame(bw1, bw2);
-            assertNotSame(bw1.getClassIntrospector(), bw2.getClassIntrospector());
-            assertTrue(bw1.isClassIntrospectionCacheRestricted());
-            assertTrue(bw2.isClassIntrospectionCacheRestricted());
-            
-            // Wrapping tests:
-            assertFalse(exposesFields(bw1));
-            assertFalse(exposesFields(bw2));
-            assertTrue(exposesProperties(bw1));
-            assertTrue(exposesProperties(bw2));
-            assertTrue(exposesMethods(bw1));
-            assertTrue(exposesMethods(bw2));
-            assertFalse(exposesUnsafe(bw1));
-            assertFalse(exposesUnsafe(bw2));
-            assertFalse(isSimpleMapWrapper(bw1));
-            assertTrue(isSimpleMapWrapper(bw2));
-        }
-
-        {
-            factory = new BeansWrapperBuilder(Configuration.VERSION_3_0_0);
-            factory.setMethodAppearanceFineTuner(
-                    GetlessMethodsAsPropertyGettersRule.INSTANCE);  // doesn't spoils sharing
-            
-            BeansWrapper bw1 = factory.build();
-            assertSame(bw1, factory.build());
-            checkClassIntrospectorCacheSize(2);
-            
-            factory.setSimpleMapWrapper(true);
-            BeansWrapper bw2 = factory.build();
-            checkClassIntrospectorCacheSize(2);
-            
-            assertNotSame(bw1, bw2);
-            assertSame(bw1.getClassIntrospector(), bw2.getClassIntrospector());  // !
-            assertTrue(bw1.isClassIntrospectionCacheRestricted());
-            assertTrue(bw2.isClassIntrospectionCacheRestricted());
-            
-            // Wrapping tests:
-            assertFalse(exposesFields(bw1));
-            assertFalse(exposesFields(bw2));
-            assertTrue(exposesProperties(bw1));
-            assertTrue(exposesProperties(bw2));
-            assertTrue(exposesMethods(bw1));
-            assertTrue(exposesMethods(bw2));
-            assertFalse(exposesUnsafe(bw1));
-            assertFalse(exposesUnsafe(bw2));
-            assertFalse(isSimpleMapWrapper(bw1));
-            assertTrue(isSimpleMapWrapper(bw2));
-        }
-        
-        assertTrue(hardReferences.size() != 0);  // just to save it from GC until this line        
-    }
-    
-    private void checkClassIntrospectorCacheSize(int expectedSize) {
-        assertEquals(expectedSize, getClassIntrospectorInstanceCacheSize());
-    }
-
-    private void assertNotEquals(Object o1, Object o2) {
-        assertFalse(o1.equals(o2));
-    }
-    
-    public class C {
-        
-        public String foo = "FOO";
-        
-        public String getBar() {
-            return "BAR";
-        }
-        
-    }
-
-    private boolean isSimpleMapWrapper(BeansWrapper bw) throws TemplateModelException {
-        return bw.wrap(new HashMap()) instanceof SimpleMapModel;
-    }
-    
-    private boolean exposesFields(BeansWrapper bw) throws TemplateModelException {
-        TemplateHashModel thm = (TemplateHashModel) bw.wrap(new C());
-        TemplateScalarModel r = (TemplateScalarModel) thm.get("foo");
-        if (r == null) return false;
-        assertEquals("FOO", r.getAsString());
-        return true;
-    }
-
-    private boolean exposesProperties(BeansWrapper bw) throws TemplateModelException {
-        TemplateHashModel thm = (TemplateHashModel) bw.wrap(new C());
-        TemplateScalarModel r = (TemplateScalarModel) thm.get("bar");
-        if (r == null) return false;
-        assertEquals("BAR", r.getAsString());
-        return true;
-    }
-
-    private boolean exposesMethods(BeansWrapper bw) throws TemplateModelException {
-        TemplateHashModel thm = (TemplateHashModel) bw.wrap(new C());
-        return thm.get("getBar") != null;
-    }
-
-    private boolean exposesUnsafe(BeansWrapper bw) throws TemplateModelException {
-        TemplateHashModel thm = (TemplateHashModel) bw.wrap(new C());
-        return thm.get("wait") != null;
-    }
-    
-    static int getClassIntrospectorInstanceCacheSize() {
-        Map instanceCache = ClassIntrospectorBuilder.getInstanceCache();
-        synchronized (instanceCache) {
-            return instanceCache.size();
-        }
-    }
-
-    static int getClassIntrospectorNonClearedInstanceCacheSize() {
-        Map instanceCache = ClassIntrospectorBuilder.getInstanceCache();
-        synchronized (instanceCache) {
-            int cnt = 0;
-            for (Iterator it = instanceCache.values().iterator(); it.hasNext(); ) {
-                if (((Reference) it.next()).get() != null) cnt++;
-            }
-            return cnt;
-        }
-    }
-    
-    static void clearClassIntrospectorInstanceCacheReferences(boolean enqueue) {
-        Map instanceCache = ClassIntrospectorBuilder.getInstanceCache();
-        synchronized (instanceCache) {
-            for (Iterator it = instanceCache.values().iterator(); it.hasNext(); ) {
-                Reference ref = ((Reference) it.next());
-                ref.clear();
-                if (enqueue) {
-                    ref.enqueue();
-                }
-            }
-        }
-    }
-
-    static int getBeansWrapperInstanceCacheSize() {
-        Map instanceCache = BeansWrapperBuilder.getInstanceCache();
-        synchronized (instanceCache) {
-            int size = 0; 
-            for (Iterator it1 = instanceCache.values().iterator(); it1.hasNext(); ) {
-                size += ((Map) it1.next()).size();
-            }
-            return size;
-        }
-    }
-
-    static int getBeansWrapperNonClearedInstanceCacheSize() {
-        Map instanceCache = BeansWrapperBuilder.getInstanceCache();
-        synchronized (instanceCache) {
-            int cnt = 0;
-            for (Iterator it1 = instanceCache.values().iterator(); it1.hasNext(); ) {
-                Map tcclScope = (Map) it1.next();
-                for (Iterator it2 = tcclScope.values().iterator(); it2.hasNext(); ) {
-                    if (((Reference) it2.next()).get() != null) cnt++;
-                }
-            }
-            return cnt;
-        }
-    }
-    
-    static void clearBeansWrapperInstanceCacheReferences(boolean enqueue) {
-        Map instanceCache = BeansWrapperBuilder.getInstanceCache();
-        synchronized (instanceCache) {
-            for (Iterator it1 = instanceCache.values().iterator(); it1.hasNext(); ) {
-                Map tcclScope = (Map) it1.next();
-                for (Iterator it2 = tcclScope.values().iterator(); it2.hasNext(); ) {
-                    Reference ref = ((Reference) it2.next());
-                    ref.clear();
-                    if (enqueue) {
-                        ref.enqueue();
-                    }
-                }
-            }
-        }
-    }
-    
-}

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/051a0822/src/test/java/org/apache/freemarker/core/model/impl/beans/BeansWrapperWithShortedMethods.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/freemarker/core/model/impl/beans/BeansWrapperWithShortedMethods.java b/src/test/java/org/apache/freemarker/core/model/impl/beans/BeansWrapperWithShortedMethods.java
deleted file mode 100644
index 1a4ea27..0000000
--- a/src/test/java/org/apache/freemarker/core/model/impl/beans/BeansWrapperWithShortedMethods.java
+++ /dev/null
@@ -1,41 +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 org.apache.freemarker.core.model.impl.beans;
-
-
-import org.apache.freemarker.core.Configuration;
-import org.apache.freemarker.core.Version;
-
-/**
- * Used so that the order in which the methods are added to the introspection cache is deterministic. 
- */
-public abstract class BeansWrapperWithShortedMethods extends BeansWrapper {
-    
-    public BeansWrapperWithShortedMethods(boolean desc) {
-        super(Configuration.VERSION_3_0_0);
-        setMethodSorter(new AlphabeticalMethodSorter(desc));
-    }
-
-    public BeansWrapperWithShortedMethods(Version incompatibleImprovements, boolean desc) {
-        super(incompatibleImprovements);
-        setMethodSorter(new AlphabeticalMethodSorter(desc));
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/051a0822/src/test/java/org/apache/freemarker/core/model/impl/beans/CommonSupertypeForUnwrappingHintTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/freemarker/core/model/impl/beans/CommonSupertypeForUnwrappingHintTest.java b/src/test/java/org/apache/freemarker/core/model/impl/beans/CommonSupertypeForUnwrappingHintTest.java
deleted file mode 100644
index e7ea63c..0000000
--- a/src/test/java/org/apache/freemarker/core/model/impl/beans/CommonSupertypeForUnwrappingHintTest.java
+++ /dev/null
@@ -1,129 +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 org.apache.freemarker.core.model.impl.beans;
-
-import java.io.Serializable;
-import java.util.List;
-
-import org.apache.freemarker.core.model.TemplateModelException;
-
-import junit.framework.TestCase;
-
-public class CommonSupertypeForUnwrappingHintTest extends TestCase {
-    
-    final OverloadedMethodsSubset oms = new DummyOverloadedMethodsSubset();
-
-    public CommonSupertypeForUnwrappingHintTest(String name) {
-        super(name);
-    }
-
-    public void testInterfaces() {
-        assertEquals(Serializable.class, oms.getCommonSupertypeForUnwrappingHint(String.class, Number.class));
-        assertEquals(C1I1.class, oms.getCommonSupertypeForUnwrappingHint(C2ExtC1I1.class, C3ExtC1I1.class));
-        assertEquals(Object.class, oms.getCommonSupertypeForUnwrappingHint(C3I1I2.class, C4I1I2.class));
-        assertEquals(I1.class, oms.getCommonSupertypeForUnwrappingHint(C3I1I2.class, C5I1.class));
-        assertEquals(I1.class, oms.getCommonSupertypeForUnwrappingHint(C3I1I2.class, I1.class));
-        assertEquals(I2.class, oms.getCommonSupertypeForUnwrappingHint(C3I1I2.class, I2.class));
-        assertEquals(I1.class, oms.getCommonSupertypeForUnwrappingHint(I1I2.class, I1.class));
-        assertEquals(I2.class, oms.getCommonSupertypeForUnwrappingHint(I1I2.class, I2.class));
-        assertEquals(CharSequence.class, oms.getCommonSupertypeForUnwrappingHint(String.class, StringBuilder.class));
-        assertEquals(C6.class, oms.getCommonSupertypeForUnwrappingHint(C7ExtC6I1.class, C8ExtC6I1.class));
-    }
-
-    public void testArrayAndOther() {
-        testArrayAndOther(oms);
-    }
-    
-    /** These will be the same with oms and buggy: */
-    private void testArrayAndOther(OverloadedMethodsSubset oms) {
-        assertEquals(Serializable.class, oms.getCommonSupertypeForUnwrappingHint(int[].class, String.class));
-        assertEquals(Serializable.class, oms.getCommonSupertypeForUnwrappingHint(Object[].class, String.class));
-        
-        assertEquals(Object.class, oms.getCommonSupertypeForUnwrappingHint(int[].class, List.class));
-        assertEquals(Object.class, oms.getCommonSupertypeForUnwrappingHint(Object[].class, List.class));
-        
-        assertEquals(int[].class, oms.getCommonSupertypeForUnwrappingHint(int[].class, int[].class));
-        assertEquals(Object[].class, oms.getCommonSupertypeForUnwrappingHint(Object[].class, Object[].class));
-    }
-    
-    public void testArrayAndDifferentArray() {
-        assertEquals(Serializable.class, oms.getCommonSupertypeForUnwrappingHint(int[].class, Object[].class));
-        assertEquals(Serializable.class, oms.getCommonSupertypeForUnwrappingHint(int[].class, long[].class));
-    }
-    
-    public void testPrimitive() {
-        assertEquals(Integer.class, oms.getCommonSupertypeForUnwrappingHint(int.class, Integer.class));
-        assertEquals(Integer.class, oms.getCommonSupertypeForUnwrappingHint(Integer.class, int.class));
-        assertEquals(Number.class, oms.getCommonSupertypeForUnwrappingHint(int.class, Long.class));
-        assertEquals(Number.class, oms.getCommonSupertypeForUnwrappingHint(Long.class, int.class));
-        assertEquals(Number.class, oms.getCommonSupertypeForUnwrappingHint(Integer.class, long.class));
-        assertEquals(Number.class, oms.getCommonSupertypeForUnwrappingHint(long.class, Integer.class));
-        assertEquals(Boolean.class, oms.getCommonSupertypeForUnwrappingHint(boolean.class, Boolean.class));
-        assertEquals(Boolean.class, oms.getCommonSupertypeForUnwrappingHint(Boolean.class, boolean.class));
-        assertEquals(Character.class, oms.getCommonSupertypeForUnwrappingHint(char.class, Character.class));
-        assertEquals(Character.class, oms.getCommonSupertypeForUnwrappingHint(Character.class, char.class));
-        assertEquals(Number.class, oms.getCommonSupertypeForUnwrappingHint(int.class, short.class));
-        assertEquals(Number.class, oms.getCommonSupertypeForUnwrappingHint(short.class, int.class));
-    }
-
-    public void testMisc() {
-        assertEquals(Number.class, oms.getCommonSupertypeForUnwrappingHint(Long.class, Integer.class));
-        assertEquals(char.class, oms.getCommonSupertypeForUnwrappingHint(char.class, char.class));
-        assertEquals(Integer.class, oms.getCommonSupertypeForUnwrappingHint(Integer.class, Integer.class));
-        assertEquals(String.class, oms.getCommonSupertypeForUnwrappingHint(String.class, String.class));
-    }
-    
-    static interface I1 { };
-    static class C1I1 implements I1 { };
-    static class C2ExtC1I1 extends C1I1 { };
-    static class C3ExtC1I1 extends C1I1 { };
-    static interface I2 { };
-    static class C3I1I2 implements I1, I2 { };
-    static class C4I1I2 implements I1, I2 { };
-    static class C5I1 implements I1 { };
-    static interface I1I2 extends I1, I2 { };
-    static class C6 { };
-    static class C7ExtC6I1 extends C6 implements I1 { };
-    static class C8ExtC6I1 extends C6 implements I1 { };
-    
-    private static class DummyOverloadedMethodsSubset extends OverloadedMethodsSubset {
-
-        DummyOverloadedMethodsSubset() {
-            super();
-        }
-
-        @Override
-        Class[] preprocessParameterTypes(CallableMemberDescriptor memberDesc) {
-            return memberDesc.getParamTypes();
-        }
-
-        @Override
-        void afterWideningUnwrappingHints(Class[] paramTypes, int[] paramNumericalTypes) {
-            // Do nothing
-        }
-
-        @Override
-        MaybeEmptyMemberAndArguments getMemberAndArguments(List tmArgs, BeansWrapper w) throws TemplateModelException {
-            throw new RuntimeException("Not implemented in this dummy.");
-        }
-        
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/051a0822/src/test/java/org/apache/freemarker/core/model/impl/beans/DefaultObjectWrapperDesc.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/freemarker/core/model/impl/beans/DefaultObjectWrapperDesc.java b/src/test/java/org/apache/freemarker/core/model/impl/beans/DefaultObjectWrapperDesc.java
deleted file mode 100644
index bf61205..0000000
--- a/src/test/java/org/apache/freemarker/core/model/impl/beans/DefaultObjectWrapperDesc.java
+++ /dev/null
@@ -1,30 +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 org.apache.freemarker.core.model.impl.beans;
-
-import org.apache.freemarker.core.Configuration;
-
-public class DefaultObjectWrapperDesc extends DefaultObjectWrapperWithSortedMethods {
-
-    public DefaultObjectWrapperDesc() {
-        super(Configuration.VERSION_3_0_0, true);
-    }
-    
-}

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/051a0822/src/test/java/org/apache/freemarker/core/model/impl/beans/DefaultObjectWrapperInc.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/freemarker/core/model/impl/beans/DefaultObjectWrapperInc.java b/src/test/java/org/apache/freemarker/core/model/impl/beans/DefaultObjectWrapperInc.java
deleted file mode 100644
index 60a331a..0000000
--- a/src/test/java/org/apache/freemarker/core/model/impl/beans/DefaultObjectWrapperInc.java
+++ /dev/null
@@ -1,30 +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 org.apache.freemarker.core.model.impl.beans;
-
-import org.apache.freemarker.core.Configuration;
-
-public class DefaultObjectWrapperInc extends DefaultObjectWrapperWithSortedMethods {
-
-    public DefaultObjectWrapperInc() {
-        super(Configuration.VERSION_3_0_0, false);
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/051a0822/src/test/java/org/apache/freemarker/core/model/impl/beans/DefaultObjectWrapperWithSortedMethods.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/freemarker/core/model/impl/beans/DefaultObjectWrapperWithSortedMethods.java b/src/test/java/org/apache/freemarker/core/model/impl/beans/DefaultObjectWrapperWithSortedMethods.java
deleted file mode 100644
index a67aad2..0000000
--- a/src/test/java/org/apache/freemarker/core/model/impl/beans/DefaultObjectWrapperWithSortedMethods.java
+++ /dev/null
@@ -1,41 +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 org.apache.freemarker.core.model.impl.beans;
-
-import org.apache.freemarker.core.Configuration;
-import org.apache.freemarker.core.Version;
-import org.apache.freemarker.core.model.impl.DefaultObjectWrapper;
-
-public class DefaultObjectWrapperWithSortedMethods extends DefaultObjectWrapper {
-    
-    public DefaultObjectWrapperWithSortedMethods(boolean desc) {
-        this(Configuration.VERSION_3_0_0, desc);
-    }
-
-    public DefaultObjectWrapperWithSortedMethods(Version incompatibleImprovements, boolean desc) {
-        super(incompatibleImprovements);
-        setMethodSorter(this, desc);
-    }
-    
-    static void setMethodSorter(BeansWrapper bw, boolean desc) {
-        bw.setMethodSorter(new AlphabeticalMethodSorter(desc));
-    }
-    
-}

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/051a0822/src/test/java/org/apache/freemarker/core/model/impl/beans/EnumModelsTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/freemarker/core/model/impl/beans/EnumModelsTest.java b/src/test/java/org/apache/freemarker/core/model/impl/beans/EnumModelsTest.java
deleted file mode 100644
index 90421c9..0000000
--- a/src/test/java/org/apache/freemarker/core/model/impl/beans/EnumModelsTest.java
+++ /dev/null
@@ -1,84 +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 org.apache.freemarker.core.model.impl.beans;
-
-import static org.junit.Assert.*;
-
-import java.util.ArrayList;
-
-import org.apache.freemarker.core.Configuration;
-import org.apache.freemarker.core.model.TemplateHashModel;
-import org.apache.freemarker.core.model.TemplateMethodModelEx;
-import org.apache.freemarker.core.model.TemplateModel;
-import org.apache.freemarker.core.model.TemplateModelException;
-import org.apache.freemarker.core.model.TemplateScalarModel;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.JUnit4;
-
-@RunWith(JUnit4.class)
-public class EnumModelsTest {
-    
-    @Test
-    public void modelCaching() throws Exception {
-        BeansWrapper bw = new BeansWrapper(Configuration.VERSION_3_0_0);
-        TemplateHashModel enums = bw.getEnumModels();
-        TemplateHashModel e = (TemplateHashModel) enums.get(E.class.getName());
-        assertNotNull(e);
-        assertNotNull(e.get("A"));
-        assertNotNull(e.get("B"));
-        assertNull(e.get("C"));
-
-        try {
-            enums.get("no.such.ClassExists");
-            fail();
-        } catch (TemplateModelException ex) {
-            assertTrue(ex.getCause() instanceof ClassNotFoundException);
-        }
-        
-        TemplateModel a = e.get("A");
-        assertTrue(a instanceof TemplateScalarModel);
-        assertTrue(a instanceof TemplateHashModel);
-        assertEquals(((TemplateScalarModel) a).getAsString(), "ts:A");
-        TemplateMethodModelEx nameMethod = (TemplateMethodModelEx) ((TemplateHashModel) a).get("name");
-        assertEquals(((TemplateScalarModel) nameMethod.exec(new ArrayList())).getAsString(), "A");
-        
-        assertSame(e, enums.get(E.class.getName()));
-        
-        bw.clearClassIntrospecitonCache();
-        TemplateHashModel eAfterClean = (TemplateHashModel) enums.get(E.class.getName());
-        assertNotSame(e, eAfterClean);
-        assertSame(eAfterClean, enums.get(E.class.getName()));
-        assertNotNull(eAfterClean.get("A"));
-        assertNotNull(eAfterClean.get("B"));
-        assertNull(eAfterClean.get("C"));
-    }
-    
-    public enum E {
-        A, B;
-
-        @Override
-        public String toString() {
-            return "ts:" + super.toString();
-        }
-        
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/051a0822/src/test/java/org/apache/freemarker/core/model/impl/beans/ErrorMessagesTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/freemarker/core/model/impl/beans/ErrorMessagesTest.java b/src/test/java/org/apache/freemarker/core/model/impl/beans/ErrorMessagesTest.java
deleted file mode 100644
index 61a2612..0000000
--- a/src/test/java/org/apache/freemarker/core/model/impl/beans/ErrorMessagesTest.java
+++ /dev/null
@@ -1,170 +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 org.apache.freemarker.core.model.impl.beans;
-
-import static org.hamcrest.Matchers.*;
-import static org.junit.Assert.*;
-
-import java.util.Collections;
-import java.util.Date;
-
-import org.apache.freemarker.core.Configuration;
-import org.apache.freemarker.core.model.TemplateHashModel;
-import org.apache.freemarker.core.model.TemplateMethodModelEx;
-import org.apache.freemarker.core.model.TemplateModelException;
-import org.apache.freemarker.core.model.TemplateScalarModel;
-import org.apache.freemarker.core.outputformat.impl.HTMLOutputFormat;
-import org.apache.freemarker.core.outputformat.impl.TemplateHTMLOutputModel;
-import org.junit.Test;
-
-public class ErrorMessagesTest {
-
-    @Test
-    public void getterMessage() throws TemplateModelException {
-        BeansWrapper bw = new BeansWrapperBuilder(Configuration.VERSION_3_0_0).build();
-        TemplateHashModel thm= (TemplateHashModel) bw.wrap(new TestBean());
-        
-        try {
-            thm.get("foo");
-        } catch (TemplateModelException e) {
-            e.printStackTrace();
-            final String msg = e.getMessage();
-            assertThat(msg, containsString("\"foo\""));
-            assertThat(msg, containsString("existing sub-variable"));
-        }
-        assertNull(thm.get("bar"));
-    }
-    
-    @Test
-    public void markupOutputParameter() throws Exception {
-        TemplateHTMLOutputModel html = HTMLOutputFormat.INSTANCE.fromMarkup("<p>a");
-
-        BeansWrapper bw = new BeansWrapperBuilder(Configuration.VERSION_3_0_0).build();
-        TemplateHashModel thm = (TemplateHashModel) bw.wrap(new TestBean());
-        
-        {
-            TemplateMethodModelEx m = (TemplateMethodModelEx) thm.get("m1");
-            try {
-                m.exec(Collections.singletonList(html));
-                fail();
-            } catch (TemplateModelException e) {
-                assertThat(e.getMessage(), allOf(
-                        containsString("String"), containsString("convert"), containsString("markup_output"),
-                        containsString("Tip:"), containsString("?markup_string")));
-            }
-        }
-        
-        {
-            TemplateMethodModelEx m = (TemplateMethodModelEx) thm.get("m2");
-            try {
-                m.exec(Collections.singletonList(html));
-                fail();
-            } catch (TemplateModelException e) {
-                assertThat(e.getMessage(), allOf(
-                        containsString("Date"), containsString("convert"), containsString("markup_output"),
-                        not(containsString("?markup_string"))));
-            }
-        }
-        
-        for (String methodName : new String[] { "mOverloaded", "mOverloaded3" }) {
-            TemplateMethodModelEx m = (TemplateMethodModelEx) thm.get(methodName);
-            try {
-                m.exec(Collections.singletonList(html));
-                fail();
-            } catch (TemplateModelException e) {
-                assertThat(e.getMessage(), allOf(
-                        containsString("No compatible overloaded"),
-                        containsString("String"), containsString("markup_output"),
-                        containsString("Tip:"), containsString("?markup_string")));
-            }
-        }
-        
-        {
-            TemplateMethodModelEx m = (TemplateMethodModelEx) thm.get("mOverloaded2");
-            try {
-                m.exec(Collections.singletonList(html));
-                fail();
-            } catch (TemplateModelException e) {
-                assertThat(e.getMessage(), allOf(
-                        containsString("No compatible overloaded"),
-                        containsString("Integer"), containsString("markup_output"),
-                        not(containsString("?markup_string"))));
-            }
-        }
-        
-        {
-            TemplateMethodModelEx m = (TemplateMethodModelEx) thm.get("mOverloaded4");
-            Object r = m.exec(Collections.singletonList(html));
-            if (r instanceof TemplateScalarModel) {
-                r = ((TemplateScalarModel) r).getAsString();
-            }
-            assertEquals("<p>a", r);
-        }
-    }
-    
-    public static class TestBean {
-        
-        public String getFoo() {
-            throw new RuntimeException("Dummy");
-        }
-        
-        public void m1(String s) {
-            // nop
-        }
-
-        public void m2(Date s) {
-            // nop
-        }
-
-        public void mOverloaded(String s) {
-            // nop
-        }
-
-        public void mOverloaded(Date d) {
-            // nop
-        }
-
-        public void mOverloaded2(Integer n) {
-            // nop
-        }
-
-        public void mOverloaded2(Date d) {
-            // nop
-        }
-
-        public void mOverloaded3(String... s) {
-            // nop
-        }
-
-        public void mOverloaded3(Date d) {
-            // nop
-        }
-        
-        public String mOverloaded4(String s) {
-            return s;
-        }
-
-        public String mOverloaded4(TemplateHTMLOutputModel s) throws TemplateModelException {
-            return s.getOutputFormat().getMarkupString(s);
-        }
-        
-    }
-    
-}

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/051a0822/src/test/java/org/apache/freemarker/core/model/impl/beans/FineTuneMethodAppearanceTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/freemarker/core/model/impl/beans/FineTuneMethodAppearanceTest.java b/src/test/java/org/apache/freemarker/core/model/impl/beans/FineTuneMethodAppearanceTest.java
deleted file mode 100644
index d21e116..0000000
--- a/src/test/java/org/apache/freemarker/core/model/impl/beans/FineTuneMethodAppearanceTest.java
+++ /dev/null
@@ -1,65 +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 org.apache.freemarker.core.model.impl.beans;
-
-import static org.junit.Assert.*;
-
-import org.apache.freemarker.core.Configuration;
-import org.apache.freemarker.core.model.TemplateHashModel;
-import org.apache.freemarker.core.model.TemplateMethodModelEx;
-import org.apache.freemarker.core.model.TemplateModel;
-import org.apache.freemarker.core.model.TemplateModelException;
-import org.apache.freemarker.core.model.TemplateScalarModel;
-import org.apache.freemarker.core.model.impl.DefaultObjectWrapper;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.JUnit4;
-
-@RunWith(JUnit4.class)
-public class FineTuneMethodAppearanceTest {
-
-    @Test
-    public void newWayOfConfiguring() throws TemplateModelException {
-        DefaultObjectWrapper ow = new DefaultObjectWrapper(Configuration.VERSION_3_0_0);
-        ow.setMethodAppearanceFineTuner(GetlessMethodsAsPropertyGettersRule.INSTANCE);
-        ow.setExposeFields(true);
-        checkIfProperlyWrapped(ow.wrap(new C()));
-    }
-    
-    private void checkIfProperlyWrapped(TemplateModel tm) throws TemplateModelException {
-        TemplateHashModel thm = (TemplateHashModel) tm;
-        assertEquals("v1", ((TemplateScalarModel) thm.get("v1")).getAsString());
-        assertEquals("v2()", ((TemplateScalarModel) thm.get("v2")).getAsString());
-        assertEquals("getV3()", ((TemplateScalarModel) thm.get("v3")).getAsString());
-        assertTrue(thm.get("getV3") instanceof TemplateMethodModelEx);
-    }
-    
-    static public class C {
-        
-        public String v1 = "v1";
-
-        public String v2 = "v2";
-        public String v2() { return "v2()"; }
-        
-        public String v3() { return "v3()"; }
-        public String getV3() { return "getV3()"; }
-    }
-    
-}

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/051a0822/src/test/java/org/apache/freemarker/core/model/impl/beans/GetlessMethodsAsPropertyGettersRule.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/freemarker/core/model/impl/beans/GetlessMethodsAsPropertyGettersRule.java b/src/test/java/org/apache/freemarker/core/model/impl/beans/GetlessMethodsAsPropertyGettersRule.java
deleted file mode 100644
index 08a52e3..0000000
--- a/src/test/java/org/apache/freemarker/core/model/impl/beans/GetlessMethodsAsPropertyGettersRule.java
+++ /dev/null
@@ -1,70 +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 org.apache.freemarker.core.model.impl.beans;
-
-import java.beans.IntrospectionException;
-import java.beans.PropertyDescriptor;
-import java.lang.reflect.Method;
-
-import org.apache.freemarker.core.model.impl.beans.BeansWrapper.MethodAppearanceDecision;
-import org.apache.freemarker.core.model.impl.beans.BeansWrapper.MethodAppearanceDecisionInput;
-
-class GetlessMethodsAsPropertyGettersRule implements MethodAppearanceFineTuner, SingletonCustomizer {
-    
-    static final GetlessMethodsAsPropertyGettersRule INSTANCE = new GetlessMethodsAsPropertyGettersRule();
-    
-    // Can't be constructed from outside
-    private GetlessMethodsAsPropertyGettersRule() { }
-
-    @Override
-    public void process(
-            MethodAppearanceDecisionInput in, MethodAppearanceDecision out) {
-        legacyProcess(in.getContainingClass(), in.getMethod(), out);
-    }
-
-    /** This only exists as the tests need to call this through the deprecated method too. */
-    public void legacyProcess(
-            Class clazz, Method m, MethodAppearanceDecision decision) {
-        if (m.getDeclaringClass() != Object.class
-                && m.getReturnType() != void.class
-                && m.getParameterTypes().length == 0) {
-            String mName = m.getName();
-            if (!looksLikePropertyReadMethod(mName)) {
-                decision.setExposeMethodAs(null);
-                try {
-                    decision.setExposeAsProperty(new PropertyDescriptor(
-                            mName, clazz, mName, null));
-                } catch (IntrospectionException e) {  // Won't happen...
-                    throw new RuntimeException(e); 
-                }
-            }
-        }
-    }
-    
-    private static boolean looksLikePropertyReadMethod(String name) {
-        final int verbEnd;
-        if (name.startsWith("get")) verbEnd = 3;
-        else if (name.startsWith("is")) verbEnd = 2;
-        else return false;
-        
-        return name.length() == verbEnd || Character.isUpperCase(name.charAt(verbEnd));
-    }
-
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/051a0822/src/test/java/org/apache/freemarker/core/model/impl/beans/IsApplicableTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/freemarker/core/model/impl/beans/IsApplicableTest.java b/src/test/java/org/apache/freemarker/core/model/impl/beans/IsApplicableTest.java
deleted file mode 100644
index 0bc9168..0000000
--- a/src/test/java/org/apache/freemarker/core/model/impl/beans/IsApplicableTest.java
+++ /dev/null
@@ -1,171 +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 org.apache.freemarker.core.model.impl.beans;
-
-import java.io.Serializable;
-import java.lang.reflect.Method;
-import java.math.BigDecimal;
-import java.math.BigInteger;
-import java.util.ArrayList;
-import java.util.List;
-
-import junit.framework.TestCase;
-
-@SuppressWarnings("boxing")
-public class IsApplicableTest extends TestCase {
-
-    public IsApplicableTest(String name) {
-        super(name);
-    }
-    
-    public void testSingle() {
-        ArgumentTypes ats = new ArgumentTypes(new Object[] { new Object() });
-        assertApplicable(ats, Object.class);
-        assertNotApplicable(ats, String.class);
-        assertNotApplicable(ats, CharSequence.class);
-        assertNotApplicable(ats, Integer.class);
-        assertNotApplicable(ats, Integer.TYPE);
-        
-        ats = new ArgumentTypes(new Object[] { "" });
-        assertApplicable(ats, Object.class);
-        assertApplicable(ats, CharSequence.class);
-        assertApplicable(ats, String.class);
-        assertNotApplicable(ats, Integer.class);
-        assertNotApplicable(ats, Integer.TYPE);
-
-        ats = new ArgumentTypes(new Object[] { 1 });
-        assertApplicable(ats, Object.class);
-        assertNotApplicable(ats, CharSequence.class);
-        assertNotApplicable(ats, String.class);
-        assertNotApplicable(ats, Short.class);
-        assertNotApplicable(ats, Short.TYPE);
-        assertApplicable(ats, Integer.class);
-        assertApplicable(ats, Integer.TYPE);
-        assertApplicable(ats, Float.class);
-        assertApplicable(ats, Float.TYPE);
-        assertApplicable(ats, Double.class);
-        assertApplicable(ats, Double.TYPE);
-        assertApplicable(ats, BigDecimal.class);
-        assertApplicable(ats, BigInteger.class);
-
-        ats = new ArgumentTypes(new Object[] { new OverloadedNumberUtil.IntegerOrByte(1, (byte) 1) });
-        assertApplicable(ats, Object.class);
-        assertNotApplicable(ats, CharSequence.class);
-        assertNotApplicable(ats, String.class);
-        assertApplicable(ats, Short.class);
-        assertApplicable(ats, Short.TYPE);
-        assertApplicable(ats, Integer.class);
-        assertApplicable(ats, Integer.TYPE);
-        assertApplicable(ats, Float.class);
-        assertApplicable(ats, Float.TYPE);
-        assertApplicable(ats, Double.class);
-        assertApplicable(ats, Double.TYPE);
-        assertApplicable(ats, BigDecimal.class);
-        assertApplicable(ats, BigInteger.class);
-        
-        ats = new ArgumentTypes(new Object[] { 1.0f });
-        assertApplicable(ats, Object.class);
-        assertNotApplicable(ats, CharSequence.class);
-        assertNotApplicable(ats, String.class);
-        assertNotApplicable(ats, Integer.class);
-        assertNotApplicable(ats, Integer.TYPE);
-        assertApplicable(ats, Float.class);
-        assertApplicable(ats, Float.TYPE);
-        assertApplicable(ats, Double.class);
-        assertApplicable(ats, Double.TYPE);
-        assertApplicable(ats, BigDecimal.class);
-        assertNotApplicable(ats, BigInteger.class);
-        
-        ats = new ArgumentTypes(new Object[] { null });
-        assertApplicable(ats, Object.class);
-        assertApplicable(ats, String.class);
-        assertApplicable(ats, Integer.class);
-        assertNotApplicable(ats, Integer.TYPE);
-        assertNotApplicable(ats, Boolean.TYPE);
-        assertNotApplicable(ats, Object.class, Object.class);
-        assertNotApplicable(ats);
-    }
-    
-    public void testMulti() {
-        ArgumentTypes ats = new ArgumentTypes(new Object[] { new Object(), "", 1, true });
-        assertApplicable(ats, Object.class, Object.class, Object.class, Object.class);
-        assertApplicable(ats, Object.class, String.class, Number.class, Boolean.class);
-        assertApplicable(ats, Object.class, CharSequence.class, Integer.class, Serializable.class);
-        assertApplicable(ats, Object.class, Comparable.class, Integer.TYPE, Serializable.class);
-        assertNotApplicable(ats, Object.class, String.class, Number.class, Number.class);
-        assertNotApplicable(ats, Object.class, StringBuilder.class, Number.class, Boolean.class);
-        assertNotApplicable(ats, int.class, Object.class, Object.class, Object.class);
-        assertNotApplicable(ats, Object.class, Object.class, Object.class);
-        assertNotApplicable(ats, Object.class, Object.class, Object.class, Object.class, Object.class);
-    }    
-
-    public void testNoParam() {
-        ArgumentTypes ats = new ArgumentTypes(new Object[] { });
-        assertApplicable(ats);
-        assertNotApplicable(ats, Object.class);
-    }
-
-    public void testVarags() {
-        Object[][] argLists = new Object[][] {
-            new Object[] { "", 1, 2, 3 },
-            new Object[] { "", 1, (byte) 2, 3 },
-            new Object[] { "", 1},
-            new Object[] { "" },
-        };
-        for (Object[] args : argLists) {
-            ArgumentTypes ats = new ArgumentTypes(args);
-            assertApplicable(ats, true, String.class, int[].class);
-            assertApplicable(ats, true, String.class, Integer[].class);
-            assertApplicable(ats, true, Object.class, Comparable[].class);
-            assertApplicable(ats, true, Object.class, Object[].class);
-            assertNotApplicable(ats, true, StringBuilder.class, int[].class);
-            if (args.length > 1) {
-                assertNotApplicable(ats, true, String.class, String[].class);
-            } else {
-                assertApplicable(ats, true, String.class, String[].class);
-            }
-        }
-    }
-    
-    private void assertNotApplicable(ArgumentTypes ats, Class... paramTypes) {
-        assertNotApplicable(ats, false, paramTypes);
-    }
-    
-    private void assertNotApplicable(ArgumentTypes ats, boolean varargs, Class... paramTypes) {
-        List tested = new ArrayList();
-        tested.add(new ReflectionCallableMemberDescriptor((Method) null, paramTypes));
-        if (ats.getApplicables(tested, varargs).size() != 0) {
-            fail("Parameter types were applicable");
-        }
-    }
-
-    private void assertApplicable(ArgumentTypes ats, Class<?>... paramTypes) {
-        assertApplicable(ats, false, paramTypes);
-    }
-    
-    private void assertApplicable(ArgumentTypes ats, boolean varargs, Class<?>... paramTypes) {
-        List tested = new ArrayList();
-        tested.add(new ReflectionCallableMemberDescriptor((Method) null, paramTypes));
-        if (ats.getApplicables(tested, varargs).size() != 1) {
-            fail("Parameter types weren't applicable");
-        }
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/051a0822/src/test/java/org/apache/freemarker/core/model/impl/beans/IsMoreSpecificParameterTypeTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/freemarker/core/model/impl/beans/IsMoreSpecificParameterTypeTest.java b/src/test/java/org/apache/freemarker/core/model/impl/beans/IsMoreSpecificParameterTypeTest.java
deleted file mode 100644
index e71f071..0000000
--- a/src/test/java/org/apache/freemarker/core/model/impl/beans/IsMoreSpecificParameterTypeTest.java
+++ /dev/null
@@ -1,98 +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 org.apache.freemarker.core.model.impl.beans;
-
-import java.math.BigDecimal;
-import java.util.HashMap;
-import java.util.Map;
-
-import junit.framework.TestCase;
-
-public class IsMoreSpecificParameterTypeTest extends TestCase {
-
-    public IsMoreSpecificParameterTypeTest(String name) {
-        super(name);
-    }
-    
-    public void testFixed() {
-        assertEquals(1, _MethodUtil.isMoreOrSameSpecificParameterType(String.class, String.class, true, 0));
-        assertEquals(1, _MethodUtil.isMoreOrSameSpecificParameterType(int.class, int.class, true, 0));
-        
-        assertEquals(2, _MethodUtil.isMoreOrSameSpecificParameterType(int.class, Integer.class, true, 0));
-        assertEquals(2, _MethodUtil.isMoreOrSameSpecificParameterType(boolean.class, Boolean.class, true, 0));
-        
-        assertEquals(3, _MethodUtil.isMoreOrSameSpecificParameterType(int.class, long.class, true, 0));
-        assertEquals(3, _MethodUtil.isMoreOrSameSpecificParameterType(int.class, double.class, true, 0));
-        assertEquals(3, _MethodUtil.isMoreOrSameSpecificParameterType(int.class, Long.class, true, 0));
-        assertEquals(3, _MethodUtil.isMoreOrSameSpecificParameterType(int.class, Double.class, true, 0));
-        assertEquals(3, _MethodUtil.isMoreOrSameSpecificParameterType(Integer.class, Long.class, true, 0));
-        assertEquals(3, _MethodUtil.isMoreOrSameSpecificParameterType(Integer.class, Double.class, true, 0));
-
-        assertEquals(4, _MethodUtil.isMoreOrSameSpecificParameterType(HashMap.class, Map.class, true, 0));
-        assertEquals(4, _MethodUtil.isMoreOrSameSpecificParameterType(String.class, CharSequence.class, true, 0));
-        assertEquals(4, _MethodUtil.isMoreOrSameSpecificParameterType(Integer.class, Number.class, true, 0));
-        assertEquals(4, _MethodUtil.isMoreOrSameSpecificParameterType(int.class, Number.class, true, 0));
-        
-        assertEquals(0, _MethodUtil.isMoreOrSameSpecificParameterType(Map.class, String.class, true, 0));
-        assertEquals(0, _MethodUtil.isMoreOrSameSpecificParameterType(Integer.class, int.class, true, 0));
-        assertEquals(0, _MethodUtil.isMoreOrSameSpecificParameterType(Boolean.class, boolean.class, true, 0));
-        assertEquals(0, _MethodUtil.isMoreOrSameSpecificParameterType(int.class, boolean.class, true, 0));
-        assertEquals(0, _MethodUtil.isMoreOrSameSpecificParameterType(int.class, Boolean.class, true, 0));
-        assertEquals(0, _MethodUtil.isMoreOrSameSpecificParameterType(int.class, String.class, true, 0));
-        assertEquals(0, _MethodUtil.isMoreOrSameSpecificParameterType(int.class, BigDecimal.class, true, 0));
-        assertEquals(0, _MethodUtil.isMoreOrSameSpecificParameterType(Long.class, Integer.class, true, 0));
-        assertEquals(0, _MethodUtil.isMoreOrSameSpecificParameterType(long.class, Integer.class, true, 0));
-        assertEquals(0, _MethodUtil.isMoreOrSameSpecificParameterType(Long.class, int.class, true, 0));
-        assertEquals(0, _MethodUtil.isMoreOrSameSpecificParameterType(Integer.class, BigDecimal.class, true, 0));
-    }
-    
-    public void testBuggy() {
-        assertEquals(1, _MethodUtil.isMoreOrSameSpecificParameterType(String.class, String.class, false, 0));
-        assertEquals(1, _MethodUtil.isMoreOrSameSpecificParameterType(int.class, int.class, false, 0));
-        
-        assertEquals(0, _MethodUtil.isMoreOrSameSpecificParameterType(int.class, Integer.class, false, 0));
-        assertEquals(0, _MethodUtil.isMoreOrSameSpecificParameterType(boolean.class, Boolean.class, false, 0));
-        
-        assertEquals(3, _MethodUtil.isMoreOrSameSpecificParameterType(int.class, long.class, false, 0));
-        assertEquals(3, _MethodUtil.isMoreOrSameSpecificParameterType(int.class, double.class, false, 0));
-        assertEquals(0, _MethodUtil.isMoreOrSameSpecificParameterType(int.class, Long.class, false, 0));
-        assertEquals(0, _MethodUtil.isMoreOrSameSpecificParameterType(int.class, Double.class, false, 0));
-        assertEquals(0, _MethodUtil.isMoreOrSameSpecificParameterType(Integer.class, Long.class, false, 0));
-        assertEquals(0, _MethodUtil.isMoreOrSameSpecificParameterType(Integer.class, Double.class, false, 0));
-
-        assertEquals(4, _MethodUtil.isMoreOrSameSpecificParameterType(HashMap.class, Map.class, false, 0));
-        assertEquals(4, _MethodUtil.isMoreOrSameSpecificParameterType(String.class, CharSequence.class, false, 0));
-        assertEquals(4, _MethodUtil.isMoreOrSameSpecificParameterType(Integer.class, Number.class, false, 0));
-        assertEquals(0, _MethodUtil.isMoreOrSameSpecificParameterType(int.class, Number.class, false, 0));
-        
-        assertEquals(0, _MethodUtil.isMoreOrSameSpecificParameterType(Map.class, String.class, true, 0));
-        assertEquals(0, _MethodUtil.isMoreOrSameSpecificParameterType(Integer.class, int.class, true, 0));
-        assertEquals(0, _MethodUtil.isMoreOrSameSpecificParameterType(Boolean.class, boolean.class, true, 0));
-        assertEquals(0, _MethodUtil.isMoreOrSameSpecificParameterType(int.class, boolean.class, true, 0));
-        assertEquals(0, _MethodUtil.isMoreOrSameSpecificParameterType(int.class, Boolean.class, true, 0));
-        assertEquals(0, _MethodUtil.isMoreOrSameSpecificParameterType(int.class, String.class, true, 0));
-        assertEquals(0, _MethodUtil.isMoreOrSameSpecificParameterType(int.class, BigDecimal.class, true, 0));
-        assertEquals(0, _MethodUtil.isMoreOrSameSpecificParameterType(Long.class, Integer.class, true, 0));
-        assertEquals(0, _MethodUtil.isMoreOrSameSpecificParameterType(long.class, Integer.class, true, 0));
-        assertEquals(0, _MethodUtil.isMoreOrSameSpecificParameterType(Long.class, int.class, true, 0));
-        assertEquals(0, _MethodUtil.isMoreOrSameSpecificParameterType(Integer.class, BigDecimal.class, true, 0));
-    }
-
-}


Mime
View raw message