terrymanu commented on code in PR #19110:
URL: https://github.com/apache/shardingsphere/pull/19110#discussion_r920176180


##########
shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/admin/mysql/executor/ShowConnectionIdExecutorTest.java:
##########
@@ -47,4 +72,28 @@ private ConnectionSession mockConnectionSession() {
         when(result.getConnectionId()).thenReturn(109);
         return result;
     }
+    
+    private SelectStatement mockSelectStatement() {
+
+        Collection<ProjectionSegment> projections = new LinkedList<>();
+        ProjectionsSegment segment = mock(ProjectionsSegment.class);
+        when(segment.getProjections()).thenReturn(projections);
+

Review Comment:
   Please remove useless blank line



##########
shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/admin/mysql/executor/ShowConnectionIdExecutorTest.java:
##########
@@ -47,4 +72,28 @@ private ConnectionSession mockConnectionSession() {
         when(result.getConnectionId()).thenReturn(109);
         return result;
     }
+    
+    private SelectStatement mockSelectStatement() {
+

Review Comment:
   Please remove useless blank line



##########
shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/admin/mysql/executor/ShowConnectionIdExecutorTest.java:
##########
@@ -47,4 +72,28 @@ private ConnectionSession mockConnectionSession() {
         when(result.getConnectionId()).thenReturn(109);
         return result;
     }
+    
+    private SelectStatement mockSelectStatement() {
+
+        Collection<ProjectionSegment> projections = new LinkedList<>();
+        ProjectionsSegment segment = mock(ProjectionsSegment.class);
+        when(segment.getProjections()).thenReturn(projections);
+
+        SelectStatement statement = mock(SelectStatement.class);
+        when(statement.getProjections()).thenReturn(segment);
+        return statement;
+    }
+    
+    private SelectStatement mockSelectStatementWithAlias() {
+        Collection<ProjectionSegment> projections = new LinkedList<>();
+        ExpressionProjectionSegment projectionSegment = new 
ExpressionProjectionSegment(0, 0, "connection_id()");
+        projectionSegment.setAlias(new AliasSegment(0, 0, new 
IdentifierValue("test_alias")));
+        projections.add(projectionSegment);
+        ProjectionsSegment segment = mock(ProjectionsSegment.class);
+        when(segment.getProjections()).thenReturn(projections);
+
+        SelectStatement statement = mock(SelectStatement.class);
+        when(statement.getProjections()).thenReturn(segment);
+        return statement;

Review Comment:
   return value should name as `result`



##########
shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/admin/mysql/executor/ShowConnectionIdExecutorTest.java:
##########
@@ -47,4 +72,28 @@ private ConnectionSession mockConnectionSession() {
         when(result.getConnectionId()).thenReturn(109);
         return result;
     }
+    
+    private SelectStatement mockSelectStatement() {
+
+        Collection<ProjectionSegment> projections = new LinkedList<>();
+        ProjectionsSegment segment = mock(ProjectionsSegment.class);
+        when(segment.getProjections()).thenReturn(projections);
+
+        SelectStatement statement = mock(SelectStatement.class);
+        when(statement.getProjections()).thenReturn(segment);
+        return statement;
+    }
+    
+    private SelectStatement mockSelectStatementWithAlias() {
+        Collection<ProjectionSegment> projections = new LinkedList<>();
+        ExpressionProjectionSegment projectionSegment = new 
ExpressionProjectionSegment(0, 0, "connection_id()");
+        projectionSegment.setAlias(new AliasSegment(0, 0, new 
IdentifierValue("test_alias")));
+        projections.add(projectionSegment);
+        ProjectionsSegment segment = mock(ProjectionsSegment.class);
+        when(segment.getProjections()).thenReturn(projections);
+

Review Comment:
   Please remove useless blank line



##########
shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/admin/mysql/executor/ShowConnectionIdExecutorTest.java:
##########
@@ -47,4 +72,28 @@ private ConnectionSession mockConnectionSession() {
         when(result.getConnectionId()).thenReturn(109);
         return result;
     }
+    
+    private SelectStatement mockSelectStatement() {
+
+        Collection<ProjectionSegment> projections = new LinkedList<>();
+        ProjectionsSegment segment = mock(ProjectionsSegment.class);
+        when(segment.getProjections()).thenReturn(projections);
+
+        SelectStatement statement = mock(SelectStatement.class);
+        when(statement.getProjections()).thenReturn(segment);
+        return statement;

Review Comment:
   return value should name as `result`



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to