1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 package org.apache.commons.ognl.test;
21
22 import java.util.ArrayList;
23 import java.util.Collection;
24
25 import org.apache.commons.ognl.test.objects.BaseGeneric;
26 import org.apache.commons.ognl.test.objects.GameGeneric;
27 import org.apache.commons.ognl.test.objects.GameGenericObject;
28 import org.apache.commons.ognl.test.objects.GenericRoot;
29 import org.junit.runner.RunWith;
30 import org.junit.runners.Parameterized;
31 import org.junit.runners.Parameterized.Parameters;
32
33
34
35
36 @RunWith(value = Parameterized.class)
37 public class GenericsTest
38 extends OgnlTestCase
39 {
40 static GenericRoot ROOT = new GenericRoot();
41
42 static BaseGeneric<GameGenericObject, Long> GENERIC = new GameGeneric();
43
44 static Object[][] TESTS = {
45
46 { GENERIC, "ids", null, new Long[] { 1l, 101l }, new Long[] { 1l, 101l } },
47
48 };
49
50 @Parameters
51 public static Collection<Object[]> data()
52 {
53 Collection<Object[]> data = new ArrayList<Object[]>(TESTS.length);
54 for ( int i = 0; i < TESTS.length; i++ )
55 {
56 Object[] tmp = new Object[6];
57 tmp[0] = TESTS[i][1] + " (" + TESTS[i][2] + ")";
58 tmp[1] = TESTS[i][0];
59 tmp[2] = TESTS[i][1];
60 tmp[3] = TESTS[i][2];
61 tmp[4] = TESTS[i][3];
62 tmp[5] = TESTS[i][4];
63
64 data.add( tmp );
65 }
66 return data;
67 }
68
69 public GenericsTest( String name, Object root, String expressionString, Object expectedResult, Object setValue,
70 Object expectedAfterSetResult )
71 {
72 super( name, root, expressionString, expectedResult, setValue, expectedAfterSetResult );
73 }
74 }