34
34
import java .util .Collections ;
35
35
import java .util .List ;
36
36
import java .util .Set ;
37
- import org .junit .jupiter .api .Test ;
37
+ import java .util .stream .Stream ;
38
+ import org .junit .jupiter .params .ParameterizedTest ;
39
+ import org .junit .jupiter .params .provider .Arguments ;
40
+ import org .junit .jupiter .params .provider .MethodSource ;
38
41
39
42
public class ECJJava17IRTest extends IRTests {
40
43
@@ -61,7 +64,7 @@ protected Iterable<Entrypoint> makeDefaultEntrypoints(IClassHierarchy cha) {
61
64
return engine ;
62
65
}
63
66
64
- private final IRAssertion checkBinaryLiterals =
67
+ private static final IRAssertion checkBinaryLiterals =
65
68
new IRAssertion () {
66
69
private final TypeReference testClass =
67
70
TypeReference .findOrCreate (
@@ -107,18 +110,7 @@ public void check(CallGraph cg) {
107
110
}
108
111
};
109
112
110
- @ Test
111
- public void testBinaryLiterals () throws IllegalArgumentException , CancelException , IOException {
112
- runTest (
113
- singlePkgTestSrc ("javaonepointseven" ),
114
- rtJar ,
115
- simplePkgTestEntryPoint ("javaonepointseven" ),
116
- Collections .singletonList (checkBinaryLiterals ),
117
- true ,
118
- null );
119
- }
120
-
121
- private final IRAssertion checkCatchMultipleExceptionTypes =
113
+ private static final IRAssertion checkCatchMultipleExceptionTypes =
122
114
new IRAssertion () {
123
115
124
116
private final TypeReference testClass =
@@ -161,18 +153,6 @@ public void check(CallGraph cg) {
161
153
}
162
154
};
163
155
164
- @ Test
165
- public void testCatchMultipleExceptionTypes ()
166
- throws IllegalArgumentException , CancelException , IOException {
167
- runTest (
168
- singlePkgTestSrc ("javaonepointseven" ),
169
- rtJar ,
170
- simplePkgTestEntryPoint ("javaonepointseven" ),
171
- Collections .singletonList (checkCatchMultipleExceptionTypes ),
172
- true ,
173
- null );
174
- }
175
-
176
156
private static final List <IRAssertion > SiSAssertions =
177
157
Collections .singletonList (
178
158
new InstructionOperandAssertion (
@@ -183,49 +163,27 @@ public void testCatchMultipleExceptionTypes()
183
163
1 ,
184
164
new int [] {9 , 58 , 9 , 67 }));
185
165
186
- @ Test
187
- public void testStringsInSwitch () throws IllegalArgumentException , CancelException , IOException {
188
- runTest (
189
- singlePkgTestSrc ("javaonepointseven" ),
190
- rtJar ,
191
- simplePkgTestEntryPoint ("javaonepointseven" ),
192
- SiSAssertions ,
193
- true ,
194
- null );
195
- }
196
-
197
- @ Test
198
- public void testTryWithResourcesStatement ()
199
- throws IllegalArgumentException , CancelException , IOException {
200
- runTest (
201
- singlePkgTestSrc ("javaonepointseven" ),
202
- rtJar ,
203
- simplePkgTestEntryPoint ("javaonepointseven" ),
204
- emptyList ,
205
- true ,
206
- null );
207
- }
208
-
209
- @ Test
210
- public void testTypeInferenceforGenericInstanceCreation ()
211
- throws IllegalArgumentException , CancelException , IOException {
212
- runTest (
213
- singlePkgTestSrc ("javaonepointseven" ),
214
- rtJar ,
215
- simplePkgTestEntryPoint ("javaonepointseven" ),
216
- emptyList ,
217
- true ,
218
- null );
166
+ static Stream <Arguments > java17IRTestNames () {
167
+ return Stream .of (
168
+ Arguments .of ("BinaryLiterals" , Collections .singletonList (checkBinaryLiterals )),
169
+ Arguments .of (
170
+ "CatchMultipleExceptionTypes" ,
171
+ Collections .singletonList (checkCatchMultipleExceptionTypes )),
172
+ Arguments .of ("StringsInSwitch" , SiSAssertions ),
173
+ Arguments .of ("TypeInferenceforGenericInstanceCreation" , emptyList ),
174
+ Arguments .of ("TryWithResourcesStatement" , emptyList ),
175
+ Arguments .of ("UnderscoresInNumericLiterals" , emptyList ));
219
176
}
220
177
221
- @ Test
222
- public void testUnderscoresInNumericLiterals ()
178
+ @ ParameterizedTest
179
+ @ MethodSource ("java17IRTestNames" )
180
+ public void runJava17IRTests (String java17IRTestName , List <IRAssertion > ca )
223
181
throws IllegalArgumentException , CancelException , IOException {
224
182
runTest (
225
- singlePkgTestSrc ("javaonepointseven" ),
183
+ singlePkgTestSrc ("javaonepointseven" , java17IRTestName ),
226
184
rtJar ,
227
- simplePkgTestEntryPoint ("javaonepointseven" ),
228
- emptyList ,
185
+ simplePkgTestEntryPoint ("javaonepointseven" , java17IRTestName ),
186
+ ca ,
229
187
true ,
230
188
null );
231
189
}
0 commit comments