This is an automated email from the ASF dual-hosted git repository.
zhangliang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git
The following commit(s) were added to refs/heads/master by this push:
new b63c5913128 Enforce assert prefix for @Test and @ParameterizedTest
method names on CheckStyle rule (#38288)
b63c5913128 is described below
commit b63c5913128c813bccf530407d60d0536905a5e6
Author: Liang Zhang <[email protected]>
AuthorDate: Sun Mar 1 19:04:19 2026 +0800
Enforce assert prefix for @Test and @ParameterizedTest method names on
CheckStyle rule (#38288)
---
src/resources/checkstyle.xml | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/src/resources/checkstyle.xml b/src/resources/checkstyle.xml
index 566e04540fe..c8e39d242ac 100644
--- a/src/resources/checkstyle.xml
+++ b/src/resources/checkstyle.xml
@@ -114,6 +114,11 @@
<property name="query"
value="//METHOD_CALL[(./IDENT[@text='assertThat'] or
./DOT/IDENT[@text='assertThat']) and
./ELIST/EXPR[last()]/METHOD_CALL[(./IDENT[@text='is'] or
./DOT/IDENT[@text='is']) and ./ELIST/EXPR/*[self::LITERAL_TRUE or
self::LITERAL_FALSE]]]" />
<message key="matchxpath.match" value="Use assertTrue/assertFalse
instead of assertThat(..., is(true/false))." />
</module>
+ <module name="MatchXpath">
+ <property name="query"
+
value="//METHOD_DEF[./MODIFIERS/ANNOTATION[(./IDENT[@text='Test'] or
./DOT/IDENT[@text='Test'] or ./IDENT[@text='ParameterizedTest'] or
./DOT/IDENT[@text='ParameterizedTest'])] and not(./IDENT[starts-with(@text,
'assert')])]" />
+ <message key="matchxpath.match" value="Method names for @Test and
@ParameterizedTest must start with 'assert'." />
+ </module>
<module name="IllegalType" />
<module name="MissingSwitchDefault" />
<module name="ModifiedControlVariable" />