32
32
import java .util .Arrays ;
33
33
import java .util .Collection ;
34
34
import org .hamcrest .Matchers ;
35
- import org .junit .Test ;
36
- import org .junit .runner .RunWith ;
37
- import org .junit .runners .Parameterized ;
35
+ import org .junit .jupiter .params .ParameterizedTest ;
36
+ import org .junit .jupiter .params .provider .MethodSource ;
38
37
39
38
/**
40
39
* Tests for disabled rules.
41
40
* @since 0.16
42
41
*/
43
- @ RunWith (Parameterized .class )
44
42
public final class PmdDisabledRulesTest {
45
43
46
- /**
47
- * Disabled rule name.
48
- */
49
- private final String rule ;
50
-
51
- /**
52
- * Constructor.
53
- * @param rule Disabled rule name.
54
- */
55
- public PmdDisabledRulesTest (final String rule ) {
56
- this .rule = rule ;
57
- }
58
-
59
44
/**
60
45
* Collection of disabled rules.
61
46
* @return Collection of disabled rules.
62
47
*/
63
- @ Parameterized .Parameters
64
48
public static Collection <String []> parameters () {
65
49
return Arrays .asList (
66
50
new String [][] {
@@ -80,14 +64,15 @@ public static Collection<String[]> parameters() {
80
64
* PmdValidator has rules disabled.
81
65
* @throws Exception In case of error.
82
66
*/
83
- @ Test
84
- public void disablesRules () throws Exception {
67
+ @ ParameterizedTest
68
+ @ MethodSource ("parameters" )
69
+ public void disablesRules (final String rule ) throws Exception {
85
70
new PmdAssert (
86
- String .format ("%s.java" , this . rule ),
71
+ String .format ("%s.java" , rule ),
87
72
Matchers .any (Boolean .class ),
88
73
Matchers .not (
89
74
Matchers .containsString (
90
- String .format ("(%s)" , this . rule )
75
+ String .format ("(%s)" , rule )
91
76
)
92
77
)
93
78
).validate ();
0 commit comments