This is an automated email from the ASF dual-hosted git repository.

duanzhengqiang 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 1445d2f2326 Fix sonar issues (#31454)
1445d2f2326 is described below

commit 1445d2f23264f41779ee905ea0050c7fddecb403
Author: Liang Zhang <[email protected]>
AuthorDate: Fri May 31 12:49:12 2024 +0800

    Fix sonar issues (#31454)
---
 .../service/StandaloneProcessPersistServiceTest.java          | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git 
a/mode/type/standalone/core/src/test/java/org/apache/shardingsphere/mode/manager/standalone/service/StandaloneProcessPersistServiceTest.java
 
b/mode/type/standalone/core/src/test/java/org/apache/shardingsphere/mode/manager/standalone/service/StandaloneProcessPersistServiceTest.java
index 8c9e53d028a..6b646c42015 100644
--- 
a/mode/type/standalone/core/src/test/java/org/apache/shardingsphere/mode/manager/standalone/service/StandaloneProcessPersistServiceTest.java
+++ 
b/mode/type/standalone/core/src/test/java/org/apache/shardingsphere/mode/manager/standalone/service/StandaloneProcessPersistServiceTest.java
@@ -27,8 +27,7 @@ import org.junit.jupiter.api.extension.ExtendWith;
 
 import java.sql.SQLException;
 import java.sql.Statement;
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
+import java.util.Collections;
 
 import static org.mockito.ArgumentMatchers.any;
 import static org.mockito.Mockito.mock;
@@ -47,7 +46,7 @@ class StandaloneProcessPersistServiceTest {
     }
     
     @Test
-    void getProcessList() {
+    void assertGetProcessList() {
         ProcessRegistry processRegistry = mock(ProcessRegistry.class);
         when(ProcessRegistry.getInstance()).thenReturn(processRegistry);
         processPersistService.getProcessList();
@@ -55,14 +54,12 @@ class StandaloneProcessPersistServiceTest {
     }
     
     @Test
-    void killProcess() throws SQLException {
+    void assertKillProcess() throws SQLException {
         ProcessRegistry processRegistry = mock(ProcessRegistry.class);
         when(ProcessRegistry.getInstance()).thenReturn(processRegistry);
         Process process = mock(Process.class);
         Statement statement = mock(Statement.class);
-        Map<Integer, Statement> processStatements = new ConcurrentHashMap<>();
-        processStatements.put(1, statement);
-        when(process.getProcessStatements()).thenReturn(processStatements);
+        
when(process.getProcessStatements()).thenReturn(Collections.singletonMap(1, 
statement));
         when(processRegistry.get(any())).thenReturn(process);
         processPersistService.killProcess("foo_process_id");
         verify(statement).cancel();

Reply via email to