1 /*
2 * $Id: ProtectedInnerClassTest.java 1104112 2011-05-17 10:25:53Z mcucchiara $
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance
9 * with the License. You may obtain a copy of the License at
10 *
11 * http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing,
14 * software distributed under the License is distributed on an
15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16 * KIND, either express or implied. See the License for the
17 * specific language governing permissions and limitations
18 * under the License.
19 */
20 package org.apache.commons.ognl.test;
21
22 import org.apache.commons.ognl.test.objects.Root;
23 import org.junit.runner.RunWith;
24 import org.junit.runners.Parameterized;
25 import org.junit.runners.Parameterized.Parameters;
26
27 import java.util.ArrayList;
28 import java.util.Collection;
29
30 @RunWith(value = Parameterized.class)
31 public class ProtectedInnerClassTest
32 extends OgnlTestCase
33 {
34
35 private static Root ROOT = new Root();
36
37 private static Object[][] TESTS = {
38 // member access of inner class (Arrays.asList() returned protected inner class)
39 { ROOT, "list.size()", ROOT.getList().size() },
40 { ROOT, "list[0]", ROOT.getList().get( 0 ) }
41 };
42
43 /*
44 * =================================================================== Public static methods
45 * ===================================================================
46 */
47 @Parameters
48 public static Collection<Object[]> data()
49 {
50 Collection<Object[]> data = new ArrayList<Object[]>(TESTS.length);
51 for ( Object[] TEST : TESTS )
52 {
53 Object[] tmp = new Object[6];
54 tmp[0] = TEST[1];
55 tmp[1] = TEST[0];
56 tmp[2] = TEST[1];
57 tmp[3] = TEST[2];
58
59 data.add( tmp );
60 }
61 return data;
62 }
63
64 /*
65 * =================================================================== Constructors
66 * ===================================================================
67 */
68 public ProtectedInnerClassTest( String name, Object root, String expressionString, Object expectedResult,
69 Object setValue, Object expectedAfterSetResult )
70 {
71 super( name, root, expressionString, expectedResult, setValue, expectedAfterSetResult );
72 }
73 }