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 3c0edc14b07 Fix example compile error (#35861)
3c0edc14b07 is described below

commit 3c0edc14b0768b0a3df99c9cf03a7f925bc693e2
Author: Liang Zhang <[email protected]>
AuthorDate: Wed Jul 2 22:33:52 2025 +0800

    Fix example compile error (#35861)
---
 examples/pom.xml                                   | 16 ++++++++++++++++
 .../shardingsphere-jdbc-example-generator/pom.xml  | 22 ++++++++++++++++++++++
 .../src/test/java/PomTemplateTest.java             | 13 +++++--------
 3 files changed, 43 insertions(+), 8 deletions(-)

diff --git a/examples/pom.xml b/examples/pom.xml
index 6774c6284da..39d7fcd9012 100644
--- a/examples/pom.xml
+++ b/examples/pom.xml
@@ -58,6 +58,9 @@
         <jboss-logging.version>3.2.1.Final</jboss-logging.version>
         
         <seata.version>1.6.1</seata.version>
+
+        <junit.version>5.11.2</junit.version>
+        <hamcrest.version>3.0</hamcrest.version>
         
         <apache-rat-plugin.version>0.12</apache-rat-plugin.version>
         <maven-compiler-plugin.version>3.13.0</maven-compiler-plugin.version>
@@ -278,6 +281,19 @@
                 <version>${freemarker.version}</version>
             </dependency>
             
+            <dependency>
+                <groupId>org.junit</groupId>
+                <artifactId>junit-bom</artifactId>
+                <version>${junit.version}</version>
+                <type>pom</type>
+                <scope>import</scope>
+            </dependency>
+            <dependency>
+                <groupId>org.hamcrest</groupId>
+                <artifactId>hamcrest</artifactId>
+                <version>${hamcrest.version}</version>
+                <scope>test</scope>
+            </dependency>
             <dependency>
                 <groupId>org.springframework.boot</groupId>
                 <artifactId>spring-boot-starter-test</artifactId>
diff --git a/examples/shardingsphere-jdbc-example-generator/pom.xml 
b/examples/shardingsphere-jdbc-example-generator/pom.xml
index ac26e201d2d..df1c2e5b0ac 100644
--- a/examples/shardingsphere-jdbc-example-generator/pom.xml
+++ b/examples/shardingsphere-jdbc-example-generator/pom.xml
@@ -41,6 +41,28 @@
             <groupId>org.freemarker</groupId>
             <artifactId>freemarker</artifactId>
         </dependency>
+        
+        <dependency>
+            <groupId>org.junit.jupiter</groupId>
+            <artifactId>junit-jupiter-api</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.junit.jupiter</groupId>
+            <artifactId>junit-jupiter-engine</artifactId>
+            <version>${junit.version}</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.junit.jupiter</groupId>
+            <artifactId>junit-jupiter-params</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.hamcrest</groupId>
+            <artifactId>hamcrest</artifactId>
+            <scope>test</scope>
+        </dependency>
     </dependencies>
     
     <profiles>
diff --git 
a/examples/shardingsphere-jdbc-example-generator/src/test/java/PomTemplateTest.java
 
b/examples/shardingsphere-jdbc-example-generator/src/test/java/PomTemplateTest.java
index e64d4db8533..2290263ff8e 100644
--- 
a/examples/shardingsphere-jdbc-example-generator/src/test/java/PomTemplateTest.java
+++ 
b/examples/shardingsphere-jdbc-example-generator/src/test/java/PomTemplateTest.java
@@ -28,11 +28,12 @@ import java.util.Map;
 
 import static org.hamcrest.CoreMatchers.containsString;
 import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.not;
 
 /**
  * Test case for pom template generation.
  */
-public class PomTemplateTest {
+public final class PomTemplateTest {
 
     private Configuration templateConfig;
 
@@ -43,7 +44,7 @@ public class PomTemplateTest {
     }
 
     @Test
-    public void testStandaloneJdbcRepository() throws IOException, 
TemplateException {
+    public void assertStandaloneJdbcRepository() throws IOException, 
TemplateException {
         Map<String, Object> dataModel = new HashMap<>();
         dataModel.put("mode", "standalone");
         dataModel.put("repository", "JDBC");
@@ -51,17 +52,15 @@ public class PomTemplateTest {
         dataModel.put("framework", "spring-boot-starter-jdbc");
         dataModel.put("transaction", "local");
         dataModel.put("shardingsphereVersion", "5.5.3-SNAPSHOT");
-        
         Template template = templateConfig.getTemplate("pom.ftl");
         StringWriter writer = new StringWriter();
         template.process(dataModel, writer);
-        
         String result = writer.toString();
         assertThat(result, 
containsString("shardingsphere-standalone-mode-repository-jdbc"));
     }
 
     @Test
-    public void testNoStandaloneJdbcRepository() throws IOException, 
TemplateException {
+    public void assertNoStandaloneJdbcRepository() throws IOException, 
TemplateException {
         Map<String, Object> dataModel = new HashMap<>();
         dataModel.put("mode", "standalone");
         dataModel.put("repository", "File");
@@ -69,12 +68,10 @@ public class PomTemplateTest {
         dataModel.put("framework", "spring-boot-starter-jdbc");
         dataModel.put("transaction", "local");
         dataModel.put("shardingsphereVersion", "5.5.3-SNAPSHOT");
-        
         Template template = templateConfig.getTemplate("pom.ftl");
         StringWriter writer = new StringWriter();
         template.process(dataModel, writer);
-        
         String result = writer.toString();
-        assertThat(result, 
!containsString("shardingsphere-standalone-mode-repository-jdbc"));
+        assertThat(result, 
not(containsString("shardingsphere-standalone-mode-repository-jdbc")));
     }
 }

Reply via email to