This is an automated email from the ASF dual-hosted git repository.
terrymanu 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 4e420a6ae3a Enforce parameterized test naming rules (#40301)
4e420a6ae3a is described below
commit 4e420a6ae3a1f569b27030bcd1f47c8bc389becd
Author: Liang Zhang <[email protected]>
AuthorDate: Wed Oct 21 00:10:25 2026 +0800
Enforce parameterized test naming rules (#40301)
* Enforce parameterized test naming rules
* Relax parameterized test naming and remove redundant labels
* Restore parameterized tests and relax naming rules
---
.codex/harness/agents/cases.toml | 12 +++---
.../scripts/tests/test_checkstyle_rules.py | 48 +---------------------
CODE_OF_CONDUCT.md | 3 +-
docs/community/content/involved/conduct/code.cn.md | 3 +-
docs/community/content/involved/conduct/code.en.md | 3 +-
.../client/netty/MySQLNegotiateHandlerTest.java | 6 +--
.../client/util/ProtobufAnyValueConverterTest.java | 30 +++++++-------
.../mysql/impl/MySQLBitCountFunctionTest.java | 22 +++++-----
.../core/tool/payload/SQLExecutionPayloadTest.java | 18 ++++----
.../LocalTCLProxyBackendHandlerFactoryTest.java | 22 +++++-----
src/resources/checkstyle.xml | 12 ------
11 files changed, 59 insertions(+), 120 deletions(-)
diff --git a/.codex/harness/agents/cases.toml b/.codex/harness/agents/cases.toml
index e4bc2c042f3..302248e3946 100644
--- a/.codex/harness/agents/cases.toml
+++ b/.codex/harness/agents/cases.toml
@@ -4598,12 +4598,12 @@ required_reasons = ["read_only_request"]
critical = true
policy_binding_profile = "gen-ut"
id = "repository_parameterized_source_and_signature_contract"
-description = "Keeps standard JUnit sources while requiring meaningful rows,
display names and the exact first parameter."
-prompt = "Classify repository tests using only the bound rules. A has
@ParameterizedTest(name = \"{0}\"), first parameter final String name, and
@CsvSource with three meaningful argument sets. B has the same declaration with
only two meaningful rows. C has three meaningful rows but first parameter
String name without final. D keeps two meaningful standalone JUnit 5 @Test
cases instead of inventing a third row. Do not inspect, execute checks or
change anything. Return exactly four assignm [...]
-required_summary_terms = ["[A]=allow", "[B]=reject", "[C]=reject", "[D]=allow"]
-required_summary_prefix = "[A]=allow; [B]=reject; [C]=reject; [D]=allow"
-max_summary_chars = 44
-policy_assertions = [{source = "code-of-conduct", statements = ["For
parameterized tests, provide display names via parameters and use `\"{0}\"` as
the display-name template;", "Declare the first parameter of each parameterized
test exactly as `final String name`;", "Provide at least three meaningful
argument sets for each parameterized test;"]}]
+description = "Allows distinguishable JUnit display names and descriptive
parameters while retaining meaningful argument rows."
+prompt = "This is a read-only classification request. Classify repository
tests using only the bound rules. A has @ParameterizedTest(name = \"{0}\"),
first parameter final String name unused in the body, and @CsvSource with three
meaningful argument sets whose first values are distinct scenario labels. B has
the same declaration with only two meaningful rows. C uses
@ParameterizedTest(name = \"value={0}, expected={1}\"), parameters final int
value and final int expected used by the targe [...]
+required_summary_terms = ["[A]=allow", "[B]=reject", "[C]=allow", "[D]=allow",
"[E]=allow", "[F]=allow", "[G]=allow", "[H]=allow"]
+required_summary_prefix = "[A]=allow; [B]=reject; [C]=allow; [D]=allow;
[E]=allow; [F]=allow; [G]=allow; [H]=allow"
+max_summary_chars = 90
+policy_assertions = [{source = "code-of-conduct", statements = ["Parameterized
test display names must distinguish test scenarios;", "Provide at least three
meaningful argument sets for each parameterized test;", "Only combine cases
that invoke the same method under test and use the same form of assertion."]}]
[[cases]]
group = "unit-test policy"
diff --git
a/.codex/skills/coding-standards/scripts/tests/test_checkstyle_rules.py
b/.codex/skills/coding-standards/scripts/tests/test_checkstyle_rules.py
index 4f0907e1751..180c0a0a616 100644
--- a/.codex/skills/coding-standards/scripts/tests/test_checkstyle_rules.py
+++ b/.codex/skills/coding-standards/scripts/tests/test_checkstyle_rules.py
@@ -29,9 +29,7 @@ from pathlib import Path
REPOSITORY_ROOT = Path(__file__).resolve().parents[5]
BOOLEAN_MESSAGE = "Use assertTrue/assertFalse instead of assertThat(...,
is(true/false))."
-DISPLAY_NAME_MESSAGE = 'Parameterized tests must use name = "{0}".'
-NAME_PARAMETER_MESSAGE = "Declare final String name as the first parameter of
parameterized tests."
-RULE_MESSAGES = {BOOLEAN_MESSAGE, DISPLAY_NAME_MESSAGE, NAME_PARAMETER_MESSAGE}
+RULE_MESSAGES = {BOOLEAN_MESSAGE}
class CheckstyleRulesTest(unittest.TestCase):
@@ -59,40 +57,9 @@ class CheckstyleRulesTest(unittest.TestCase):
"comment": ("// assertThat(actual, is(Boolean.TRUE));", False),
"string_content": ('String example = "assertThat(actual,
is(Boolean.TRUE));";', False),
}
- cls.display_name_cases = {
- "default": ("@ParameterizedTest", True),
- "wrong_template": ('@ParameterizedTest(name = "{index}")', True),
- "prefix": ('@ParameterizedTest(name = "foo {0}")', True),
- "constant": ("@ParameterizedTest(name = DISPLAY_NAME)", True),
- "concatenation": ('@ParameterizedTest(name = "{" + "0}")', True),
- "correct": ('@ParameterizedTest(name = "{0}")', False),
- "multiline": ('@ParameterizedTest(\n name = "{0}"\n )',
False),
- "other_annotation": ('@ParameterizedTest(name = "{0}")\n
@MethodSource("scenarios")', False),
- "qualified": ('@org.junit.jupiter.params.ParameterizedTest(name =
"{0}")', False),
- "ordinary_test": ("@Test", False),
- }
- cls.name_parameter_cases = {
- "none": ("", True),
- "missing_final": ("String name", True),
- "wrong_name": ("final String description", True),
- "wrong_type": ("final Object name", True),
- "wrong_position": ("final int value, final String name", True),
- "array": ("final String[] name", True),
- "post_name_array": ("final String name[]", True),
- "varargs": ("final String... name", True),
- "correct": ("final String name", False),
- "later_parameters": ("final String name, final int value", False),
- "annotation": ("@Deprecated final String name", False),
- "qualified_type": ("final java.lang.String name", False),
- }
cls.fixture_paths = {}
for name, (statement, _) in cls.boolean_cases.items():
cls.write_fixture(directory, f"boolean_{name}", f"void
assertScenario() {{\n {statement}\n }}")
- for name, (annotation, _) in cls.display_name_cases.items():
- cls.write_fixture(directory, f"display_{name}", f"{annotation}\n
void assertScenario(final String name) {{\n }}")
- for name, (parameters, _) in cls.name_parameter_cases.items():
- cls.write_fixture(directory, f"parameter_{name}",
'@ParameterizedTest(name = "{0}")\n ' + f"void assertScenario({parameters})
{{\n }}")
- cls.write_fixture(directory, "ordinary_helper", "void
assertScenario(final int value) {\n }")
properties = ET.parse(REPOSITORY_ROOT /
"pom.xml").getroot().find("{*}properties")
cls.engine_version = properties.findtext("{*}checkstyle.version")
cls.write_pom(directory,
properties.findtext("{*}maven-checkstyle-plugin.version"))
@@ -153,19 +120,6 @@ class CheckstyleRulesTest(unittest.TestCase):
expected = [(BOOLEAN_MESSAGE, "error")] if violates else []
self.assertEqual(expected,
self.actual_diagnostics[self.fixture_paths[f"boolean_{name}"]])
- def test_parameterized_tests_use_argument_display_names(self) -> None:
- for name, (_, violates) in self.display_name_cases.items():
- with self.subTest(name=name):
- expected = [(DISPLAY_NAME_MESSAGE, "warning")] if violates
else []
- self.assertEqual(expected,
self.actual_diagnostics[self.fixture_paths[f"display_{name}"]])
-
- def test_parameterized_tests_start_with_a_named_string(self) -> None:
- for name, (_, violates) in self.name_parameter_cases.items():
- with self.subTest(name=name):
- expected = [(NAME_PARAMETER_MESSAGE, "warning")] if violates
else []
- self.assertEqual(expected,
self.actual_diagnostics[self.fixture_paths[f"parameter_{name}"]])
- self.assertEqual([],
self.actual_diagnostics[self.fixture_paths["ordinary_helper"]])
-
if __name__ == "__main__":
unittest.main()
diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md
index 6b439d471bd..cd8f620e3d3 100644
--- a/CODE_OF_CONDUCT.md
+++ b/CODE_OF_CONDUCT.md
@@ -112,8 +112,7 @@ The following code of conduct is based on full compliance
with the [Apache Softw
- Test data should use standardized prefixes (e.g., `foo_`/`bar_`) to clearly
identify their test purpose
- Use `PropertiesBuilder` simplify `Properties` building.
- Parameterized tests:
- - For parameterized tests, provide display names via parameters and use
`"{0}"` as the display-name template;
- - Declare the first parameter of each parameterized test exactly as `final
String name`;
+ - Parameterized test display names must distinguish test scenarios;
- Provide at least three meaningful argument sets for each parameterized
test;
- Only combine cases that invoke the same method under test and use the
same form of assertion.
diff --git a/docs/community/content/involved/conduct/code.cn.md
b/docs/community/content/involved/conduct/code.cn.md
index 7b925d7c77c..8779a511497 100644
--- a/docs/community/content/involved/conduct/code.cn.md
+++ b/docs/community/content/involved/conduct/code.cn.md
@@ -126,8 +126,7 @@ chapter = true
- 测试数据应使用标准化前缀(如 `foo_`/`bar_`)明确标识其测试用途。
- 使用 `PropertiesBuilder` 简化 `Properties` 构造。
- 参数化测试:
- - 参数化测试需通过参数提供显示名,并使用 `"{0}"` 作为展示名模板;
- - 参数化测试的首个参数必须声明为 `final String name`;
+ - 参数化测试的显示名称必须能区分测试场景;
- 每个参数化测试必须提供至少三组有意义的参数数据;
- 只合并调用相同被测方法、使用相同断言方式的用例。
diff --git a/docs/community/content/involved/conduct/code.en.md
b/docs/community/content/involved/conduct/code.en.md
index 94536dcf9f8..89a2ce3d61a 100644
--- a/docs/community/content/involved/conduct/code.en.md
+++ b/docs/community/content/involved/conduct/code.en.md
@@ -126,8 +126,7 @@ The following code of conduct is based on full compliance
with the [Apache Softw
- Test data should use standardized prefixes (e.g., `foo_`/`bar_`) to clearly
identify their test purpose
- Use `PropertiesBuilder` simplify `Properties` building.
- Parameterized tests:
- - For parameterized tests, provide display names via parameters and use
`"{0}"` as the display-name template;
- - Declare the first parameter of each parameterized test exactly as `final
String name`;
+ - Parameterized test display names must distinguish test scenarios;
- Provide at least three meaningful argument sets for each parameterized
test;
- Only combine cases that invoke the same method under test and use the
same form of assertion.
diff --git
a/kernel/data-pipeline/dialect/mysql/src/test/java/org/apache/shardingsphere/data/pipeline/mysql/ingest/incremental/client/netty/MySQLNegotiateHandlerTest.java
b/kernel/data-pipeline/dialect/mysql/src/test/java/org/apache/shardingsphere/data/pipeline/mysql/ingest/incremental/client/netty/MySQLNegotiateHandlerTest.java
index a85e375b31e..2351f4c23d8 100644
---
a/kernel/data-pipeline/dialect/mysql/src/test/java/org/apache/shardingsphere/data/pipeline/mysql/ingest/incremental/client/netty/MySQLNegotiateHandlerTest.java
+++
b/kernel/data-pipeline/dialect/mysql/src/test/java/org/apache/shardingsphere/data/pipeline/mysql/ingest/incremental/client/netty/MySQLNegotiateHandlerTest.java
@@ -91,9 +91,9 @@ class MySQLNegotiateHandlerTest {
mysqlNegotiateHandler = new MySQLNegotiateHandler(USER_NAME, PASSWORD,
authResultCallback);
}
- @ParameterizedTest
+ @ParameterizedTest(name = "{0}")
@MethodSource("handshakeParams")
- void assertChannelReadHandshakeInitPacket(final String password, final
boolean expectEmptyAuth) throws ReflectiveOperationException {
+ void assertChannelReadHandshakeInitPacket(final String name, final String
password, final boolean expectEmptyAuth) throws ReflectiveOperationException {
MySQLNegotiateHandler handler = new MySQLNegotiateHandler(USER_NAME,
password, authResultCallback);
MySQLHandshakePacket handshakePacket = new MySQLHandshakePacket(0,
false, new MySQLAuthenticationPluginData(new byte[8], new byte[12]));
handshakePacket.setAuthPluginName(MySQLAuthenticationMethod.NATIVE);
@@ -185,7 +185,7 @@ class MySQLNegotiateHandlerTest {
}
private static Stream<Arguments> handshakeParams() {
- return Stream.of(Arguments.of(PASSWORD, false), Arguments.of("",
true));
+ return Stream.of(Arguments.of("password provided", PASSWORD, false),
Arguments.of("empty password", "", true));
}
@SneakyThrows(NoSuchAlgorithmException.class)
diff --git
a/kernel/data-pipeline/scenario/cdc/client/src/test/java/org/apache/shardingsphere/data/pipeline/cdc/client/util/ProtobufAnyValueConverterTest.java
b/kernel/data-pipeline/scenario/cdc/client/src/test/java/org/apache/shardingsphere/data/pipeline/cdc/client/util/ProtobufAnyValueConverterTest.java
index e3f9c2ef72c..830ef2ca985 100644
---
a/kernel/data-pipeline/scenario/cdc/client/src/test/java/org/apache/shardingsphere/data/pipeline/cdc/client/util/ProtobufAnyValueConverterTest.java
+++
b/kernel/data-pipeline/scenario/cdc/client/src/test/java/org/apache/shardingsphere/data/pipeline/cdc/client/util/ProtobufAnyValueConverterTest.java
@@ -57,9 +57,9 @@ class ProtobufAnyValueConverterTest {
assertThat(actual.getMessage(), is(String.format("not support unpack
the type %s", any.getTypeUrl())));
}
- @ParameterizedTest
+ @ParameterizedTest(name = "{0}")
@MethodSource("supportedValues")
- void assertConvertToObject(final Any any, final Object expected) throws
InvalidProtocolBufferException {
+ void assertConvertToObject(final String name, final Any any, final Object
expected) throws InvalidProtocolBufferException {
Object actual = ProtobufAnyValueConverter.convertToObject(any);
if (expected instanceof Struct) {
Builder actualStruct = Struct.newBuilder();
@@ -80,18 +80,18 @@ class ProtobufAnyValueConverterTest {
.putFields("number",
Value.newBuilder().setNumberValue(123.45D).build())
.putFields("list",
Value.newBuilder().setListValue(ListValue.newBuilder().addValues(Value.newBuilder().setNumberValue(1)).build()).build()).build();
return Stream.of(
- Arguments.of(null, null),
- Arguments.of(Any.pack(Int32Value.of(123)), 123),
- Arguments.of(Any.pack(Int64Value.of(Long.MAX_VALUE)),
Long.MAX_VALUE),
- Arguments.of(Any.pack(UInt32Value.of(7)), 7),
-
Arguments.of(Any.pack(com.google.protobuf.Timestamp.newBuilder().setSeconds(seconds).setNanos(nanos).build()),
expectedTimestamp),
- Arguments.of(Any.pack(FloatValue.of(1.23F)), 1.23F),
- Arguments.of(Any.pack(DoubleValue.of(4.56D)), 4.56D),
- Arguments.of(Any.pack(StringValue.of("Hello")), "Hello"),
- Arguments.of(Any.pack(BoolValue.of(true)), true),
- Arguments.of(Any.pack(BytesValue.of(ByteString.copyFrom(new
byte[]{1, 2, 3}))), new byte[]{1, 2, 3}),
- Arguments.of(Any.pack(UInt64Value.of(101010L)), 101010L),
- Arguments.of(Any.pack(Empty.getDefaultInstance()), null),
- Arguments.of(Any.pack(struct), struct));
+ Arguments.of("null input", null, null),
+ Arguments.of("int32", Any.pack(Int32Value.of(123)), 123),
+ Arguments.of("int64", Any.pack(Int64Value.of(Long.MAX_VALUE)),
Long.MAX_VALUE),
+ Arguments.of("uint32", Any.pack(UInt32Value.of(7)), 7),
+ Arguments.of("timestamp",
Any.pack(com.google.protobuf.Timestamp.newBuilder().setSeconds(seconds).setNanos(nanos).build()),
expectedTimestamp),
+ Arguments.of("float", Any.pack(FloatValue.of(1.23F)), 1.23F),
+ Arguments.of("double", Any.pack(DoubleValue.of(4.56D)), 4.56D),
+ Arguments.of("string", Any.pack(StringValue.of("Hello")),
"Hello"),
+ Arguments.of("boolean", Any.pack(BoolValue.of(true)), true),
+ Arguments.of("bytes",
Any.pack(BytesValue.of(ByteString.copyFrom(new byte[]{1, 2, 3}))), new
byte[]{1, 2, 3}),
+ Arguments.of("uint64", Any.pack(UInt64Value.of(101010L)),
101010L),
+ Arguments.of("empty message",
Any.pack(Empty.getDefaultInstance()), null),
+ Arguments.of("struct", Any.pack(struct), struct));
}
}
diff --git
a/kernel/sql-federation/compiler/src/test/java/org/apache/shardingsphere/sqlfederation/compiler/sql/function/mysql/impl/MySQLBitCountFunctionTest.java
b/kernel/sql-federation/compiler/src/test/java/org/apache/shardingsphere/sqlfederation/compiler/sql/function/mysql/impl/MySQLBitCountFunctionTest.java
index 341d76594e4..c0ca3f3a794 100644
---
a/kernel/sql-federation/compiler/src/test/java/org/apache/shardingsphere/sqlfederation/compiler/sql/function/mysql/impl/MySQLBitCountFunctionTest.java
+++
b/kernel/sql-federation/compiler/src/test/java/org/apache/shardingsphere/sqlfederation/compiler/sql/function/mysql/impl/MySQLBitCountFunctionTest.java
@@ -36,22 +36,22 @@ class MySQLBitCountFunctionTest {
assertDoesNotThrow(MySQLBitCountFunction::new);
}
- @ParameterizedTest(name = "bitCount({0}) -> {1}")
+ @ParameterizedTest(name = "{0}")
@MethodSource("bitCountTestCases")
- void assertBitCountCoversAllBranches(final Object input, final Object
expected) {
+ void assertBitCountCoversAllBranches(final String name, final Object
input, final Object expected) {
assertThat(MySQLBitCountFunction.bitCount(input), is(expected));
}
private static Stream<Arguments> bitCountTestCases() {
return Stream.of(
- Arguments.of(null, null),
- Arguments.of(new byte[]{(byte) 0b00001111}, 4L),
- Arguments.of("7", 3),
- Arguments.of("", 0),
- Arguments.of("abc", 0),
- Arguments.of(new BigInteger("15"), 4),
- Arguments.of(3, 2),
- Arguments.of(1L, 1),
- Arguments.of(new Object(), 0));
+ Arguments.of("null input", null, null),
+ Arguments.of("byte array", new byte[]{(byte) 0b00001111}, 4L),
+ Arguments.of("numeric text", "7", 3),
+ Arguments.of("empty text", "", 0),
+ Arguments.of("nonnumeric text", "abc", 0),
+ Arguments.of("big integer", new BigInteger("15"), 4),
+ Arguments.of("integer", 3, 2),
+ Arguments.of("long", 1L, 1),
+ Arguments.of("unsupported object", new Object(), 0));
}
}
diff --git
a/mcp/core/src/test/java/org/apache/shardingsphere/mcp/core/tool/payload/SQLExecutionPayloadTest.java
b/mcp/core/src/test/java/org/apache/shardingsphere/mcp/core/tool/payload/SQLExecutionPayloadTest.java
index b0afe75f52e..41f4c9a38da 100644
---
a/mcp/core/src/test/java/org/apache/shardingsphere/mcp/core/tool/payload/SQLExecutionPayloadTest.java
+++
b/mcp/core/src/test/java/org/apache/shardingsphere/mcp/core/tool/payload/SQLExecutionPayloadTest.java
@@ -92,16 +92,16 @@ class SQLExecutionPayloadTest {
@ParameterizedTest(name = "{0}")
@CsvSource({
- "TRANSACTION_CONTROL, BEGIN, Transaction started.",
- "TRANSACTION_CONTROL, START TRANSACTION, Transaction started.",
- "TRANSACTION_CONTROL, COMMIT, Transaction committed.",
- "TRANSACTION_CONTROL, ROLLBACK, Transaction rolled back.",
- "SAVEPOINT, SAVEPOINT, Savepoint created.",
- "SAVEPOINT, ROLLBACK TO SAVEPOINT, Savepoint rolled back.",
- "SAVEPOINT, RELEASE SAVEPOINT, Savepoint released.",
- "DDL, CREATE, Statement executed."
+ "begin, TRANSACTION_CONTROL, BEGIN, Transaction started.",
+ "start transaction, TRANSACTION_CONTROL, START TRANSACTION,
Transaction started.",
+ "commit, TRANSACTION_CONTROL, COMMIT, Transaction committed.",
+ "rollback, TRANSACTION_CONTROL, ROLLBACK, Transaction rolled
back.",
+ "savepoint, SAVEPOINT, SAVEPOINT, Savepoint created.",
+ "rollback to savepoint, SAVEPOINT, ROLLBACK TO SAVEPOINT,
Savepoint rolled back.",
+ "release savepoint, SAVEPOINT, RELEASE SAVEPOINT, Savepoint
released.",
+ "create, DDL, CREATE, Statement executed."
})
- void assertStatementAcknowledgement(final SupportedMCPStatement
statementClass, final String statementType, final String expectedSummary) {
+ void assertStatementAcknowledgement(final String name, final
SupportedMCPStatement statementClass, final String statementType, final String
expectedSummary) {
Map<String, Object> actual =
SQLExecutionPayload.executed(SQLExecutionResult.statementAck(
statementClass, statementType, 100, 0,
statementType)).toPayload();
assertThat(actual.get("summary"), is(expectedSummary));
diff --git
a/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/tcl/local/LocalTCLProxyBackendHandlerFactoryTest.java
b/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/tcl/local/LocalTCLProxyBackendHandlerFactoryTest.java
index a8c4c452fee..5ee46160a44 100644
---
a/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/tcl/local/LocalTCLProxyBackendHandlerFactoryTest.java
+++
b/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/tcl/local/LocalTCLProxyBackendHandlerFactoryTest.java
@@ -128,9 +128,9 @@ class LocalTCLProxyBackendHandlerFactoryTest {
assertThat(LocalTCLProxyBackendHandlerFactory.newInstance(queryContext,
connectionSession), is(expected));
}
- @ParameterizedTest
+ @ParameterizedTest(name = "{0}")
@MethodSource("assertNewInstanceArguments")
- void assertNewInstance(final TCLStatement sqlStatement, final Class<?
extends ProxyBackendHandler> expectedClass) {
+ void assertNewInstance(final String name, final TCLStatement sqlStatement,
final Class<? extends ProxyBackendHandler> expectedClass) {
assertThat(LocalTCLProxyBackendHandlerFactory.newInstance(mockQueryContext(sqlStatement),
connectionSession), isA(expectedClass));
}
@@ -142,14 +142,14 @@ class LocalTCLProxyBackendHandlerFactoryTest {
private static Stream<Arguments> assertNewInstanceArguments() {
return Stream.of(
- Arguments.of(new BeginTransactionStatement(DATABASE_TYPE),
BeginTransactionProxyBackendHandler.class),
- Arguments.of(new StartTransactionStatement(DATABASE_TYPE),
BeginTransactionProxyBackendHandler.class),
- Arguments.of(new SetAutoCommitStatement(DATABASE_TYPE, false),
SetAutoCommitProxyBackendHandler.class),
- Arguments.of(new CommitStatement(DATABASE_TYPE),
CommitProxyBackendHandler.class),
- Arguments.of(new RollbackStatement(DATABASE_TYPE, "sp"),
RollbackSavepointProxyBackendHandler.class),
- Arguments.of(new RollbackStatement(DATABASE_TYPE),
RollbackProxyBackendHandler.class),
- Arguments.of(new SavepointStatement(DATABASE_TYPE, "sp"),
SetSavepointProxyBackendHandler.class),
- Arguments.of(new ReleaseSavepointStatement(DATABASE_TYPE,
"sp"), ReleaseSavepointProxyBackendHandler.class),
- Arguments.of(new SetTransactionStatement(DATABASE_TYPE,
OperationScope.SESSION, null, null), SetTransactionProxyBackendHandler.class));
+ Arguments.of("begin transaction", new
BeginTransactionStatement(DATABASE_TYPE),
BeginTransactionProxyBackendHandler.class),
+ Arguments.of("start transaction", new
StartTransactionStatement(DATABASE_TYPE),
BeginTransactionProxyBackendHandler.class),
+ Arguments.of("disable autocommit", new
SetAutoCommitStatement(DATABASE_TYPE, false),
SetAutoCommitProxyBackendHandler.class),
+ Arguments.of("commit", new CommitStatement(DATABASE_TYPE),
CommitProxyBackendHandler.class),
+ Arguments.of("rollback to savepoint", new
RollbackStatement(DATABASE_TYPE, "sp"),
RollbackSavepointProxyBackendHandler.class),
+ Arguments.of("rollback", new RollbackStatement(DATABASE_TYPE),
RollbackProxyBackendHandler.class),
+ Arguments.of("set savepoint", new
SavepointStatement(DATABASE_TYPE, "sp"), SetSavepointProxyBackendHandler.class),
+ Arguments.of("release savepoint", new
ReleaseSavepointStatement(DATABASE_TYPE, "sp"),
ReleaseSavepointProxyBackendHandler.class),
+ Arguments.of("set session transaction", new
SetTransactionStatement(DATABASE_TYPE, OperationScope.SESSION, null, null),
SetTransactionProxyBackendHandler.class));
}
}
diff --git a/src/resources/checkstyle.xml b/src/resources/checkstyle.xml
index 35c8ad78bd3..a958550586a 100644
--- a/src/resources/checkstyle.xml
+++ b/src/resources/checkstyle.xml
@@ -133,18 +133,6 @@
value="//METHOD_DEF[./MODIFIERS/ANNOTATION[(./IDENT[@text='Test'] or
./DOT/IDENT[@text='Test'] or ./IDENT[@text='ParameterizedTest'] or
./DOT/IDENT[@text='ParameterizedTest'] or ./IDENT[@text='RepeatedTest'] or
./DOT/IDENT[@text='RepeatedTest'] or ./IDENT[@text='TestFactory'] or
./DOT/IDENT[@text='TestFactory'] or ./IDENT[@text='TestTemplate'] or
./DOT/IDENT[@text='TestTemplate'])] and not(./IDENT[starts-with(@text,
'assert')])]" />
<message key="matchxpath.match" value="Test method names must
start with 'assert'." />
</module>
- <module name="MatchXpath">
- <property name="id" value="ParameterizedTestDisplayName" />
- <property name="severity" value="warning" />
- <property name="query"
value="//METHOD_DEF/MODIFIERS/ANNOTATION[(./IDENT[@text='ParameterizedTest'] or
./DOT/IDENT[@text='ParameterizedTest']) and
not(./ANNOTATION_MEMBER_VALUE_PAIR[./IDENT[@text='name'] and
./EXPR/STRING_LITERAL[@text='{0}']])]" />
- <message key="matchxpath.match" value="Parameterized tests must
use name = "{0}"." />
- </module>
- <module name="MatchXpath">
- <property name="id" value="ParameterizedTestNameParameter" />
- <property name="severity" value="warning" />
- <property name="query"
value="//METHOD_DEF[./MODIFIERS/ANNOTATION[(./IDENT[@text='ParameterizedTest']
or
./DOT/IDENT[@text='ParameterizedTest'])]]/PARAMETERS[not(./PARAMETER_DEF[1][./MODIFIERS/FINAL
and ./IDENT[@text='name'] and not(./ELLIPSIS) and
./TYPE[not(.//ARRAY_DECLARATOR) and (./IDENT[@text='String'] or
./DOT[./IDENT[@text='String'] and ./DOT[./IDENT[@text='java'] and
./IDENT[@text='lang']]])]])]" />
- <message key="matchxpath.match" value="Declare final String name
as the first parameter of parameterized tests." />
- </module>
<module name="MatchXpath">
<property name="query" value="//VARIABLE_DEF[./MODIFIERS/FINAL and
(parent::FOR_INIT or parent::FOR_EACH_CLAUSE)]" />
<message key="matchxpath.match" value="Do not declare for-loop
variables as final." />