@@ -169,4 +169,155 @@ void alwaysExcludedClassName(String pattern) {
169
169
.isEmpty ();
170
170
}
171
171
172
+ //@formatter:off
173
+ @ ValueSource (strings = {
174
+ "org.junit.jupiter.*" ,
175
+ "org.junit.platform.*.NonExistentClass" ,
176
+ "*.NonExistentClass*" ,
177
+ "*NonExistentClass*" ,
178
+ "AExecutionConditionClass, BExecutionConditionClass"
179
+ })
180
+ //@formatter:on
181
+ @ ParameterizedTest
182
+ void neverIncludedConditions (String pattern ) {
183
+ List <? extends ExecutionCondition > executionConditions = List .of (new AExecutionConditionClass (),
184
+ new BExecutionConditionClass ());
185
+ assertThat (executionConditions ).filteredOn (ClassNamePatternFilterUtils .includeMatchingClasses (pattern )) //
186
+ .isEmpty ();
187
+ }
188
+
189
+ //@formatter:off
190
+ @ ValueSource (strings = {
191
+ "org.junit.platform.*" ,
192
+ "*.platform.*" ,
193
+ "*" ,
194
+ "*AExecutionConditionClass, *BExecutionConditionClass" ,
195
+ "*ExecutionConditionClass"
196
+ })
197
+ //@formatter:on
198
+ @ ParameterizedTest
199
+ void alwaysIncludedConditions (String pattern ) {
200
+ List <? extends ExecutionCondition > executionConditions = List .of (new AExecutionConditionClass (),
201
+ new BExecutionConditionClass ());
202
+ assertThat (executionConditions ).filteredOn (ClassNamePatternFilterUtils .includeMatchingClasses (pattern )) //
203
+ .hasSize (2 );
204
+ }
205
+
206
+ //@formatter:off
207
+ @ ValueSource (strings = {
208
+ "org.junit.jupiter.*" ,
209
+ "org.junit.platform.*.NonExistentClass" ,
210
+ "*.NonExistentClass*" ,
211
+ "*NonExistentClass*" ,
212
+ "ATestExecutionListenerClass, BTestExecutionListenerClass"
213
+ })
214
+ //@formatter:on
215
+ @ ParameterizedTest
216
+ void neverIncludedListeners (String pattern ) {
217
+ List <? extends TestExecutionListener > executionConditions = List .of (new ATestExecutionListenerClass (),
218
+ new BTestExecutionListenerClass ());
219
+ assertThat (executionConditions ).filteredOn (ClassNamePatternFilterUtils .includeMatchingClasses (pattern )) //
220
+ .isEmpty ();
221
+ }
222
+
223
+ //@formatter:off
224
+ @ ValueSource (strings = {
225
+ "org.junit.platform.*" ,
226
+ "*.platform.*" ,
227
+ "*" ,
228
+ "*ATestExecutionListenerClass, *BTestExecutionListenerClass" ,
229
+ "*TestExecutionListenerClass"
230
+ })
231
+ //@formatter:on
232
+ @ ParameterizedTest
233
+ void alwaysIncludedListeners (String pattern ) {
234
+ List <? extends TestExecutionListener > executionConditions = List .of (new ATestExecutionListenerClass (),
235
+ new BTestExecutionListenerClass ());
236
+ assertThat (executionConditions ).filteredOn (ClassNamePatternFilterUtils .includeMatchingClasses (pattern )) //
237
+ .hasSize (2 );
238
+ }
239
+
240
+ //@formatter:off
241
+ @ ValueSource (strings = {
242
+ "org.junit.jupiter.*" ,
243
+ "org.junit.platform.*.NonExistentClass" ,
244
+ "*.NonExistentClass*" ,
245
+ "*NonExistentClass*" ,
246
+ "AVanillaEmpty, BVanillaEmpty"
247
+ })
248
+ //@formatter:on
249
+ @ ParameterizedTest
250
+ void neverIncludedClass (String pattern ) {
251
+ var executionConditions = List .of (new AVanillaEmpty (), new BVanillaEmpty ());
252
+ assertThat (executionConditions ).filteredOn (ClassNamePatternFilterUtils .includeMatchingClasses (pattern )) //
253
+ .isEmpty ();
254
+ }
255
+
256
+ //@formatter:off
257
+ @ ValueSource (strings = {
258
+ "org.junit.platform.*" ,
259
+ "*.platform.*" ,
260
+ "*" ,
261
+ "*AVanillaEmpty, *BVanillaEmpty" ,
262
+ "*VanillaEmpty"
263
+ })
264
+ //@formatter:on
265
+ @ ParameterizedTest
266
+ void alwaysIncludedClass (String pattern ) {
267
+ var executionConditions = List .of (new AVanillaEmpty (), new BVanillaEmpty ());
268
+ assertThat (executionConditions ).filteredOn (ClassNamePatternFilterUtils .includeMatchingClasses (pattern )) //
269
+ .hasSize (2 );
270
+ }
271
+
272
+ //@formatter:off
273
+ @ ValueSource (strings = {
274
+ "org.junit.jupiter.*" ,
275
+ "org.junit.platform.*.NonExistentClass" ,
276
+ "*.NonExistentClass*" ,
277
+ "*NonExistentClass*" ,
278
+ "AVanillaEmpty, BVanillaEmpty"
279
+ })
280
+ //@formatter:on
281
+ @ ParameterizedTest
282
+ void neverIncludedClassName (String pattern ) {
283
+ var executionConditions = List .of ("org.junit.platform.commons.util.classes.AVanillaEmpty" ,
284
+ "org.junit.platform.commons.util.classes.BVanillaEmpty" );
285
+ assertThat (executionConditions ).filteredOn (ClassNamePatternFilterUtils .includeMatchingClassNames (pattern )) //
286
+ .isEmpty ();
287
+ }
288
+
289
+ //@formatter:off
290
+ @ ValueSource (strings = {
291
+ "org.junit.platform.*" ,
292
+ "*.platform.*" ,
293
+ "*" ,
294
+ "*AVanillaEmpty, *BVanillaEmpty" ,
295
+ "*VanillaEmpty"
296
+ })
297
+ //@formatter:on
298
+ @ ParameterizedTest
299
+ void alwaysIncludedClassName (String pattern ) {
300
+ var executionConditions = List .of ("org.junit.platform.commons.util.classes.AVanillaEmpty" ,
301
+ "org.junit.platform.commons.util.classes.BVanillaEmpty" );
302
+ assertThat (executionConditions ).filteredOn (ClassNamePatternFilterUtils .includeMatchingClassNames (pattern )) //
303
+ .hasSize (2 );
304
+ }
305
+
306
+ //@formatter:off
307
+ @ ValueSource (strings = {
308
+ "org.junit.platform.*" ,
309
+ "*.platform.*" ,
310
+ "*" ,
311
+ "*AVanillaEmpty, *BVanillaEmpty" ,
312
+ "*VanillaEmpty"
313
+ })
314
+ //@formatter:on
315
+ @ ParameterizedTest
316
+ void includeAndExcludeSame (String pattern ) {
317
+ var executionConditions = List .of ("org.junit.platform.commons.util.classes.AVanillaEmpty" ,
318
+ "org.junit.platform.commons.util.classes.BVanillaEmpty" );
319
+ assertThat (executionConditions ).filteredOn (ClassNamePatternFilterUtils .includeMatchingClassNames (pattern )) //
320
+ .hasSize (2 );
321
+ }
322
+
172
323
}
0 commit comments