sluk3r commented on a change in pull request #3281: #3138 improved coverage for 
sharding core preprocessor
URL: 
https://github.com/apache/incubator-shardingsphere/pull/3281#discussion_r335741580
 
 

 ##########
 File path: 
sharding-core/sharding-core-preprocessor/src/test/java/org/apache/shardingsphere/core/preprocessor/segment/select/projection/engine/ProjectionsContextEngineTest.java
 ##########
 @@ -59,4 +62,40 @@ public void 
assertProjectionsContextCreatedProperlyWhenSelectItemPresent() {
         ProjectionsContext projectionsContext = new 
ProjectionsContextEngine(null).createProjectionsContext(null, selectStatement, 
mock(GroupByContext.class), mock(OrderByContext.class));
         assertNotNull(projectionsContext);
     }
+    
+    @Test
+    public void createProjectionsContextWhenOrderByContextOrderItemsPresent() {
+        SelectStatement selectStatement = mock(SelectStatement.class);
+        SelectItemsSegment selectItemsSegment = mock(SelectItemsSegment.class);
+        when(selectStatement.getSelectItems()).thenReturn(selectItemsSegment);
+        ShorthandSelectItemSegment shorthandSelectItemSegment = new 
ShorthandSelectItemSegment(0, 10, "text");
+        TableSegment owner = new TableSegment(0, 10, "name");
+        owner.setOwner(new SchemaSegment(0, 10, "name"));
+        shorthandSelectItemSegment.setOwner(owner);
+        
when(selectItemsSegment.getSelectItems()).thenReturn(Collections.<SelectItemSegment>singleton(shorthandSelectItemSegment));
+        OrderByContext orderByContext = mock(OrderByContext.class);
+        OrderByItem orderByItem = mock(OrderByItem.class);
+        
when(orderByItem.getSegment()).thenReturn(mock(IndexOrderByItemSegment.class));
+        
when(orderByContext.getItems()).thenReturn(Collections.singletonList(orderByItem));
+        ProjectionsContext actual = new 
ProjectionsContextEngine(null).createProjectionsContext(null, selectStatement, 
mock(GroupByContext.class), orderByContext);
+        assertNotNull(actual);
+    }
+    
+    @Test
+    public void 
assertProjectionsContextCreatedProperlyWhenOrderByItemSegmentNotInstanceOfIndexOrderByItemSegment()
 {
 
 Review comment:
   OK

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to