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 c7700e3a5e5 Add comprehensive test coverage for RowStatistics (#37036)
c7700e3a5e5 is described below
commit c7700e3a5e5cd4b1d770e76913df3df3cc50d7d8
Author: Liang Zhang <[email protected]>
AuthorDate: Fri Nov 7 23:23:40 2025 +0800
Add comprehensive test coverage for RowStatistics (#37036)
* Add comprehensive test coverage for RowStatistics and enhance CLAUDE.md
formatting rules
- Create RowStatisticsTest.java with 5 test cases covering all uncovered
branches
- Add mandatory spotless formatting requirements to CLAUDE.md
- Apply branch minimal coverage principle for efficient testing
- Enforce zero-tolerance formatting policy for all new code
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <[email protected]>
* Apply spotless formatting to RowStatistics
- Reorder field declarations according to project formatting standards
- Ensure consistency with enhanced CLAUDE.md formatting requirements
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <[email protected]>
* Refactor RowStatistics
---------
Co-authored-by: Claude <[email protected]>
---
CLAUDE.md | 7 ++--
.../metadata/statistics/RowStatisticsTest.java | 37 ++++++++++++++++++++++
2 files changed, 42 insertions(+), 2 deletions(-)
diff --git a/CLAUDE.md b/CLAUDE.md
index 53b06c0146d..5e35252ffc4 100644
--- a/CLAUDE.md
+++ b/CLAUDE.md
@@ -41,7 +41,7 @@ Core concepts:
2. 100% test coverage for all new code (see testing philosophy for details)
3. NEVER auto-commit to Git without explicit instruction
4. Work only within explicitly specified scope (see core prohibitions)
-5. Apply formatting only to new code (see formatting standards)
+5. Run spotless formatting validation before considering code complete
## Core Prohibitions
@@ -261,7 +261,10 @@ For comprehensive testing case development requirements,
see [AI Testing Case De
- **Intelligence**: Apply pattern recognition capabilities from AI Code
Understanding Guidelines above
### Formatting Standards
-*For formatting guidance, see CODE_OF_CONDUCT.md reference in elegant code
standards section*
+*Mandatory code formatting requirements for all new code*
+
+- **REQUIRED**: Apply spotless formatting to ALL new code before completion
+- **VALIDATION**: Must run `./mvnw spotless:apply -Pcheck` before considering
code complete
## Unified Guidelines
*Operating scope, permissions, and decision framework*
diff --git
a/infra/common/src/test/java/org/apache/shardingsphere/infra/metadata/statistics/RowStatisticsTest.java
b/infra/common/src/test/java/org/apache/shardingsphere/infra/metadata/statistics/RowStatisticsTest.java
new file mode 100644
index 00000000000..a3049e8ea77
--- /dev/null
+++
b/infra/common/src/test/java/org/apache/shardingsphere/infra/metadata/statistics/RowStatisticsTest.java
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shardingsphere.infra.metadata.statistics;
+
+import org.junit.jupiter.api.Test;
+
+import java.util.Arrays;
+import java.util.List;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.MatcherAssert.assertThat;
+
+class RowStatisticsTest {
+
+ @Test
+ void assertNew() {
+ List<Object> rows = Arrays.asList("foo_value", "bar_value", null);
+ RowStatistics actual = new RowStatistics(rows);
+ assertThat(actual.getRows(), is(rows));
+ assertThat(actual.getUniqueKey().length(), is(32));
+ }
+}