@@ -427,13 +427,6 @@ private static void collectClassesForPackage(String pckgname, List<Class<?>> cla
427
427
put (
428
428
Pattern [].class ,
429
429
random -> new Pattern [] {Pattern .compile ("([a-z]+)" ), Pattern .compile ("([0-9]+)" )});
430
- put (
431
- PatternTypingFilter .PatternTypingRule [].class ,
432
- random ->
433
- new PatternTypingFilter .PatternTypingRule [] {
434
- new PatternTypingFilter .PatternTypingRule (
435
- Pattern .compile ("^(\\ d+)-(\\ d+)$" ), 6 , "$1_hnum_$2" )
436
- });
437
430
put (
438
431
PayloadEncoder .class ,
439
432
random ->
@@ -625,6 +618,23 @@ private String randomNonEmptyString(Random random) {
625
618
new RegExp (AutomatonTestUtil .randomRegexp (random ), RegExp .NONE ).toAutomaton (),
626
619
Operations .DEFAULT_MAX_DETERMINIZED_STATES );
627
620
});
621
+ put (
622
+ PatternTypingFilter .PatternTypingRule [].class ,
623
+ random -> {
624
+ int numRules = TestUtil .nextInt (random , 1 , 3 );
625
+ PatternTypingFilter .PatternTypingRule [] patternTypingRules =
626
+ new PatternTypingFilter .PatternTypingRule [numRules ];
627
+ for (int i = 0 ; i < patternTypingRules .length ; i ++) {
628
+ String s = TestUtil .randomSimpleString (random , 1 , 2 );
629
+ // random regex with one group
630
+ String regex = s + "(.*)" ;
631
+ // pattern rule with a template that accepts one group.
632
+ patternTypingRules [i ] =
633
+ new PatternTypingFilter .PatternTypingRule (
634
+ Pattern .compile (regex ), TestUtil .nextInt (random , 1 , 8 ), s + "_$1" );
635
+ }
636
+ return patternTypingRules ;
637
+ });
628
638
}
629
639
};
630
640
0 commit comments