1
2
3
4
5 package com.qulice.pmd;
6
7 import org.hamcrest.Matchers;
8 import org.junit.jupiter.api.Test;
9
10
11
12
13
14
15
16
17
18
19
20
21 final class PmdExcessiveParameterListTest {
22
23 @Test
24 void doesNotFireOnConstructorWithManyParameters() throws Exception {
25 new PmdAssert(
26 "ExcessiveParameterListInConstructor.java",
27 Matchers.any(Boolean.class),
28 Matchers.not(
29 Matchers.containsString("(ExcessiveParameterList)")
30 )
31 ).assertOk();
32 }
33
34 @Test
35 void firesOnMethodWithManyParameters() throws Exception {
36 new PmdAssert(
37 "ExcessiveParameterListInMethod.java",
38 Matchers.is(false),
39 Matchers.containsString("(ExcessiveParameterList)")
40 ).assertOk();
41 }
42
43 @Test
44 void reportsRedundantSuppressionOnConstructor() throws Exception {
45 new PmdAssert(
46 "ExcessiveParameterListSuppressedInConstructor.java",
47 Matchers.is(false),
48 Matchers.containsString("(UnnecessaryWarningSuppression)")
49 ).assertOk();
50 }
51
52 @Test
53 void honoursSuppressionOnMethod() throws Exception {
54 new PmdAssert(
55 "ExcessiveParameterListSuppressedInMethod.java",
56 Matchers.any(Boolean.class),
57 Matchers.allOf(
58 Matchers.not(
59 Matchers.containsString("(ExcessiveParameterList)")
60 ),
61 Matchers.not(
62 Matchers.containsString("(UnnecessaryWarningSuppression)")
63 )
64 )
65 ).assertOk();
66 }
67 }