001    /*
002     * $Id: ProtectedInnerClassTest.java 1104112 2011-05-17 10:25:53Z mcucchiara $
003     * Licensed to the Apache Software Foundation (ASF) under one
004     * or more contributor license agreements.  See the NOTICE file
005     * distributed with this work for additional information
006     * regarding copyright ownership.  The ASF licenses this file
007     * to you under the Apache License, Version 2.0 (the
008     * "License"); you may not use this file except in compliance
009     * with the License.  You may obtain a copy of the License at
010     *
011     * http://www.apache.org/licenses/LICENSE-2.0
012     *
013     * Unless required by applicable law or agreed to in writing,
014     * software distributed under the License is distributed on an
015     * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
016     * KIND, either express or implied.  See the License for the
017     * specific language governing permissions and limitations
018     * under the License.
019     */
020    package org.apache.commons.ognl.test;
021    
022    import org.apache.commons.ognl.test.objects.Root;
023    import org.junit.runner.RunWith;
024    import org.junit.runners.Parameterized;
025    import org.junit.runners.Parameterized.Parameters;
026    
027    import java.util.ArrayList;
028    import java.util.Collection;
029    
030    @RunWith(value = Parameterized.class)
031    public class ProtectedInnerClassTest
032        extends OgnlTestCase
033    {
034    
035        private static Root ROOT = new Root();
036    
037        private static Object[][] TESTS = {
038            // member access of inner class (Arrays.asList() returned protected inner class)
039            { ROOT, "list.size()", ROOT.getList().size() },
040            { ROOT, "list[0]", ROOT.getList().get( 0 ) }
041        };
042    
043        /*
044         * =================================================================== Public static methods
045         * ===================================================================
046         */
047        @Parameters
048        public static Collection<Object[]> data()
049        {
050            Collection<Object[]> data = new ArrayList<Object[]>(TESTS.length);
051            for ( Object[] TEST : TESTS )
052            {
053                Object[] tmp = new Object[6];
054                tmp[0] = TEST[1];
055                tmp[1] = TEST[0];
056                tmp[2] = TEST[1];
057                tmp[3] = TEST[2];
058    
059                data.add( tmp );
060            }
061            return data;
062        }
063    
064        /*
065         * =================================================================== Constructors
066         * ===================================================================
067         */
068        public ProtectedInnerClassTest( String name, Object root, String expressionString, Object expectedResult,
069                                        Object setValue, Object expectedAfterSetResult )
070        {
071            super( name, root, expressionString, expectedResult, setValue, expectedAfterSetResult );
072        }
073    }