2828import com .tngtech .archunit .core .domain .JavaMember ;
2929import com .tngtech .archunit .core .domain .JavaMethod ;
3030import com .tngtech .archunit .core .domain .JavaModifier ;
31+ import com .tngtech .archunit .core .domain .properties .CanBeAnnotated .Predicates ;
3132import com .tngtech .archunit .core .domain .properties .HasName ;
3233import com .tngtech .archunit .core .importer .ClassFileImporter ;
3334import com .tngtech .archunit .lang .ArchCondition ;
3435import com .tngtech .archunit .lang .ConditionEvents ;
3536import com .tngtech .archunit .lang .SimpleConditionEvent ;
3637import java .util .List ;
3738import org .junit .jupiter .api .Test ;
39+ import org .junit .jupiter .params .ParameterizedTest ;
3840import org .sonar .plugins .communitydelphi .api .check .DelphiCheck ;
3941
4042class CheckTestNameTest {
@@ -123,6 +125,10 @@ void testCheckTestsVerifyingIssuesAreNamedCorrectly() {
123125 methods ()
124126 .that (VERIFY_ISSUES )
125127 .and (not (TESTING_IMPLEMENTATION_DETAILS ))
128+ .and (
129+ DescribedPredicate .or (
130+ Predicates .annotatedWith (Test .class ),
131+ Predicates .annotatedWith (ParameterizedTest .class )))
126132 .should ()
127133 .haveNameMatching (".*ShouldAdd(Issues?|QuickFix(es)?)$" )
128134 .allowEmptyShould (true )
@@ -135,6 +141,10 @@ void testCheckTestsVerifyingNoIssuesAreNamedCorrectly() {
135141 .that (VERIFY_NO_ISSUES )
136142 .and (not (TESTING_IMPLEMENTATION_DETAILS ))
137143 .and (not (CALL_ASSERT_THROW_BY ))
144+ .and (
145+ DescribedPredicate .or (
146+ Predicates .annotatedWith (Test .class ),
147+ Predicates .annotatedWith (ParameterizedTest .class )))
138148 .should ()
139149 .haveNameMatching (".*ShouldNotAddIssues?$" )
140150 .allowEmptyShould (true )
@@ -166,8 +176,10 @@ void testCheckTestsShouldNotThrowAreNamedCorrectly() {
166176 @ Test
167177 void testCheckTestsShouldBeNamedCorrectly () {
168178 methods ()
169- .that ()
170- .areAnnotatedWith (Test .class )
179+ .that (
180+ DescribedPredicate .or (
181+ Predicates .annotatedWith (Test .class ),
182+ Predicates .annotatedWith (ParameterizedTest .class )))
171183 .and (not (DECLARED_IN_METATESTS ))
172184 .should ()
173185 .haveNameMatching (".*Should((Not)?(Throw|Add(Issues?|QuickFix(es)?)))" )
0 commit comments