terrymanu 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_r335031831
 
 

 ##########
 File path: 
sharding-core/sharding-core-preprocessor/src/test/java/org/apache/shardingsphere/core/preprocessor/segment/table/TablesContextTest.java
 ##########
 @@ -181,6 +185,24 @@ public void 
assertFindTableNameWhenColumnSegmentOwnerAbsentAndTableMetasContains
         assertTrue(new 
TablesContext(selectStatement).findTableName(columnSegment, 
tableMetas).isPresent());
     }
     
+    @Test
+    public void assertGetSchema() {
+        SelectStatement selectStatement = new SelectStatement();
+        selectStatement.getAllSQLSegments().add(createTableSegment("table_1", 
"tbl_1"));
+        assertFalse(new 
TablesContext(selectStatement).getSchema().isPresent());
+    }
+    
+    @Test
+    public void assertInstanceCreatedWhenNoExceptionThrown() {
+        SQLStatement sqlStatement = mock(SQLStatement.class);
+        TableSegment tableSegment = new TableSegment(0, 10, 
"TableSegmentName");
+        SchemaSegment schemaSegment = mock(SchemaSegment.class);
+        when(schemaSegment.getName()).thenReturn("SchemaSegmentName");
+        tableSegment.setOwner(schemaSegment);
+        
when(sqlStatement.findSQLSegments(TableAvailable.class)).thenReturn(Collections.singletonList((TableAvailable)
 tableSegment));
 
 Review comment:
   More blank line is unnecessary.
   

----------------------------------------------------------------
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